Я заметил несколько повторов следующего сообщения об ошибке в /var/log/auth.log
на сервере:
Aug 10 09:10:16 hostname sshd[661]: error: connect_to 1.1.1.1 port
25: failed.
Я изменил фактический IP-адрес, это внешние адреса, которые часто принадлежат почтовым серверам.
Я не понимаю, кто именно пытается подключиться к этим адресам и какое отношение к этому имеет sshd. Sshd работает на порту 22, на порту 25 на этом сервере ничего не работает.
Что именно означает эта строка, кто инициирует соединение и почему задействован sshd?
Вы можете воспроизвести это, настроив динамическую переадресацию портов SSH:
man ssh
:
-D [bind_address:]port
Specifies a local “dynamic” application-level port forwarding. This works by allocating a socket
to listen to port on the local side, optionally bound to the specified bind_address. Whenever a
connection is made to this port, the connection is forwarded over the secure channel, and the
application protocol is then used to determine where to connect to from the remote machine. Cur‐
rently the SOCKS4 and SOCKS5 protocols are supported, and ssh will act as a SOCKS server. Only
root can forward privileged ports. Dynamic port forwardings can also be specified in the configu‐
ration file.
IPv6 addresses can be specified by enclosing the address in square brackets. Only the superuser
can forward privileged ports. By default, the local port is bound in accordance with the
GatewayPorts setting. However, an explicit bind_address may be used to bind the connection to a
specific address. The bind_address of “localhost” indicates that the listening port be bound for
local use only, while an empty address or ‘*’ indicates that the port should be available from all
interfaces.
Запустите прокси SOCKS на локальном хосте, порт 2302:
$ ssh -v -ND 2302 user@host
Чтобы направить HTTP-трафик через этот туннель, в Firefox:
Правка -> Настройки -> Дополнительно -> вкладка Сеть -> Настройки -> Настройка прокси вручную -> Хост SOCKS: localhost и порт: 2302
Чтобы использовать прокси SOCKS с другим трафиком, вы можете использовать программу socksifier, например tsocks
:
[I] net-proxy/tsocks
Available versions: 1.8_beta5-r3 ~1.8_beta5-r4 1.8_beta5-r5 ~1.8_beta5-r6 {tordns}
Installed versions: 1.8_beta5-r5(10:08:28 AM 06/15/2010)(-tordns)
Homepage: http://tsocks.sourceforge.net/
Description: Transparent SOCKS v4 proxying library
На моем Gentoo отредактируйте /etc/socks/tsocks.conf
как показано ниже:
# Otherwise we use the server
server = 127.0.0.1
server_port = 2302
Тестирование:
$ tsocks telnet 255.255.255.255 25
Вы увидите что-то подобное в /var/log/secure
на SSH сервере:
sshd[28491]: error: connect_to 255.255.255.255 port 25: failed.
Я не понимаю, кто именно пытается подключиться к этим адресам.
Чтобы сузить круг вопросов, взгляните на /var/log/secure
(auth.log
в вашем дистрибутиве) и проверьте, кто входил в систему до этого:
sshd[26898]: pam_unix(sshd:session): session opened for user quanta
Установка оболочки пользователя на / bin / false не предотвращает переадресацию портов ssh.
http://random.cconn.info/2012/05/06/binfalse-sbinnologin-and-ssh/ http://www.semicomplete.com/articles/ssh-security/
Итак, я предполагаю, что OP имел логин пользователя со слабым или тривиальным паролем, «отключил» учетную запись, установив для оболочки значение / bin / false или / bin / nologin, и он использовался для рассылки спама путем перенаправления порта ssh.
Возможно, кто-то, кто входит на ваш сервер, пытается установить ssh-туннель на 1.1.1.1:25?