From 9cfc51d86cb779ddde624c62603b8336afeb99bf Mon Sep 17 00:00:00 2001 From: Rudolf Tucek Date: Mon, 23 Nov 2026 03:37:15 +0100 Subject: [PATCH 1/5] gpg: extract settings to dedicated nix expression Keeping default.nix clean. --- home/gpg/default.nix | 88 ++----------------------------------------- home/gpg/settings.nix | 87 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+), 85 deletions(-) create mode 100644 home/gpg/settings.nix diff --git a/home/gpg/default.nix b/home/gpg/default.nix index 7f84038..88f0a9c 100644 --- a/home/gpg/default.nix +++ b/home/gpg/default.nix @@ -1,87 +1,5 @@ -{ pkgs, ... }: { - programs.gpg = { - enable = true; - - # Have GPG database being managed by the user. - mutableKeys = true; - mutableTrust = true; - - settings = { - charset = "utf-8"; - default-key = "0x49593BD010DE4723"; - no-emit-version = true; - no-comments = true; - keyid-format = "0xlong"; - with-fingerprint = true; - list-options = "show-uid-validity"; - verify-options = "show-uid-validity"; - use-agent = true; - keyserver = "keys.openpgp.org"; - keyserver-options = [ - "no-honor-keyserver-url" - "include-revoked" - ]; - personal-cipher-preferences = [ - "AES256" - "AES192" - "AES" - "CAST5" - ]; - personal-digest-preferences = [ - "SHA512" - "SHA384" - "SHA256" - "SHA224" - ]; - cert-digest-algo = "SHA512"; - s2k-digest-algo = "SHA512"; - default-preference-list = [ - "SHA512" - "SHA384" - "SHA256" - "SHA224" - "AES256" - "AES192" - "AES" - "CAST5" - "ZLIB" - "BZIP2" - "ZIP" - "Uncompressed" - ]; - }; - - scdaemonSettings = { - # Tweak GPG's own smart card daemon in order to play nice with pcscd. - # Essentially, scdaemon shall not try to acquire an exclusive lock and - # this will conflict with pcscd, which tries to do the same. - # Luckily, scdaemon supports sharing access with pcscd. - disable-ccid = true; - pcsc-shared = true; - }; - }; - - services.gpg-agent = { - enable = true; - pinentry = { - package = pkgs.pinentry-all; - program = "pinentry"; - }; - - enableBashIntegration = true; - enableFishIntegration = true; - - enableScDaemon = true; - enableSshSupport = true; - - # Cache passphrase for the given TTL in seconds. - # Extend the cache lifetime on cache hits. - defaultCacheTtl = 60 * 60; - defaultCacheTtlSsh = 60 * 60; - - # Maximum cache TTL beyond which it cannot be extended. - maxCacheTtl = 60 * 60 * 8; - maxCacheTtlSsh = 60 * 60 * 8; - }; + imports = [ + ./settings.nix + ]; } diff --git a/home/gpg/settings.nix b/home/gpg/settings.nix new file mode 100644 index 0000000..7f84038 --- /dev/null +++ b/home/gpg/settings.nix @@ -0,0 +1,87 @@ +{ pkgs, ... }: +{ + programs.gpg = { + enable = true; + + # Have GPG database being managed by the user. + mutableKeys = true; + mutableTrust = true; + + settings = { + charset = "utf-8"; + default-key = "0x49593BD010DE4723"; + no-emit-version = true; + no-comments = true; + keyid-format = "0xlong"; + with-fingerprint = true; + list-options = "show-uid-validity"; + verify-options = "show-uid-validity"; + use-agent = true; + keyserver = "keys.openpgp.org"; + keyserver-options = [ + "no-honor-keyserver-url" + "include-revoked" + ]; + personal-cipher-preferences = [ + "AES256" + "AES192" + "AES" + "CAST5" + ]; + personal-digest-preferences = [ + "SHA512" + "SHA384" + "SHA256" + "SHA224" + ]; + cert-digest-algo = "SHA512"; + s2k-digest-algo = "SHA512"; + default-preference-list = [ + "SHA512" + "SHA384" + "SHA256" + "SHA224" + "AES256" + "AES192" + "AES" + "CAST5" + "ZLIB" + "BZIP2" + "ZIP" + "Uncompressed" + ]; + }; + + scdaemonSettings = { + # Tweak GPG's own smart card daemon in order to play nice with pcscd. + # Essentially, scdaemon shall not try to acquire an exclusive lock and + # this will conflict with pcscd, which tries to do the same. + # Luckily, scdaemon supports sharing access with pcscd. + disable-ccid = true; + pcsc-shared = true; + }; + }; + + services.gpg-agent = { + enable = true; + pinentry = { + package = pkgs.pinentry-all; + program = "pinentry"; + }; + + enableBashIntegration = true; + enableFishIntegration = true; + + enableScDaemon = true; + enableSshSupport = true; + + # Cache passphrase for the given TTL in seconds. + # Extend the cache lifetime on cache hits. + defaultCacheTtl = 60 * 60; + defaultCacheTtlSsh = 60 * 60; + + # Maximum cache TTL beyond which it cannot be extended. + maxCacheTtl = 60 * 60 * 8; + maxCacheTtlSsh = 60 * 60 * 8; + }; +} From ae9fa71ce020abf3dc54f7894288813cf0d321c9 Mon Sep 17 00:00:00 2001 From: Rudolf Tucek Date: Mon, 23 Nov 2026 03:37:16 +0100 Subject: [PATCH 2/5] gpg: add actively used keys --- home/gpg/default.nix | 1 + home/gpg/trusted-keys.nix | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 home/gpg/trusted-keys.nix diff --git a/home/gpg/default.nix b/home/gpg/default.nix index 88f0a9c..7c6e43a 100644 --- a/home/gpg/default.nix +++ b/home/gpg/default.nix @@ -1,5 +1,6 @@ { imports = [ ./settings.nix + ./trusted-keys.nix ]; } diff --git a/home/gpg/trusted-keys.nix b/home/gpg/trusted-keys.nix new file mode 100644 index 0000000..97ca11b --- /dev/null +++ b/home/gpg/trusted-keys.nix @@ -0,0 +1,26 @@ +{ pkgs, ... }: +{ + programs.gpg.publicKeys = [ + ## Actively used keys + + { + # Private Yubikey (serial 13364058) + # tucek.rudolf@gmail.com + source = pkgs.fetchurl { + url = "https://keys.openpgp.org/vks/v1/by-fingerprint/72067CD79C9ED21F2A626439416CF1EF9AAF90BC"; + hash = "sha256-o5mdgfLEhhCT3IIW+pJX2heFNXkAeYre3mu1x6dbugE="; + }; + trust = "ultimate"; + } + + { + # Watt Analytics + # rudolf.tucek@watt-analytics.com + source = pkgs.fetchurl { + url = "https://keys.openpgp.org/vks/v1/by-fingerprint/B8CD0CF2730CA8D861671DC4B4A383288C158721"; + hash = "sha256-5AVpttZMWxuAeuE0MnPrjzVkBON6jK91EFTTc7cimLU="; + }; + trust = "ultimate"; + } + ]; +} From c1f449a1a6734d62d667c03c5c5d025045cb0580 Mon Sep 17 00:00:00 2001 From: Rudolf Tucek Date: Mon, 23 Nov 2026 03:37:16 +0100 Subject: [PATCH 3/5] gpg: add Github's own publicly trusted signing key --- home/gpg/trusted-keys.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/home/gpg/trusted-keys.nix b/home/gpg/trusted-keys.nix index 97ca11b..bd3dc55 100644 --- a/home/gpg/trusted-keys.nix +++ b/home/gpg/trusted-keys.nix @@ -22,5 +22,17 @@ }; trust = "ultimate"; } + + { + # Github's own GPG key, used for signing commits on behalf of their users. + # For instance, commits created by merging PRs via the web UI. + # rsa4096/0xB5690EEEBB952194 (used as of 2024-01-16; currently in-use) + # rsa2048/0x4AEE18F83AFDEB23 (used as of 2017-08-16; now expired) + source = pkgs.fetchurl { + url = "https://github.com/web-flow.gpg"; + hash = "sha256-bor2h/YM8/QDFRyPsbJuleb55CTKYMyPN4e9RGaj74Q="; + }; + trust = "ultimate"; + } ]; } From a76ed5357870a4c535ce1ccbd9ac37f5dea41a45 Mon Sep 17 00:00:00 2001 From: Rudolf Tucek Date: Mon, 23 Nov 2026 03:37:16 +0100 Subject: [PATCH 4/5] gpg: add old IXO public keys --- home/gpg/trusted-keys.nix | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/home/gpg/trusted-keys.nix b/home/gpg/trusted-keys.nix index bd3dc55..5889080 100644 --- a/home/gpg/trusted-keys.nix +++ b/home/gpg/trusted-keys.nix @@ -34,5 +34,41 @@ }; trust = "ultimate"; } + + ## Legacy keys + # Old keys, which have expired, are revoked and/or are no longer in use. + + { + # 3nd generation of r.tucek@ixolit.com + r.tucek@ixopay.com, generated in 2022-10. + # Added IXOPAY email address + got a new Yubikey due to port-issues on new work laptop (old + # Yubikey was USB; new Yubikey was USB-C). + source = pkgs.fetchurl { + url = "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x9fb53baa52695fc2a6f2aea58541357f8812998a"; + hash = "sha256-4Ki1+mwQVcc7olUoXATIMcd++9LBluX1+fSvKH1+Qbg="; + }; + trust = "ultimate"; + } + + { + # 2nd generation of r.tucek@ixolit.com, generated in 2020-06. + # Based on the initial Yubikey rollout at IXO. + # Used for signing and authentication. + source = pkgs.fetchurl { + url = "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x42c6fe7db7f159138ac398764f9f86ced271636e"; + hash = "sha256-UlSa5r24dIqESeMDFtWm70xaoi5/KYM1XpplW8V9yts="; + }; + trust = "ultimate"; + } + + { + # 1st generation of r.tucek@ixolit.com key, generated in 2017-06. + # Used at the early days, when we didn't had Yubikeys. + # Only used for signing purpose. + source = pkgs.fetchurl { + url = "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x5d5a149617fed62e50e37eb86442f831eb470ff5"; + hash = "sha256-81VazxQczWM8l1gEBuYBiZIu8uGtWO75/TIAz3Q1hLs="; + }; + trust = "ultimate"; + } ]; } From 6bf2ad12c751148217fd6543a303f935ccace412 Mon Sep 17 00:00:00 2001 From: Rudolf Tucek Date: Mon, 23 Nov 2026 03:37:16 +0100 Subject: [PATCH 5/5] gpg: add formerly used keys for tucek.rudolf@gmail.com --- home/gpg/trusted-keys.nix | 40 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/home/gpg/trusted-keys.nix b/home/gpg/trusted-keys.nix index 5889080..777eb4c 100644 --- a/home/gpg/trusted-keys.nix +++ b/home/gpg/trusted-keys.nix @@ -70,5 +70,45 @@ }; trust = "ultimate"; } + + { + # Key, generated for tucek.rudolf@gmail.com in 2016-10. + # Used for ~10 years until 2026-07 for signing commits and authentication. + source = pkgs.fetchurl { + url = "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xd4b423c3733ebcaa1c7171e641e89aaac718851c"; + hash = "sha256-edHV9qpFcjp40XC1d8xqoMnZtWnENIgBQIpFdOcnyz0="; + }; + trust = "ultimate"; + } + + # { + # # Test key of tucek.rudolf@gmail.com, generated for crypto-experiments in 2016-06. + # # Key got officially revoked. + # source = pkgs.fetchurl { + # url = "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xb9d2fddcaa3410745df8fc956f29650ff90cbee6"; + # hash = "sha256-76tEiMKYodF57RpVEAyL5MIOEBG1eHbN/5q8mWoP1sg="; + # }; + # trust = "ultimate"; + # } + + { + # Test key of tucek.rudolf@gmail.com, generated for crypto-experiments in 2014-04. + # Unfortunately, this key was never properly revoked. + source = pkgs.fetchurl { + url = "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3c028d883dd9f06bcedb0876503aad0876c056b5"; + hash = "sha256-kYpTi6yM6MCeggOU+j0t6Ookip1Yi9r2vQ+e+n/qTX4="; + }; + trust = "ultimate"; + } + + { + # 1st key, generated for tucek.rudolf@gmail.com in 2013-06. + # This key wasn't backed-up when migrating to a new Laptop. + source = pkgs.fetchurl { + url = "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x83e7b166b97f2fb952715d7e2e0c9793bb1a16e9"; + hash = "sha256-R6wmSPMGGXmY9UbzHbJd28MedZZUXI73+Z3au7slL+A="; + }; + trust = "ultimate"; + } ]; }