본문 바로가기
유용한_팁

서버 관리를 위한 ssh 서버 보안세팅

by 씨디맨 2007. 10. 23.
320x100
서버 관리를 위한 ssh 서버 보안세팅

/etc/ssh/sshd_config 파일

# $OpenBSD: sshd_config,v 1.48 2002/02/19 02:50:59 deraadt Exp $
# This is the sshd server system-wide configuration file. See sshd(8)
# for more information.

# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options change a
# default value.

Port 22
- ssh가 사용할 기본 포트 지정
Allowusers kkamji2411 root (로그인 허락할 계정 써준다.)

Protocol 2
- openssh는 프로토콜 버전을 원하는 대로 선택할 수 있다. protocol 2로 설정에는
서버는 버전 2로만 작동하기 때문에 ssh1을 사용해 접속을 요청하는 클라이언트를
받아 들일 수 없다.
- protocol 1로 설정해서 가동시킬 경우에는 버전 2로를 사용하는 ssh2 사용자의 요청을
받아 들일 수 없다. 보안상 protocol 1 은 사용하지 않는다.


ListenAddress 0.0.0.0
- sshd 데몬이 귀를 기울일 주소이다. 0.0.0.0은 모든 곳을 말한다.

#ListenAddress ::

#HostKey for protocol version 1
HostKey /etc/ssh/ssh_host_key
- protocol 1.3과 1.5에 의해 사용되어지는 private RSA 호스트 키 값이 저정되어
있는 파일이다. 현재는 /etc/ssh/ssh_host_key에 저장되어 있다. pulick key는
/etc/ssh/ssh_host_key.pub이다.


#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 3600
- 서버의 키는 한번 접속이 이루어진 뒤에 자동적으로 다시 만들어진다. 다시
만드는 목적은 나중에 호스트의 세션에 있는 키를 캡처해서 암호를 해독하거나
훔친 키를 사용하지 못하도록 하기 위함 위함이다. 값이 0이면 키는 다시
만들어지지 않는다. 기본값은 3600초이다.


ServerKeyBits 1024
- 서버 키의 비트수를 정의한다. 최소값은 512이고 디폴트 값은 768이다.

#Logging
#obsoletes QuietMode and FascistLogging
#SyslogFacility AUTH
- /etc/syslog.conf에서 정의한 로그 facility 코드이다. 가능한 값은 DAEMON, USER,
AUTH, LOCAL0, LOCAL1, LOCAL2, LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7이다.
기본값은 AUTH이다.


SyslogFacility AUTH
LogLevel INFO

- 로그 레벌을 지정하는 것이다. 가능한 값은 QUIET, FATAL, ERROR, INFO, VERBOSE
그리고 DEBUGS이다.


#Authentication:

LoginGraceTime 600
- 유저가 로그인을 성공적으로 이루어지 않았을 때 이 시간 후에 서버가 연결을
끊는 시간이다. 값이 0이면 제한 시간이 없다. 기본값은 600초이다.


PermitRootLogin yes ==> 보안상 no로 해준다.
- root 로그인 허용여부를 결정하는 것이다. yes, no, without-password를 사용할
수 있다. 현재 yes로 되어 있기 때문에 직접 root로 접속이 가능하다. 이것을
허용하지 않으려면 no나 without-password로 바꾼다.


#StrictModes yes

RSAAuthentication yes
PubkeyAuthentication yes

#AuthorizedKeysFile .ssh/authorized_keys

#rhosts authentication should not be used
#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
- rhost나 /etc/hosts.equiv파일이 있으면 이것을 사용해 인증한다. 이것은 보안상
별로 안좋은 방법이기 때문에 허용하지 않는다.


#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
- 패스워드 인증을 허용한다. 이 옵션은 프로토콜 버전 1과 2 모두 적용된다.

PermitEmptyPasswords no
- 패스워드 인증을 할 때 서버가 비어있는 패스워드를 인정하는 것이다. 기본 값은 no이다.

#Change to no to disable s/key passwords
# http://www.korea.iss.net/alertcon5.htm 참고
ChallengeResponseAuthentication no

#Kerberos options
#KerberosAuthentication automatically enabled if keyfile exists
#KerberosAuthentication yes
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes

#AFSTokenPassing automatically enabled if k_hasafs() is true
#AFSTokenPassing yes

#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

X11Forwarding no
- 원격에서 X11 포워딩을 허용하는 것이다. 이 옵션을 yes로 설정하면 xhost보다
안전한 방법으로 원격에 있는 X프로그램을 사용할 수 있다. yes로 설정 후 데몬
재가동을 하고 테스트해 보자.


#X11DisplayOffset 10
#X11UseLocalhost yes
#PrintMotd yes
#PrintLastLog yes
#KeepAlive yes
#UseLogin no
#MaxStartups 10
#no default banner path
#Banner /some/path
#VerifyReverseMapping no

#override default of no subsystems
Subsystem sftp /usr/libexec/openssh/sftp-server
- sftp는 프로토콜 버전 2에서 사용되는 것으로서 ssh와 같이 ftp의 보안을
강화하기 위해 사용되는 보안 ftp프로그램이다.
openssh를 설치하면 /usr/local/ssh/libexec/sftp-server파일이 설치된다.
이것은 sftp 서버용 프로그램이다. 클라이언트 sftp프로그램은 설치되지않는다.
따라서 서버로 일단 가동시키고 원도용 ssh클라이언트 프로그램이나
SSH2를 설치하면 sftp를 사용할 수 있다
반응형

'유용한_팁' 카테고리의 다른 글

USB 에 대한 여러가지 정보  (0) 2007.10.31
DCE/DTE CABLE  (0) 2007.10.24
BC Wipe 디스크를 완벽하게 지우기  (0) 2007.10.23
Vista 특정프로그램 에어로 기능 끄기  (0) 2007.10.23
Windows 2000 + SP4 통합팩 만들기  (3) 2007.10.23

댓글