LoginSessionsMixin.get_login_sessions(): the interactive logins a Linux host recorded over the last seven days, for NetOrk/netork#2881 (C1: shells that did not go through the application).
Reads wtmpdb last and last (wtmp) with --time-format iso -w, -i where the tool takes it (the address, not a name), bounded with --since on the host; without --since the window is applied in the parse. A session in both records is one.
Only terminal logins count (is_interactive): pts/N, ttyN, serial and hypervisor consoles; not reboot/shutdown entries, X displays, ssh:notty, FTP lines or windows of screen.
own_address: the driver's own SSH client address from SSH_CONNECTION (an IPv4-mapped address as IPv4). Its sessions are left out on the host already (awk), since a client that opens a terminal adds one per connection; the newest 1000 others are read.
Template form as LoginAccountsMixin: the command and parse are here, a driver supplies _run_login_sessions_command(command), run as the login user (sudo would reset SSH_CONNECTION; wtmp is world-readable). A host without a readable record (BusyBox last) raises LoginSessionsUnavailable.
Tests: fixtures for Debian 12 (util-linux), Debian 13 (wtmpdb, offsets without a colon), AlmaLinux 9 without -i/--since, crash/down durations, gone - no logout, dedup across records, and a run of the real command on the CI host.
Two commits: the feature, and chore(release): 4.55.0.
`LoginSessionsMixin.get_login_sessions()`: the interactive logins a Linux host recorded over the last seven days, for NetOrk/netork#2881 (C1: shells that did not go through the application).
- Reads `wtmpdb last` and `last` (wtmp) with `--time-format iso -w`, `-i` where the tool takes it (the address, not a name), bounded with `--since` on the host; without `--since` the window is applied in the parse. A session in both records is one.
- Only terminal logins count (`is_interactive`): `pts/N`, `ttyN`, serial and hypervisor consoles; not reboot/shutdown entries, X displays, `ssh:notty`, FTP lines or windows of `screen`.
- `own_address`: the driver's own SSH client address from `SSH_CONNECTION` (an IPv4-mapped address as IPv4). Its sessions are left out on the host already (awk), since a client that opens a terminal adds one per connection; the newest 1000 others are read.
- Template form as `LoginAccountsMixin`: the command and parse are here, a driver supplies `_run_login_sessions_command(command)`, run as the login user (sudo would reset `SSH_CONNECTION`; wtmp is world-readable). A host without a readable record (BusyBox `last`) raises `LoginSessionsUnavailable`.
Tests: fixtures for Debian 12 (util-linux), Debian 13 (wtmpdb, offsets without a colon), AlmaLinux 9 without `-i`/`--since`, crash/down durations, `gone - no logout`, dedup across records, and a run of the real command on the CI host.
Two commits: the feature, and `chore(release): 4.55.0`.
LoginSessionsMixin reads wtmpdb's and wtmp's records of the last seven
days with ISO times, bounded on the host, keeps terminal logins only and
names the driver's own SSH client address (SSH_CONNECTION), whose sessions
it leaves out. A driver supplies _run_login_sessions_command; a host
without a readable record raises LoginSessionsUnavailable.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
LoginSessionsMixin.get_login_sessions(): the interactive logins a Linux host recorded over the last seven days, for NetOrk/netork#2881 (C1: shells that did not go through the application).wtmpdb lastandlast(wtmp) with--time-format iso -w,-iwhere the tool takes it (the address, not a name), bounded with--sinceon the host; without--sincethe window is applied in the parse. A session in both records is one.is_interactive):pts/N,ttyN, serial and hypervisor consoles; not reboot/shutdown entries, X displays,ssh:notty, FTP lines or windows ofscreen.own_address: the driver's own SSH client address fromSSH_CONNECTION(an IPv4-mapped address as IPv4). Its sessions are left out on the host already (awk), since a client that opens a terminal adds one per connection; the newest 1000 others are read.LoginAccountsMixin: the command and parse are here, a driver supplies_run_login_sessions_command(command), run as the login user (sudo would resetSSH_CONNECTION; wtmp is world-readable). A host without a readable record (BusyBoxlast) raisesLoginSessionsUnavailable.Tests: fixtures for Debian 12 (util-linux), Debian 13 (wtmpdb, offsets without a colon), AlmaLinux 9 without
-i/--since, crash/down durations,gone - no logout, dedup across records, and a run of the real command on the CI host.Two commits: the feature, and
chore(release): 4.55.0.