Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 99bfa4bb601b
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: a14ea3aeccc8
Choose a head ref
  • 2 commits
  • 5 files changed
  • 2 contributors

Commits on Jan 4, 2021

  1. nixos/tor: improve type-checking and hardening

    Fixes #77395.
    Fixes #82790.
    ju1m committed Jan 4, 2021
    Copy the full SHA
    0ccdd6f View commit details

Commits on Jan 5, 2021

  1. Merge pull request #97740 from ju1m/tor

    nixos/tor: improve type-checking and hardening
    Mic92 authored Jan 5, 2021

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    marsam Mario Rodas
    Copy the full SHA
    a14ea3a View commit details
10 changes: 10 additions & 0 deletions nixos/doc/manual/release-notes/rl-2103.xml
Original file line number Diff line number Diff line change
@@ -286,6 +286,16 @@
<xref linkend="opt-services.privoxy.enableTor" /> = true;
</programlisting>
</listitem>
<listitem>
<para>
The <literal>services.tor</literal> module has a new exhaustively typed <xref linkend="opt-services.tor.settings" /> option following RFC 0042; backward compatibility with old options has been preserved when aliasing was possible.
The corresponding systemd service has been hardened,
but there is a chance that the service still requires more permissions,
so please report any related trouble on the bugtracker.
Onion services v3 are now supported in <xref linkend="opt-services.tor.relay.onionServices" />.
A new <xref linkend="opt-services.tor.openFirewall" /> option as been introduced for allowing connections on all the TCP ports configured.
</para>
</listitem>
<listitem>
<para>
The options <literal>services.slurm.dbdserver.storagePass</literal>
7 changes: 6 additions & 1 deletion nixos/modules/services/networking/privoxy.nix
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ let
${concatMapStrings (f: "actionsfile ${f}\n") cfg.actionsFiles}
${concatMapStrings (f: "filterfile ${f}\n") cfg.filterFiles}
'' + optionalString cfg.enableTor ''
forward-socks4a / ${config.services.tor.client.socksListenAddressFaster} .
forward-socks5t / 127.0.0.1:9063 .
toggle 1
enable-remote-toggle 0
enable-edit-actions 0
@@ -123,6 +123,11 @@ in
serviceConfig.ProtectSystem = "full";
};

services.tor.settings.SOCKSPort = mkIf cfg.enableTor [
# Route HTTP traffic over a faster port (without IsolateDestAddr).
{ addr = "127.0.0.1"; port = 9063; IsolateDestAddr = false; }
];

};

meta.maintainers = with lib.maintainers; [ rnhmjoj ];
1,390 changes: 827 additions & 563 deletions nixos/modules/services/security/tor.nix

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion nixos/tests/tor.nix
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ rec {
environment.systemPackages = with pkgs; [ netcat ];
services.tor.enable = true;
services.tor.client.enable = true;
services.tor.controlPort = 9051;
services.tor.settings.ControlPort = 9051;
};

testScript = ''
18 changes: 17 additions & 1 deletion pkgs/tools/security/tor/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{ stdenv, fetchurl, pkgconfig, libevent, openssl, zlib, torsocks
, libseccomp, systemd, libcap, lzma, zstd, scrypt, nixosTests
, writeShellScript

# for update.nix
, writeScript
@@ -12,7 +13,21 @@
, gnused
, nix
}:

let
tor-client-auth-gen = writeShellScript "tor-client-auth-gen" ''
PATH="${stdenv.lib.makeBinPath [coreutils gnugrep openssl]}"
pem="$(openssl genpkey -algorithm x25519)"
printf private_key=descriptor:x25519:
echo "$pem" | grep -v " PRIVATE KEY" |
base64 -d | tail --bytes=32 | base32 | tr -d =
printf public_key=descriptor:x25519:
echo "$pem" | openssl pkey -in /dev/stdin -pubout |
grep -v " PUBLIC KEY" |
base64 -d | tail --bytes=32 | base32 | tr -d =
'';
in
stdenv.mkDerivation rec {
pname = "tor";
version = "0.4.4.6";
@@ -52,6 +67,7 @@ stdenv.mkDerivation rec {
mkdir -p $geoip/share/tor
mv $out/share/tor/geoip{,6} $geoip/share/tor
rm -rf $out/share/tor
ln -s ${tor-client-auth-gen} $out/bin/tor-client-auth-gen
'';

passthru = {