Forums: An Excellent Sshd Config File - Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

An Excellent Sshd Config File Perfectly Secure

#1 User is offline   icenix 

  • Private First Class
  • Icon
  • Group: Members
  • Posts: 91
  • Joined: 05-January 04

Posted 19 January 2004 - 05:43 AM

This is just a simple configuration file for sshd (the ssh server/daemon from the openssh suite of tools, as available from http://www.openssh.org ). The how-to is for a recent version of openssh (3.4 or later).

1. The configuration file sshd_config usually is located in /etc/ssh/ and only the root can modify it. If you have installed from source, this configuration file may be located in a different directory.

2. Make a backup of the current sshd_config file first. Login as root and open a new file and add the following lines

# rhosts authentication should not be used
#RhostsAuthentication no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes
# 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

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

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

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

#AFSTokenPassing no

# Kerberos TGT Passing only works with the AFS kaserver
#KerberosTgtPassing no

# Set this to 'yes' to enable PAM keyboard-interactive authentication
# Warning: enabling this may bypass the setting of 'PasswordAuthentication'
#PAMAuthenticationViaKbdInt yes

#Allow X display forwarding
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PrintMotd yes
#PrintLastLog yes
#KeepAlive yes
#UseLogin no
UsePrivilegeSeparation yes
#Compression yes

#MaxStartups 10
# no default banner path
#Banner /some/path
#VerifyReverseMapping no

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

#Do not allow root login
PermitRootLogin no


Save this file over your current sshd_config file in the /etc/ssh directory.

Note
This configuration

* does not allow remote root login for security reasons.
* allows X display forwarding (remote X display). To disable the feature, comment out the line X11Forwarding yes or change it to X11Forwarding no.
* allows incoming sftp (secure FTP) connections.

0

#2 User is offline   Grinler 

  • Private First Class
  • Icon
  • Group: Members
  • Posts: 62
  • Joined: 12-August 03

Posted 20 January 2004 - 10:41 AM

Excellent. May I suggest you also add the line:

#Only v2 SSH Protocol
Protocol 2

This will force your clients to only be able to use SSH2, which should not be a problem with most clients these days.
0

#3 User is offline   raif 

  • Staff Sergeant
  • Icon
  • Group: Specialist
  • Posts: 275
  • Joined: 14-January 04

Posted 21 January 2004 - 02:29 PM

Grinler, on Jan 20 2004, 01:41 PM, said:

Excellent.  May I suggest you also add the line:

#Only v2 SSH Protocol
Protocol 2

This will force your clients to only be able to use SSH2, which should not be a problem with most clients these days.

agreed, what with the earlier protocols being crackable and all. good post though :)
0

#4 User is offline   bitwild 

  • Private First Class
  • Icon
  • Group: Members
  • Posts: 55
  • Joined: 30-November 03

Posted 19 February 2004 - 04:38 AM

maybe tune: KeyRegenerationInterval, ServerKeyBits
0

#5 User is offline   tyler.durden 

  • Private First Class
  • Icon
  • Group: Members
  • Posts: 33
  • Joined: 09-February 04

Posted 20 February 2004 - 08:58 AM

thanks... this is usefull.

I use the sshd by cygwin, and I'll merge this conf with it (cause I dont know if they are 100% compatibles).

I would like to ask you if can be possible to log ssh on /var/log/ssh.log, and not in windows registry. I looked on google and only found that impossible, only eventi viewer is possible... but I dont want to believe it! :)

thank you ;)
0

#6 User is offline   Grinler 

  • Private First Class
  • Icon
  • Group: Members
  • Posts: 62
  • Joined: 12-August 03

Posted 20 February 2004 - 10:16 AM

I am not that familiar with cygwin. Is that how cygwin's syslog logs its entries; to only event viewer?
0

#7 User is offline   tyler.durden 

  • Private First Class
  • Icon
  • Group: Members
  • Posts: 33
  • Joined: 09-February 04

Posted 21 February 2004 - 03:40 PM

Grinler, on Feb 20 2004, 06:16 PM, said:

I am not that familiar with cygwin. Is that how cygwin's syslog logs its entries; to only event viewer?

yes... I can found log only into event viewer... :(

this is not good for me, cause I use it for connect to my pc from office. My next step is to install a real Linux distro, ehehhe :D
0

#8 User is offline   radien 

  • Private First Class
  • Icon
  • Group: Members
  • Posts: 73
  • Joined: 27-June 03

Posted 25 June 2004 - 10:53 PM

and I suggest these lines to get added:

#Default is yes
#StrictModes yes
#I like this one
PrintLastLog yes
#
DenyGroups root
#It's good, trust me
LoginGraceTime 120 # 2 minutes
#Any unusual port
Port 3189
0

#9 User is offline   forza 

  • Private First Class
  • Icon
  • Group: Members
  • Posts: 88
  • Joined: 12-February 04

Posted 02 July 2004 - 02:23 PM

perhaps use private and public key

HostKey /etc/ssh/ssh_host_key
0

#10 User is offline   twistedps 

  • Staff Sergeant
  • Icon
  • Group: Members
  • Posts: 271
  • Joined: 20-March 04

Posted 07 July 2004 - 04:52 PM

and dont run it on 22!
0

#11 Guest_6066up9r_*

  • Group: Guests

Posted 12 July 2004 - 07:20 PM

not running on 22 will save you a lot trouble as long as you aren't in a production environment where port 22 ssh is expected ;)
0

#12 User is offline   as0l0 

  • Sergeant
  • Icon
  • Group: Members
  • Posts: 248
  • Joined: 14-September 03

Posted 12 July 2004 - 08:37 PM

good post, thanks for sharing.
0

#13 Guest_SyN/AcK_*

  • Group: Guests

Posted 09 August 2004 - 08:31 AM

Your title with the words "Perfectly Secure" makes me shudder. I hesitate to say that anything is perfectly secure unless its unplugged from the wall. Good config file though.
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

3 User(s) are reading this topic
0 members, 3 guests, 0 anonymous users

  • Share



Our Sponsors:


SwiftLayer Affiliate Web Hosting