git.iko.soy/typeable/nixpkgs
on master help sign in
nixos/tor: fix HidServAuth (#122439)

* add an example for services.tor.settings.HidServAuth * fix HidServAuth validation to require ".onion" Per https://manpages.debian.org/testing/tor/torrc.5.en.html : > Valid onion addresses contain 16 characters in a-z2-7 plus ".onion"

commit33a4c431262255f4963b18e8ca6cc79dcdaed6b4 authorTom <tom@tom-fitzhenry.me.uk> dateTue 11 May 2021, 18:10 (6 years ago) parentb522731
1 file changed+8−2
nixos/modules/services/security/tor.nix+8−2
nixos/modules/services/security/tor.nix+8−2
@@ -170,7 +170,7 @@ let
170170 else if k == "ServerTransportPlugin" then
171171 optionalString (v.transports != []) "${concatStringsSep "," v.transports} exec ${v.exec}"
172172 else if k == "HidServAuth" then
173− concatMapStringsSep "\n${k} " (settings: settings.onion + " " settings.auth) v
173+ v.onion + " " + v.auth
174174 else generators.mkValueStringDefault {} v;
175175 genTorrc = settings:
176176 generators.toKeyValue {
@@ -715,7 +715,7 @@ in
715715 (submodule {
716716 options = {
717717 onion = mkOption {
718− type = strMatching "[a-z2-7]{16}(\\.onion)?";
718+ type = strMatching "[a-z2-7]{16}\\.onion";
719719 description = "Onion address.";
720720 example = "xxxxxxxxxxxxxxxx.onion";
721721 };
@@ -726,6 +726,12 @@ in
726726 };
727727 })
728728 ]);
729+ example = [
730+ {
731+ onion = "xxxxxxxxxxxxxxxx.onion";
732+ auth = "xxxxxxxxxxxxxxxxxxxxxx";
733+ }
734+ ];
729735 };
730736 options.HiddenServiceNonAnonymousMode = optionBool "HiddenServiceNonAnonymousMode";
731737 options.HiddenServiceStatistics = optionBool "HiddenServiceStatistics";