Translate

пʼятниця, 4 жовтня 2013 р.

Настройка ssh на хосте.

Клиент:

Конфигурация клиента находится в /etc/ssh/ssh_config. Рекомендуется изменить строку 'Protocol' на 'Protocol 2' в связи с вопросами безопасности:
Protocol 2

 

Сервер:

Конфигурация SSH демона находится в /etc/ssh/sshd_config.
Выключаем SSH соединения для ipv6 (если это не нужно):
#AddressFamily any # default
AddressFamily inet # IPv4 only
#AddressFamily inet6 # IPv6 only
Разрешаем коннектиться только определенным пользователям:
AllowUsers userA userB
AllowGroups sshusers
Отключаем root login:
PermitRootLogin no
Выставляем log out timeout interval (в секундах):
# Sets a timeout interval in seconds after which if no data has
# been received from the client, sshd will send a message through
# the encrypted channel to request a response from the client.  The
# default is 0, indicating that these messages will not be sent to
# the client.
ClientAliveInterval 300

# Sets the   number of client alive messages (see above) which may be sent
# without sshd receiving any messages back from the client.  If this
# threshold is reached while client alive messages are being sent, sshd
# will disconnect the client, terminating the session.
ClientAliveCountMax 0

 

Защита сервера:

Чтобы разрешить соединения. Надо отредактировать /etc/hosts.allow:
# let everyone connect to you
sshd: ALL
# OR you can restrict it to a certain ip
sshd: 192.168.0.1
# OR restrict for an IP range
sshd: 10.0.0.0/255.255.255.0
# OR restrict for an IP match
sshd: 192.168.1.
Для всех остальных – запрещаем: /etc/hosts.deny:
ALL: ALL: DENY


Перезагрузка sshd:
/etc/init.d/ssh restart

Если планируется запуск тонких клиентов, то ничего вносить не нужно в /etc/hosts.allow и etc/hosts.deny.

Немає коментарів:

Дописати коментар