|Securing and Optimizing Linux: RedHat Edition -A Hands on Guide
|Chapter 16. Software -Securties(commercial)
The configuration file for sshd2 /etc/ssh2/sshd2_config allows you to set options that modify the operation of the daemon. The files contain keyword-value pairs, one per line, with keywords being case insensitive. Here are the more important keywords; a complete listing is available in the man page for sshd2(8).
Edit the sshd2_config file (vi /etc/ssh2/sshs2_config and add or change, if necessary:
# sshd2_config # SSH 2.0 Server Configuration File *:Port 22 ListenAddress 192.168.1.1 Ciphers blowfish IdentityFile identification AuthorizationFile authorization HostKeyFile hostkey PublicHostKeyFile hostkey.pub RandomSeedFile random_seed ForwardAgent no ForwardX11 no PasswordGuesses 3 MaxConnections 5 PermitRootLogin no AllowedAuthentications publickey,password RequiredAuthentications publickey,password VerboseMode no PrintMotd yes CheckMail yes UserConfigDirectory "%D/.ssh2" SyslogFacility DAEMON Ssh1Compatibility no NoDelay yes KeepAlive yes UserKnownHosts yes AllowHosts 192.168.1.4 DenyHosts * QuietMode no # subsystem definitions subsystem-sftp sftp-server
The option Port specifies which port number the ssh2 daemon listens to for ssh incoming connection. The default port is 22.
The option ListenAddress specifies the IP address of the interface network on which the ssh2 daemon server socket is bound. The default is 0.0.0.0; to improve security you may specify only the required ones to limit possible addresses.
The option Ciphers specifies what cipher should be used for encrypting sessions. The blowfish uses 64-bit blocks and keys of up to 448 bits.
The option IdentityFile specifies an alternate name for the user's identification file.
The option AuthorizationFile specifies an alternate name for the user's authorization file.
The option HostKeyFile specifies an alternate file containing the private host key. The default is /etc/ssh2/hostkey.
The option PublicHostKeyFile specifies an alternate file containing the public host key. The default is /etc/ssh2/hostkey.pub.
The option RandomSeedFile specifies an alternate name for the user's random seed file.
The option ForwardAgent specifies which connection authentication agent if any should be forwarded to the remote machine.
The option ForwardX11 is for people that use the Xwindow GUI and want to automatically redirect X11 sessions to the remote machine. Since we set up a server and don't have a GUI installed on it, we can safely turn this option off.
The option PasswordGuesses specifies how many tries the user has when using password authentication.
The option MaxConnections specifies what the maximum number of connections that ssh2 daemon will handle simultaneously is.
The option PermitRootLogin specifies whether root can log in using ssh. Never say, yes to this option.
The option AllowedAuthentications specifies which authentication methods are allowed to be used. With this option the administrator can force users to complete several authentications before they are considered authenticated.
The option RequiredAuthentications related to AllowedAuthentications, specifies which authentication methods the users must complete before continuing. This parameter must be the same as for the AllowedAuthentications option or the server will denies connection every time.
The option VerboseMode instructs the ssh2 daemon to print debugging messages about its progress. This option is helpful in debugging connection, authentication, and configuration problems.
The option PrintMotd specifies whether the ssh2 daemon should print the content of the /etc/motd file when a user logs in interactively. The /etc/motd file is also know as the message of the day.
The option CheckMail specifies whether the ssh2 daemon should print information about new mail you may have.
The option UserConfigDirectory specifies the default location for user-specific configuration data.
The option SyslogFacility specifies the facility code used when logging messages from the ssh2 daemon. The facility specifies the subsystem that produced the message, in our case DAEMON.
The option Ssh1Compatibility specifies whether or not to use SSH1 compatibility code with SSH2 for ssh1 users.
The option NoDelay specifies if the socket option TCP_NODELAY should be enabled. It is recommended that you set this option to yes to improve network performance.
The option KeepAlive specifies whether the system should send keep alive messages to the remote server. If set to yes then the death of the connection or crash of remote machines will be properly noticed.
The option UserKnownHosts specifies whether the default user's home directory $HOME/.ssh2/knownhosts/ can be used to get hosts public keys when using hostbased-authentication.
The option AllowHosts specifies and control which hosts can access ssh2 services. Multiple hosts can be specified separated by spaces.
The option DenyHosts specifies and controls which hosts cannot access ssh2 services. Multiple hosts can be specified separated by spaces. The default pattern * mean all hosts.
The option QuietMode specifies whether the system runs in quiet mode. This option must be set to no, because in quiet mode nothing is logged in the system log except for fatal errors. Since we want to have information about user sessions it is preferable to disable this option.