openssh: add withAudit (default false) (#467604)

This commit is contained in:
@mjones
2025-12-23 21:52:37 +00:00
committed by GitHub
+26 -12
View File
@@ -18,7 +18,9 @@
fetchurl,
fetchpatch,
autoreconfHook,
withAudit ? false,
audit,
libcap_ng,
zlib,
openssl,
softhsm,
@@ -46,6 +48,9 @@
isNixos ? stdenv.hostPlatform.isLinux,
}:
# libaudit support requires Linux
assert withAudit -> stdenv.hostPlatform.isLinux;
# FIDO support requires SK support
assert withFIDO -> withSecurityKey;
@@ -99,7 +104,10 @@ stdenv.mkDerivation (finalAttrs: {
++ lib.optional withKerberos krb5
++ lib.optional withLdns ldns
++ lib.optional withPAM pam
++ lib.optional stdenv.hostPlatform.isStatic audit;
++ lib.optionals withAudit [
audit
libcap_ng
];
preConfigure = ''
# Setting LD causes `configure' and `make' to disagree about which linker
@@ -107,11 +115,22 @@ stdenv.mkDerivation (finalAttrs: {
unset LD
'';
env = lib.optionalAttrs isNixos {
# openssh calls passwd to allow the user to reset an expired password, but nixos
# doesn't ship it at /usr/bin/passwd.
PATH_PASSWD_PROG = "/run/wrappers/bin/passwd";
};
env =
lib.optionalAttrs isNixos {
# openssh calls passwd to allow the user to reset an expired password, but nixos
# doesn't ship it at /usr/bin/passwd.
PATH_PASSWD_PROG = "/run/wrappers/bin/passwd";
}
// lib.optionalAttrs stdenv.hostPlatform.isStatic {
NIX_LDFLAGS = lib.concatStringsSep " " (
lib.optional withKerberos "-lkeyutils"
++ lib.optional withLdns "-lcrypto"
++ lib.optionals withAudit [
"-laudit"
"-lcap-ng"
]
);
};
# I set --disable-strip because later we strip anyway. And it fails to strip
# properly when cross building.
@@ -136,14 +155,9 @@ stdenv.mkDerivation (finalAttrs: {
++ lib.optional withLdns "--with-ldns"
++ lib.optional stdenv.hostPlatform.isOpenBSD "--with-bsd-auth"
++ lib.optional withLinuxMemlock "--with-linux-memlock-onfault"
++ lib.optional withAudit "--with-audit=linux"
++ extraConfigureFlags;
${if stdenv.hostPlatform.isStatic then "NIX_LDFLAGS" else null} = [
"-laudit"
]
++ lib.optional withKerberos "-lkeyutils"
++ lib.optional withLdns "-lcrypto";
buildFlags = [ "SSH_KEYSIGN=ssh-keysign" ];
enableParallelBuilding = true;