Eu preciso de uma segunda fonte de servidor openssh modificada e em execução no debian.
As modificações que eu fiz no código fonte não são realmente relevantes, de qualquer forma elas amplificam os logs.
Eu compilei o openssh-7.4p1
modificado com
./configure --prefix=/opt --enable-pam --with-pam
make ; make install
Em seguida, criei /lib/systemd/system/ssh-mod.service
:
[Unit]
Description=OpenBSD Secure Shell server modified to log
After=network.target auditd.service sshd.service
#ConditionPathExists=!/opt/etc/sshd-mod_not_to_be_run
ConditionPathExists=!/etc/ssh/sshd_not_to_be_run
[Service]
EnvironmentFile=-/opt/etc/default/ssh
ExecStart=/opt/sbin/sshd -D -f /opt/etc/sshd_config $SSHD_OPTS
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
RestartPreventExitStatus=255
Type=notify
[Install]
WantedBy=multi-user.target
Alias=sshd-mod.service
E /opt/etc/sshd_config
é um arquivo de configuração ssh padrão com as seguintes linhas:
Port 22
LogLevel INFO
ChallengeResponseAuthentication no
UsePAM yes
PrintMotd no
PidFile /var/run/sshd-mod.pid
Agora lancei o serviço com:
$ sudo systemctl start ssh-mod
o comando faz um loop indefinetly, então eu espero até a mensagem de erro:
Job for ssh-mod.service failed because a timeout was exceeded.
See "systemctl status ssh-mod.service" and "journalctl -xe" for details.
então eu verifico o status:
$ sudo systemctl status ssh-mod
● ssh-mod.service - OpenBSD Secure Shell server modified to log
Loaded: loaded (/lib/systemd/system/ssh-mod.service; enabled; vendor preset: enabled)
Active: activating (start) since Mon 2017-09-04 10:19:50 UTC; 12s ago
Main PID: 15701 (sshd)
Tasks: 1 (limit: 4915)
CGroup: /system.slice/ssh-mod.service
└─15701 /opt/sbin/sshd -D -f /opt/etc/sshd_config
Sep 04 10:19:50 mymachine systemd[1]: ssh-mod.service: Service hold-off time over, scheduling restart
Sep 04 10:19:50 mymachine systemd[1]: Stopped OpenBSD Secure Shell server modified to log.
Sep 04 10:19:50 mymachine systemd[1]: Starting OpenBSD Secure Shell server modified to log...
Sep 04 10:19:50 mymachine sshd[15701]: Server listening on 0.0.0.0 port 22.
Sep 04 10:19:50 mymachine sshd[15701]: Server listening on :: port 22.
$ journalctl -xe
Sep 04 10:19:50 mymachine systemd[1]: ssh-mod.service: Start operation timed out. Terminating.
Sep 04 10:19:50 mymachine sshd[15549]: Received signal 15; terminating.
Sep 04 10:19:50 mymachine systemd[1]: Failed to start OpenBSD Secure Shell server modified to log.
-- Subject: Unit ssh-mod.service has failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- Unit ssh-mod.service has failed.
--
-- The result is failed.
Sep 04 10:19:50 mymachine systemd[1]: ssh-mod.service: Unit entered failed state.
Sep 04 10:19:50 mymachine systemd[1]: ssh-mod.service: Failed with result 'timeout'.
Sep 04 10:19:50 mymachine systemd[1]: ssh-mod.service: Service hold-off time over, scheduling restart
Sep 04 10:19:50 mymachine systemd[1]: Stopped OpenBSD Secure Shell server modified to log.
-- Subject: Unit ssh-mod.service has finished shutting down
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- Unit ssh-mod.service has finished shutting down.
Sep 04 10:19:50 mymachine systemd[1]: Starting OpenBSD Secure Shell server modified to log...
-- Subject: Unit ssh-mod.service has begun start-up
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- Unit ssh-mod.service has begun starting up.
Sep 04 10:19:50 mymachine sshd[15701]: Server listening on 0.0.0.0 port 22.
Sep 04 10:19:50 mymachine sshd[15701]: Server listening on :: port 22.
Na verdade, o serviço resulta como 'ativando', mas posso fazer o login na porta 22 (o outro servidor está escutando outra porta), então o shell parece funcionar.
Eu não tenho idéia do que está causando isso, os logs não são tão explícitos.
O que estou perdendo? Por que o serviço está suspenso?
Por favor, diga-me se você precisar de mais informações.
Eu segui as etapas da documentação do RedHat .