nixos: zsh for every account, security summary on login, XMPP over IPv6
All checks were successful
nixos / nixos (push) Successful in 1m3s
All checks were successful
nixos / nixos (push) Successful in 1m3s
Every account now logs in with zsh, including ones added later, except deploy and git: the app CI and Forgejo run commands through their login shells. root gets the same zsh with a red prompt ending in #. Interactive SSH logins show, under fastfetch, the host's security state as the Grafana alerts see it, read from the local metrics files: anything unexpected (peers, devices, accounts, ports, containers), who is logged in, the last good backup per repository, the bucket replica, failed units and fail2ban bans. XMPP gets a Podman network of its own with IPv6. xmpp.asxp.io has an AAAA record, and Podman's default network forwards published ports over IPv4 only, where Docker on Debian did both: since the conversion, XMPP over IPv6 was refused. Tried on the rehearsal host with a published port on the new network, reached over IPv6 and IPv4. Assisted-by: Claude:opus-5-5
This commit is contained in:
parent
8c7e725463
commit
72a14a1b1b
1 changed files with 129 additions and 12 deletions
|
|
@ -1,10 +1,34 @@
|
|||
# Interactive shell for the admins: zsh as on the admin's workstation
|
||||
# (asxpi/nixOS, modules/shell.nix), minus what only makes sense there.
|
||||
# Interactive shell: zsh as on the admin's workstation (asxpi/nixOS,
|
||||
# modules/shell.nix), minus what only makes sense there.
|
||||
#
|
||||
# deploy keeps bash: the app CI runs its SSH scripts through deploy's
|
||||
# login shell, and they are bash. root keeps bash too, for scripts and
|
||||
# `ssh root@host '<command>'`.
|
||||
{ lib, pkgs, ... }:
|
||||
# Every account logs in with zsh, including ones added later, except
|
||||
# those that run other programs' commands through their login shell:
|
||||
# deploy (the app CI's SSH scripts are bash) and git (Forgejo).
|
||||
# root gets the same zsh with a red prompt ending in #.
|
||||
#
|
||||
# Interactive SSH logins show fastfetch and a short security summary;
|
||||
# scp, CI and `ssh host <command>` stay quiet.
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
summary = pkgs.writeShellApplication {
|
||||
name = "login-summary";
|
||||
# Read-only reporting: an empty grep or a missing file must not end it
|
||||
bashOptions = [ "nounset" ];
|
||||
runtimeInputs = with pkgs; [
|
||||
coreutils
|
||||
gawk
|
||||
gnugrep
|
||||
gnused
|
||||
config.systemd.package
|
||||
];
|
||||
text = builtins.readFile ./login-summary.sh;
|
||||
};
|
||||
in
|
||||
{
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
|
|
@ -20,9 +44,14 @@
|
|||
grep = "grep --color=auto";
|
||||
};
|
||||
|
||||
# Blue: [HH:MM:SS] [user@host path] $
|
||||
# Blue for everyone: [HH:MM:SS] [user@host path] $
|
||||
# Red for root: [HH:MM:SS] [root@host path] #
|
||||
promptInit = ''
|
||||
PROMPT='%B%F{#0055ff}[%b%f%D{%H:%M:%S}%B%F{#0055ff}]%b%f %B%F{#0055ff}[%b%f%n@%m %B%F{#0055ff}%~]%b%f %B%F{#0055ff}$%b%f '
|
||||
if [[ $EUID -eq 0 ]]; then
|
||||
PROMPT='%B%F{#ff2020}[%b%f%D{%H:%M:%S}%B%F{#ff2020}]%b%f %B%F{#ff2020}[%b%F{#ff2020}%n%f@%m %B%F{#ff2020}%~]%b%f %B%F{#ff2020}#%b%f '
|
||||
else
|
||||
PROMPT='%B%F{#0055ff}[%b%f%D{%H:%M:%S}%B%F{#0055ff}]%b%f %B%F{#0055ff}[%b%f%n@%m %B%F{#0055ff}%~]%b%f %B%F{#0055ff}$%b%f '
|
||||
fi
|
||||
'';
|
||||
|
||||
# Fresh homes have no ~/.zshrc: never offer the new-user wizard
|
||||
|
|
@ -52,19 +81,21 @@
|
|||
'';
|
||||
};
|
||||
|
||||
users.users.asxpi.shell = pkgs.zsh;
|
||||
users.defaultUserShell = pkgs.zsh;
|
||||
users.users.root.shell = pkgs.zsh;
|
||||
users.users.deploy.shell = pkgs.bashInteractive;
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
fastfetch
|
||||
bat
|
||||
eza
|
||||
summary
|
||||
];
|
||||
|
||||
# System summary on interactive SSH logins only: scp, CI and
|
||||
# `ssh host <command>` stay quiet
|
||||
environment.loginShellInit = ''
|
||||
if [ -n "''${SSH_TTY:-}" ] && [ -t 1 ]; then
|
||||
${lib.getExe pkgs.fastfetch} 2>/dev/null
|
||||
${lib.getExe summary} 2>/dev/null
|
||||
fi
|
||||
'';
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue