You are not logged in.

#1 2010-09-27 21:31:40

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,600
Website

please review this /etc/ssh/sshd_config

I'm setting up a webserver for a friend and it will be exposed to the 'net at large.  I'd like to have some of the experts in here review the  /etc/ssh/sshd_config I'm planning to use and please provide comment/suggestions.

Thanks!

Port 56190
#AddressFamily any
ListenAddress 0.0.0.0
#ListenAddress ::

#HostKey for protocol version 1
#HostKey /etc/ssh/ssh_host_key
#HostKeys for protocol version 2
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_dsa_key

#Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 1h
#ServerKeyBits 1024

#Logging
#obsoletes QuietMode and FascistLogging
#SyslogFacility AUTH
LogLevel VERBOSE

#Authentication:

LoginGraceTime 1m
PermitRootLogin no
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

RSAAuthentication yes
PubkeyAuthentication yes
#AuthorizedKeysFile    .ssh/authorized_keys

# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#RhostsRSAAuthentication no
# similar for protocol version 2
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# RhostsRSAAuthentication and HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes

# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication no
#PermitEmptyPasswords no

# Change to no to disable s/key passwords
ChallengeResponseAuthentication no

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

# Set this to 'yes' to enable PAM authentication, account processing, 
# and session processing. If this is enabled, PAM authentication will 
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
#UsePAM yes

AllowAgentForwarding yes
AllowTcpForwarding yes
#GatewayPorts no
#X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS yes
#PidFile /var/run/sshd.pid
#MaxStartups 10
PermitTunnel yes
#ChrootDirectory none

# no default banner path
#Banner none

# override default of no subsystems
Subsystem    sftp    /usr/lib/ssh/sftp-server

# Example of overriding settings on a per-user basis
#Match User anoncvs
#    X11Forwarding no
#    AllowTcpForwarding no
#    ForceCommand cvs server

Last edited by graysky (2010-09-27 21:36:34)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#2 2010-09-27 21:52:31

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: please review this /etc/ssh/sshd_config

I'm not an expert but here goes a thought, make sure you test that root login is really disallowed. Some UsePAM and ChallengeResponseAuthentication combinations will still allow root login even when saying "PermitRootLogin no", it shouldn't be much of a problem though because password authentication is disabled but still better double check (which you probably already did by now).


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#3 2010-09-27 22:19:11

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: please review this /etc/ssh/sshd_config

Why have you commented out MaxAuthTries? I would have thought that keeping this to a relatively small number, eg., 3, would be a good idea...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#4 2010-09-27 23:18:35

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,600
Website

Re: please review this /etc/ssh/sshd_config

@R - With password auth disabled, you don't get a chance to try if you lack one of the known keys smile  EDIT: Have a look at the "update" and "update II" sections of this article which gets at what you mentioned I think.
@j - Good point, I changed it to 3.

Last edited by graysky (2010-09-27 23:27:17)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#5 2010-09-27 23:36:36

ga01f4733
Member
From: NYC
Registered: 2008-12-05
Posts: 117

Re: please review this /etc/ssh/sshd_config

don't forget the "AllowUsers name ", just in case...  ; )


There are no foreign lands. It is the traveler only who is foreign. --R.L Stevenson

Offline

#6 2010-09-27 23:39:23

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,600
Website

Re: please review this /etc/ssh/sshd_config

Nice, thanks ga.  That's tip #8 in this article.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#7 2010-09-28 12:43:30

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: please review this /etc/ssh/sshd_config

I just mentioned that about PAM because one opensuse machine left me banging my head against the keyboard for a while trying to disable root login and I traced it back to the settings I mentioned earlier, so if it overrides the no root login directive it might also still provide password authentication (and testing it takes less that a minute anyway), but like I said, I'm not an expert.


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

Board footer

Powered by FluxBB