Туннель SSH с автоматическим повторным подключением и аутентификацией по паролю в контейнере Docker

Кажется, это известная systemdошибка в Arch. Ссылок на сам Debian не нашел, но возможно есть похожая ошибка. Из релевантного поста

Arch Wiki

systemd-timesyncd will contact servers in turn until one is found that responds. Arch uses the zones in the order of 0, 1, 2, 3. However, all pool.ntp.org zones only have IPv6 and IPv4 enabled on the 2 subdomain. All others are IPv4 only. Therefore, 2 should be placed first in order to properly provide support for IPv6/IPv4 hosts.

Также возможно, что DHCP дает вам неверный NTP-сервер.

The following settings are configured in the "[Time]" section:

NTP=

A space-separated list of NTP server host names or IP addresses. During runtime this list is combined with any per-interface NTP servers acquired from systemd-networkd.service(8). systemd-timesyncd will contact all configured system or per-interface servers in turn until one is found that responds. This setting defaults to an empty list.

FallbackNTP=

A space-separated list of NTP server host names or IP addresses to be used as the fallback NTP servers. Any per-interface NTP servers obtained from systemd-networkd.service(8) take precedence over this setting, as do any servers set via NTP= above. This setting is hence only used if no other NTP server information is known. If this option is not given, a compiled-in list of NTP servers is used instead.

Возможный обходной путь :отключение systemd-timesyncdи установкаchrony

2
13.06.2021, 13:04
1 ответ

Похоже, проблема в том, что сам SSH пытается переподключиться, и у sshpassвозникают проблемы с отправкой пароля для этого переподключения. Поэтому я сам создаю цикл и настроил ssh для выхода, если переадресация не удалась:

while :; do
  sshpass -v \
    -p "${PASSWORD}" \
    ssh \
      -o "ServerAliveInterval 60" \
      -o "ServerAliveCountMax 2" \
      -o "ConnectTimeout 15" \
      -o "ExitOnForwardFailure yes" \
      -o "StrictHostKeyChecking no" \
      -o "UserKnownHostsFile perfect_privacy_known_hosts" \
      -4 -N -D *:5080 ${USER}@${HOST}

    echo "SSH connection exieted, wait 15s before re-trying"
    sleep 15
done

Перезапустив DSL-модем, я имитировал переподключение:

socks5_forward_1  | Ziel: server.provider.com mit User: myUser
socks5_forward_1  | Warning: Permanently added 'server.provider.com' (ECDSA) to the list of known hosts.
socks5_forward_1  | SSHPASS searching for password prompt using match "assword"
socks5_forward_1  | SSHPASS read: myUser@server.provider.com's password:
socks5_forward_1  | SSHPASS detected prompt. Sending password.
socks5_forward_1  | SSHPASS read:
socks5_forward_1  |
socks5_forward_1  | Timeout, server server.provider.com not responding.
socks5_forward_1  | SSH connection exieted, wait 15s before re-trying
socks5_forward_1  | ssh: Could not resolve hostname server.provider.com: Temporary failure in name resolution
socks5_forward_1  | SSH connection exieted, wait 15s before re-trying
socks5_forward_1  | ssh: Could not resolve hostname server.provider.com: Temporary failure in name resolution
socks5_forward_1  | SSH connection exieted, wait 15s before re-trying
socks5_forward_1  | ssh: Could not resolve hostname server.provider.com: Temporary failure in name resolution
socks5_forward_1  | SSH connection exieted, wait 15s before re-trying
socks5_forward_1  | ssh: Could not resolve hostname server.provider.com: Temporary failure in name resolution
socks5_forward_1  | SSH connection exieted, wait 15s before re-trying
socks5_forward_1  | SSHPASS searching for password prompt using match "assword"
socks5_forward_1  | SSHPASS read: myUser@server.provider.com's password:
socks5_forward_1  | SSHPASS detected prompt. Sending password.
socks5_forward_1  | SSHPASS read:

Это работает хорошо, соединение SSH было установлено, поэтому мой прокси-сервер socks5 автоматически переподключился.

0
28.07.2021, 11:25

Теги

Похожие вопросы