Hoi Geert en anderen,

Op 25-04-2024 om 23:13 schreef Geert Stappers:
On Tue, Apr 23, 2024 at 08:12:05PM +0200, Paul van der Vlis wrote:
Op 23-04-2024 om 18:36 schreef Geert Stappers:
On Tue, Apr 23, 2024 at 11:01:01AM +0200, Paul van der Vlis wrote:
Hoi,

Ik kreeg melding dat een backup mislukt was, en ik wou kijken. Het bleek dat
ik ook niet kon inloggen via SSH.

Op een gegeven moment zag ik de melding "ssh Exceeded MaxStartups".

Dat lees ik als "ssh te vaak opnieuw opgestart, ik ben er wel klaar mee".

En ben wel benieuwd hoe die melding te zien was.

Het eerst zag ik hem via telnet, met "telnet host 22".

Maar het was ook te zien met "ssh -vvv user@host"
------
debug1: identity file /home/auto/.ssh/id_dsa type -1
debug1: identity file /home/auto/.ssh/id_dsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_9.2p1 Debian-2+deb12u2
debug1: kex_exchange_identification: banner line 0: Exceeded MaxStartups
kex_exchange_identification: read: Connection reset by peer
Connection reset by 391.918.718.63 port 22
-----

Op het moment doet hij het soms, en soms niet.

Mijn inschatting is dat er heel veel inlogpogingen zijn (van
stoute mensen), dat  sshd  daar druk mee is.

Ik zie inderdaad wel inlogpogingen in auth.log, maar niet extreem veel.
Ongeveer 1 per minuut.

Maar dit komt uit "journalctl -xn -r | less":

Apr 26 11:48:06 host dbus-daemon[307]: [system] Activating via systemd: service name='org.freedesktop.login1' unit='dbus-org.freedesktop.login1.service' requested by ':1.1' (uid=0 pid=374 comm="/usr/bin/python3 /usr/share/unattended-upgrades/un") Apr 26 11:48:05 host dbus-daemon[307]: [system] Activation via systemd failed for unit 'dbus-org.freedesktop.login1.service': Unit dbus-org.freedesktop.login1.service is masked. Apr 26 11:48:05 host dbus-daemon[307]: [system] Activating via systemd: service name='org.freedesktop.login1' unit='dbus-org.freedesktop.login1.service' requested by ':1.1' (uid=0 pid=374 comm="/usr/bin/python3 /usr/share/unattended-upgrades/un") Apr 26 11:48:04 host dbus-daemon[307]: [system] Activation via systemd failed for unit 'dbus-org.freedesktop.login1.service': Unit dbus-org.freedesktop.login1.service is masked. Apr 26 11:48:04 host dbus-daemon[307]: [system] Activating via systemd: service name='org.freedesktop.login1' unit='dbus-org.freedesktop.login1.service' requested by ':1.1' (uid=0 pid=374 comm="/usr/bin/python3 /usr/share/unattended-upgrades/un") Apr 26 11:48:02 host dbus-daemon[307]: [system] Activation via systemd failed for unit 'dbus-org.freedesktop.login1.service': Unit dbus-org.freedesktop.login1.service is masked.

Hmm, ik zie nu pas dat het om unattended-upgrades gaat... Toch is de machine wel up-to-date.

Ik denk dat `ss -t`, socket statistic  TCP, die pogingen laat zien.

Nee, dat zegt alleen:

root@host:~# ss -t
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process ESTAB 0 0 91.198.178.63:ssh 188.213.90.187:54410 ESTAB 0 0 91.198.178.63:ssh 188.213.90.187:41406
root@host:~#

Danwel dat het iets is om verder uit te zoeken.

Machine gereboot, zelfs twee keer. Op een gegeven moment
kon ik weer inloggen.

Via SSH of via een andere manier?

Via SSH. Via een seriele console inloggen ging ook niet.

In de logs zie ik dit soort meldingen:

A.u.b. een toelichting op "de logs"


Ik hoopte op een antwoord als `less /var/log/bestandsnaam`
of `journalctl -u naamvanservice`

journalctl -r -xn | less

----
Apr 21 00:00:07 fileserver dbus-daemon[318]: [system] Activating via
systemd: service name='org.freedesktop.login1'
unit='dbus-org.freedesktop.login1.service' requested by ':1.122' (uid=0
pid=197561 comm="/usr/bin/python3 /usr/share/unattended-upgrades/un")
-----

Waarom die regel er uitgelicht?

Deze zag ik vele keren, en het was eigenlijk de enige regel.

Let ook op de laatste stuk wat eindigt op "un", net alsof er iets is
weggevallen.

"systemctl unmask dbus-org.freedesktop.login1.service" geeft geen
foutmelding, maar hij blijft "masked".

systemctl status dbus-org.freedesktop.login1.service

Dan zegt hij dit:

  * dbus-org.freedesktop.login1.service
      Loaded: masked (Reason: Unit dbus-org.freedesktop.login1.service is
masked.)
      Active: inactive (dead)

Maar als ik me niet vergis, is dat eigenlijk normaal.


stappers@somehost:~
$ systemctl status dbus-org.freedesktop.login1.service | cat
● systemd-logind.service - User Login Management
      Loaded: loaded (/usr/lib/systemd/system/systemd-logind.service; static)
     Drop-In: /usr/lib/systemd/system/systemd-logind.service.d
              └─dbus.conf
      Active: active (running) since Wed 2024-04-24 07:31:10 CEST; 1 day 15h ago
        Docs: man:sd-login(3)
              man:systemd-logind.service(8)
              man:logind.conf(5)
              man:org.freedesktop.login1(5)
    Main PID: 864 (systemd-logind)
      Status: "Processing requests..."
       Tasks: 1 (limit: 4321)
    FD Store: 0 (limit: 512)
      Memory: 1.4M (peak: 3.6M swap: 1.1M swap peak: 1.1M)
         CPU: 851ms
      CGroup: /system.slice/systemd-logind.service
              └─864 /usr/lib/systemd/systemd-logind

apr 24 07:51:18 somehost systemd-logind[864]: New session c2 of user lightdm.
apr 24 20:27:31 somehost systemd-logind[864]: Removed session c2.
apr 24 21:19:57 somehost systemd-logind[864]: New session c3 of user lightdm.
apr 24 21:30:34 somehost systemd-logind[864]: Removed session c3.
apr 24 23:09:07 somehost systemd-logind[864]: New session c4 of user lightdm.
apr 25 06:30:02 somehost systemd-logind[864]: Removed session c4.
apr 25 06:55:37 somehost systemd-logind[864]: New session c5 of user lightdm.
apr 25 17:58:53 somehost systemd-logind[864]: Removed session c5.
apr 25 18:52:12 somehost systemd-logind[864]: New session c6 of user lightdm.
apr 25 23:00:24 somehost systemd-logind[864]: Removed session c6.
stappers@somehost:~
$ ssh otherhost systemctl status dbus-org.freedesktop.login1.service
● systemd-logind.service - User Login Management
      Loaded: loaded (/usr/lib/systemd/system/systemd-logind.service; static)
     Drop-In: /usr/lib/systemd/system/systemd-logind.service.d
              └─dbus.conf
      Active: active (running) since Sun 2024-03-17 18:08:51 CET; 1 month 8 
days ago
        Docs: man:sd-login(3)
              man:systemd-logind.service(8)
              man:logind.conf(5)
              man:org.freedesktop.login1(5)
    Main PID: 523 (systemd-logind)
      Status: "Processing requests..."
       Tasks: 1 (limit: 9163)
    FD Store: 0 (limit: 512)
      Memory: 1.9M (peak: 4.0M)
         CPU: 13.069s
      CGroup: /system.slice/systemd-logind.service
              └─523 /usr/lib/systemd/systemd-logind

apr 21 11:29:27 otherhost systemd-logind[523]: New session 1618 of user 
stappers.
apr 21 12:01:07 otherhost systemd-logind[523]: Session 1618 logged out. Waiting 
for processes to exit.
apr 21 12:01:07 otherhost systemd-logind[523]: Removed session 1618.
apr 21 17:13:16 otherhost systemd-logind[523]: New session 1631 of user 
stappers.
apr 22 21:06:29 otherhost systemd-logind[523]: Session 1631 logged out. Waiting 
for processes to exit.
apr 22 21:06:29 otherhost systemd-logind[523]: Removed session 1631.
apr 23 21:26:00 otherhost systemd-logind[523]: New session 1734 of user 
stappers.
apr 23 21:26:01 otherhost systemd-logind[523]: Session 1734 logged out. Waiting 
for processes to exit.
apr 23 21:26:01 otherhost systemd-logind[523]: Removed session 1734.
apr 25 23:08:25 otherhost systemd-logind[523]: New session 1831 of user 
stappers.
stappers@somehost:~
$

root@host:~# systemctl status dbus-org.freedesktop.login1.service | cat
* dbus-org.freedesktop.login1.service
Loaded: masked (Reason: Unit dbus-org.freedesktop.login1.service is masked.)
     Active: inactive (dead)

En dat is op wel meer machines zo.

Groet,
Paul

--
Paul van der Vlis Linux systeembeheer Groningen
https://vandervlis.nl/

Antwoord per e-mail aan