Class: Ftpd::SessionConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/ftpd/session_config.rb

Overview

All of the configuration needed by a session

Instance Attribute Summary collapse

Instance Attribute Details

#allow_low_data_portsBoolean

If true, allow the PORT command to specify privileged data ports (those below 1024). Defaults to false. Setting this to true makes it easier for an attacker to use the server to attack another server. See RFC 2577 section 3.

Returns:

  • (Boolean)


16
17
18
# File 'lib/ftpd/session_config.rb', line 16

def allow_low_data_ports
  @allow_low_data_ports
end

#auth_levelInteger

The authentication level. One of:

  • Ftpd::AUTH_USER

  • Ftpd::AUTH_PASSWORD (default)

  • Ftpd::AUTH_ACCOUNT

Returns:

  • (Integer)

    The authentication level



26
27
28
# File 'lib/ftpd/session_config.rb', line 26

def auth_level
  @auth_level
end

#driverObject

A driver for the server’s dynamic behavior such as authentication and file system access.

The driver should expose these public methods:



35
36
37
# File 'lib/ftpd/session_config.rb', line 35

def driver
  @driver
end

#exception_handlerProc

The exception handler. When there is an unknown exception, server replies 451 and calls exception_handler. If nil, then it’s ignored.

Returns:

  • (Proc)


131
132
133
# File 'lib/ftpd/session_config.rb', line 131

def exception_handler
  @exception_handler
end

#failed_login_delayObject

The delay (in seconds) after a failed login. Defaults to 0. Setting this makes brute force password guessing less efficient for the attacker. RFC-2477 suggests a delay of 5 seconds.



41
42
43
# File 'lib/ftpd/session_config.rb', line 41

def 
  @failed_login_delay
end

#list_formatterclass that quacks like Ftpd::ListFormat::Ls

The class for formatting for LIST output.

Returns:



47
48
49
# File 'lib/ftpd/session_config.rb', line 47

def list_formatter
  @list_formatter
end

#logLogger

The logger.

Returns:

  • (Logger)


53
54
55
# File 'lib/ftpd/session_config.rb', line 53

def log
  @log
end

#max_failed_loginsInteger

The maximum number of failed login attempts before disconnecting the user. Defaults to nil (no maximum). When set, this may makes brute-force password guessing attack less efficient.

Returns:

  • (Integer)


61
62
63
# File 'lib/ftpd/session_config.rb', line 61

def max_failed_logins
  @max_failed_logins
end

#nat_ipnil, String

The advertised public IP for passive mode connections. This is the IP that the client must use to make a connection back to the server. If nil, the IP of the bound interface is used. When the FTP server is behind a firewall, set this to firewall’s public IP and add the appropriate rule to the firewall to forward that IP to the machine that ftpd is running on.

Set this before calling #start.

Returns:

  • (nil, String)


82
83
84
# File 'lib/ftpd/session_config.rb', line 82

def nat_ip
  @nat_ip
end

#passive_portsnil, Range

The range of ports for passive mode connections. If nil, then a random etherial port is used. Otherwise, a random port from this range is used.

Set this before calling #start.

Returns:

  • (nil, Range)


91
92
93
# File 'lib/ftpd/session_config.rb', line 91

def passive_ports
  @passive_ports
end

#response_delayNumeric

The number of seconds to delay before replying. This is for testing, when you need to test, for example, client timeouts. Defaults to 0 (no delay).

Returns:

  • (Numeric)


69
70
71
# File 'lib/ftpd/session_config.rb', line 69

def response_delay
  @response_delay
end

#server_nameString

The server’s name, sent in a STAT reply. Defaults to FtpServer::DEFAULT_SERVER_NAME.

Returns:

  • (String)


98
99
100
# File 'lib/ftpd/session_config.rb', line 98

def server_name
  @server_name
end

#server_versionString

The server’s version, sent in a STAT reply.

Returns:

  • (String)


104
105
106
# File 'lib/ftpd/session_config.rb', line 104

def server_version
  @server_version
end

#session_timeoutNumeric

The session timeout. When a session is awaiting a command, if one is not received in this many seconds, the session is disconnected. If nil, then timeout is disabled.

Returns:

  • (Numeric)


112
113
114
# File 'lib/ftpd/session_config.rb', line 112

def session_timeout
  @session_timeout
end

#tlsSymbol

Whether or not to do TLS, and which flavor.

One of:

  • :off

  • :explicit

  • :implicit

Returns:

  • (Symbol)


123
124
125
# File 'lib/ftpd/session_config.rb', line 123

def tls
  @tls
end