Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion nixos/modules/security/pam.nix
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@ let
skel = config.security.pam.makeHomeDir.skelDirectory;
inherit (config.security.pam.makeHomeDir) umask;
}; }
{ name = "lastlog"; enable = cfg.updateWtmp; control = "required"; modulePath = "${pkgs.pam}/lib/security/pam_lastlog.so"; settings = {
{ name = "lastlog"; enable = cfg.updateWtmp; control = "required"; modulePath = "${pkgs.pam_lastlog2}/lib/security/pam_lastlog2.so"; settings = {
silent = true;
}; }
{ name = "ecryptfs"; enable = config.security.pam.enableEcryptfs; control = "optional"; modulePath = "${pkgs.ecryptfs}/lib/security/pam_ecryptfs.so"; }
Expand Down Expand Up @@ -1520,6 +1520,10 @@ in

environment.etc = mapAttrs' makePAMService config.security.pam.services;

systemd.packages = optionals config.security.pam.services.login.updateWtmp [ pkgs.pam_lastlog2 ];
systemd.services.lastlog2-import.enable = config.security.pam.services.login.updateWtmp;
systemd.tmpfiles.packages = optionals config.security.pam.services.login.updateWtmp [ pkgs.pam_lastlog2 ];
Comment on lines +1523 to +1525
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this "works" since this is the only in nix use of updateWtmp (which should probably be updated to be updateLastlog, but I didn't go searching for historical reasons), I feel like it should be relying on globbing config.security.pam.services.*.updateWtmp - but I'm not sure how to make this happen.


security.pam.services =
{ other.text =
''
Expand Down
63 changes: 63 additions & 0 deletions pkgs/by-name/pa/pam_lastlog2/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{ lib
, nixosTests
, stdenv
, fetchFromGitHub
, meson
, ninja
, pkg-config
, pam
, sqlite
, libxslt
, docbook5
, docbook_xsl
, docbook_xsl_ns
, coreutils
}:

stdenv.mkDerivation rec {
pname = "pam_lastlog2";
version = "1.2.0";

src = fetchFromGitHub {
owner = "thkukuk";
repo = "lastlog2";
rev = "v${version}";
sha256 = "2qGRV5ihJAdg/pfKHSvR57iEAAw0r39FbTmS3w47kcs=";
};

nativeBuildInputs = [
meson
pkg-config
ninja
libxslt
docbook5
docbook_xsl
docbook_xsl_ns
];

buildInputs = [
pam
sqlite
];

mesonFlags = [
"--prefix=${placeholder "out"}"
"-Drootprefix=${placeholder "out"}"
"-Dpamlibdir=${placeholder "out"}/lib/security"
"-Dman=true"
];

postInstall = ''
substituteInPlace $out/lib/systemd/system/lastlog2-import.service \
--replace /usr/bin/lastlog2 $out/bin/lastlog2 \
--replace /usr/bin/mv ${coreutils}/bin/mv
'';

meta = with lib; {
description = "Y2038 safe version of lastlog";
homepage = "https://github.com/thkukuk/lastlog2";
changelog = "https://github.com/thkukuk/lastlog2/releases/tag/v${version}";
license = licenses.bsd2;
platforms = platforms.linux;
};
}