Class: Ftpd::SessionConfig
- Inherits:
-
Object
- Object
- Ftpd::SessionConfig
- Defined in:
- lib/ftpd/session_config.rb
Overview
All of the configuration needed by a session
Instance Attribute Summary collapse
-
#allow_low_data_ports ⇒ Boolean
If true, allow the PORT command to specify privileged data ports (those below 1024).
-
#auth_level ⇒ Integer
The authentication level.
-
#driver ⇒ Object
A driver for the server’s dynamic behavior such as authentication and file system access.
-
#exception_handler ⇒ Proc
The exception handler.
-
#failed_login_delay ⇒ Object
The delay (in seconds) after a failed login.
-
#list_formatter ⇒ class that quacks like Ftpd::ListFormat::Ls
The class for formatting for LIST output.
-
#log ⇒ Logger
The logger.
-
#max_failed_logins ⇒ Integer
The maximum number of failed login attempts before disconnecting the user.
-
#nat_ip ⇒ nil, String
The advertised public IP for passive mode connections.
-
#passive_ports ⇒ nil, Range
The range of ports for passive mode connections.
-
#response_delay ⇒ Numeric
The number of seconds to delay before replying.
-
#server_name ⇒ String
The server’s name, sent in a STAT reply.
-
#server_version ⇒ String
The server’s version, sent in a STAT reply.
-
#session_timeout ⇒ Numeric
The session timeout.
-
#tls ⇒ Symbol
Whether or not to do TLS, and which flavor.
Instance Attribute Details
#allow_low_data_ports ⇒ Boolean
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.
16 17 18 |
# File 'lib/ftpd/session_config.rb', line 16 def allow_low_data_ports @allow_low_data_ports end |
#auth_level ⇒ Integer
The authentication level. One of:
-
Ftpd::AUTH_USER
-
Ftpd::AUTH_PASSWORD (default)
-
Ftpd::AUTH_ACCOUNT
26 27 28 |
# File 'lib/ftpd/session_config.rb', line 26 def auth_level @auth_level end |
#driver ⇒ Object
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_handler ⇒ Proc
The exception handler. When there is an unknown exception, server replies 451 and calls exception_handler. If nil, then it’s ignored.
131 132 133 |
# File 'lib/ftpd/session_config.rb', line 131 def exception_handler @exception_handler end |
#failed_login_delay ⇒ Object
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 @failed_login_delay end |
#list_formatter ⇒ class that quacks like Ftpd::ListFormat::Ls
The class for formatting for LIST output.
47 48 49 |
# File 'lib/ftpd/session_config.rb', line 47 def list_formatter @list_formatter end |
#log ⇒ Logger
The logger.
53 54 55 |
# File 'lib/ftpd/session_config.rb', line 53 def log @log end |
#max_failed_logins ⇒ Integer
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.
61 62 63 |
# File 'lib/ftpd/session_config.rb', line 61 def max_failed_logins @max_failed_logins end |
#nat_ip ⇒ nil, 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.
82 83 84 |
# File 'lib/ftpd/session_config.rb', line 82 def nat_ip @nat_ip end |
#passive_ports ⇒ nil, 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.
91 92 93 |
# File 'lib/ftpd/session_config.rb', line 91 def passive_ports @passive_ports end |
#response_delay ⇒ Numeric
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).
69 70 71 |
# File 'lib/ftpd/session_config.rb', line 69 def response_delay @response_delay end |
#server_name ⇒ String
The server’s name, sent in a STAT reply. Defaults to FtpServer::DEFAULT_SERVER_NAME.
98 99 100 |
# File 'lib/ftpd/session_config.rb', line 98 def server_name @server_name end |
#server_version ⇒ String
The server’s version, sent in a STAT reply.
104 105 106 |
# File 'lib/ftpd/session_config.rb', line 104 def server_version @server_version end |
#session_timeout ⇒ Numeric
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.
112 113 114 |
# File 'lib/ftpd/session_config.rb', line 112 def session_timeout @session_timeout end |
#tls ⇒ Symbol
Whether or not to do TLS, and which flavor.
One of:
-
:off
-
:explicit
-
:implicit
123 124 125 |
# File 'lib/ftpd/session_config.rb', line 123 def tls @tls end |