Author: egorochkin
Date: Sun Sep 19 15:40:03 2010
New Revision: 23862
URL: https://svn.nixos.org/websvn/nix/?rev=23862&sc=1
Log:
TOR: prevent creation of torPrivoxy.conf if Privoxy is disabled.
Patch by Russel O'Connor
Modified:
nixos/trunk/modules/services/security/tor.nix
Modified: nixos/trunk/modules/services/security/tor.nix
==============================================================================
--- nixos/trunk/modules/services/security/tor.nix Sun Sep 19 00:21:30
2010 (r23861)
+++ nixos/trunk/modules/services/security/tor.nix Sun Sep 19 15:40:03
2010 (r23862)
@@ -233,36 +233,33 @@
home = stateDir;
};
- jobs.tor =
- { name = "tor";
+ jobs = {
+ tor = { name = "tor";
- startOn = "started network-interfaces";
- stopOn = "stopping network-interfaces";
+ startOn = "started network-interfaces";
+ stopOn = "stopping network-interfaces";
- preStart =
- ''
- mkdir -m 0755 -p ${stateDir}
- chown ${torUser} ${stateDir}
- '';
- exec = "${tor}/bin/tor -f ${pkgs.writeText "torrc" cfg.config}";
- };
-
- jobs.torPrivoxy = mkIf (cfg.client.privoxy.enable && cfg.client.enable)
- { name = "tor-privoxy";
-
- startOn = "starting tor";
- stopOn = "stopping tor";
-
- preStart =
- ''
- mkdir -m 0755 -p ${privoxyDir}
- chown ${torUser} ${privoxyDir}
-
- # Needed to run privoxy as an unprivileged user?
- ${modprobe}/sbin/modprobe capability || true
- '';
- exec = "${privoxy}/sbin/privoxy --no-daemon --user ${torUser}
${pkgs.writeText "torPrivoxy.conf" cfg.client.privoxy.config}";
- };
+ preStart = ''
+ mkdir -m 0755 -p ${stateDir}
+ chown ${torUser} ${stateDir}
+ '';
+ exec = "${tor}/bin/tor -f ${pkgs.writeText "torrc" cfg.config}";
+ }; }
+ // optionalAttrs (cfg.client.privoxy.enable && cfg.client.enable) {
+ torPrivoxy = { name = "tor-privoxy";
+
+ startOn = "starting tor";
+ stopOn = "stopping tor";
+
+ preStart = ''
+ mkdir -m 0755 -p ${privoxyDir}
+ chown ${torUser} ${privoxyDir}
+
+ # Needed to run privoxy as an unprivileged user?
+ ${modprobe}/sbin/modprobe capability || true
+ '';
+ exec = "${privoxy}/sbin/privoxy --no-daemon --user
${torUser} ${pkgs.writeText "torPrivoxy.conf" cfg.client.privoxy.config}";
+ }; };
services.tor.config = ''
DataDirectory ${stateDir}
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits