Merge pull request #19588 from Shados/add-dante

Add dante package & accompanying service module
This commit is contained in:
Franz Pletz 2016-11-22 15:10:46 +01:00 committed by GitHub
commit d94e93ccdf
4 changed files with 87 additions and 0 deletions

View File

@ -348,6 +348,7 @@
./services/networking/connman.nix
./services/networking/consul.nix
./services/networking/coturn.nix
./services/networking/dante.nix
./services/networking/ddclient.nix
./services/networking/dhcpcd.nix
./services/networking/dhcpd.nix

View File

@ -0,0 +1,61 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.dante;
confFile = pkgs.writeText "dante-sockd.conf" ''
user.privileged: root
user.unprivileged: dante
${cfg.config}
'';
in
{
meta = {
maintainers = with maintainers; [ arobyn ];
};
options = {
services.dante = {
enable = mkEnableOption "Dante SOCKS proxy";
config = mkOption {
default = null;
type = types.str;
description = ''
Contents of Dante's configuration file
NOTE: user.privileged/user.unprivileged are set by the service
'';
};
};
};
config = mkIf cfg.enable {
assertions = [
{ assertion = cfg.config != null;
message = "please provide Dante configuration file contents";
}
];
users.users.dante = {
description = "Dante SOCKS proxy daemon user";
isSystemUser = true;
group = "dante";
};
users.groups.dante = {};
systemd.services.dante = {
description = "Dante SOCKS v4 and v5 compatible proxy server";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.dante}/bin/sockd -f ${confFile}";
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
Restart = "always";
};
};
};
}

View File

@ -0,0 +1,23 @@
{ stdenv, fetchurl }:
stdenv.mkDerivation (rec {
name = "dante-${version}";
version = "1.4.1";
src = fetchurl {
url = "https://www.inet.no/dante/files/${name}.tar.gz";
sha256 = "0lsg3hk8zd2h9f08s13bn4l4pvyyzkj4gr4ppwa7vj7gdyyk5lmn";
};
configureFlags = [
"--with-libc=libc.so.6"
];
meta = {
description = "A circuit-level SOCKS client/server that can be used to provide convenient and secure network connectivity.";
homepage = "https://www.inet.no/dante/";
maintainers = [ stdenv.lib.maintainers.arobyn ];
license = stdenv.lib.licenses.bsdOriginal;
platforms = stdenv.lib.platforms.linux;
};
})

View File

@ -791,6 +791,8 @@ in
daemontools = callPackage ../tools/admin/daemontools { };
dante = callPackage ../servers/dante { };
datamash = callPackage ../tools/misc/datamash { };
datefudge = callPackage ../tools/system/datefudge { };