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)

14
15
16
# File 'lib/ftpd/session_config.rb', line 14

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


24
25
26
# File 'lib/ftpd/session_config.rb', line 24

def auth_level
  @auth_level
end

#driverObject

The driver should expose these public methods:

Returns:

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


33
34
35
# File 'lib/ftpd/session_config.rb', line 33

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)

107
108
109
# File 'lib/ftpd/session_config.rb', line 107

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.


39
40
41
# File 'lib/ftpd/session_config.rb', line 39

def 
  @failed_login_delay
end

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

The class for formatting for LIST output.

Returns:


45
46
47
# File 'lib/ftpd/session_config.rb', line 45

def list_formatter
  @list_formatter
end

#logLogger

The logger.

Returns:

  • (Logger)

51
52
53
# File 'lib/ftpd/session_config.rb', line 51

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)

59
60
61
# File 'lib/ftpd/session_config.rb', line 59

def max_failed_logins
  @max_failed_logins
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)

67
68
69
# File 'lib/ftpd/session_config.rb', line 67

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)

74
75
76
# File 'lib/ftpd/session_config.rb', line 74

def server_name
  @server_name
end

#server_versionString

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

Returns:

  • (String)

80
81
82
# File 'lib/ftpd/session_config.rb', line 80

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)

88
89
90
# File 'lib/ftpd/session_config.rb', line 88

def session_timeout
  @session_timeout
end

#tlsSymbol

Whether or not to do TLS, and which flavor.

One of:

  • :off

  • :explicit

  • :implicit

Returns:

  • (Symbol)

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

def tls
  @tls
end