tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
Merge pull request #6170 from k0ral/sslh
New sslh module
lethalman
11 years ago
93ebaafa
7614b2f9
+113
4 changed files
expand all
collapse all
unified
split
nixos
modules
module-list.nix
services
networking
sslh.nix
pkgs
servers
sslh
default.nix
top-level
all-packages.nix
+1
nixos/modules/module-list.nix
···
288
288
./services/networking/searx.nix
289
289
./services/networking/seeks.nix
290
290
./services/networking/spiped.nix
291
291
+
./services/networking/sslh.nix
291
292
./services/networking/ssh/lshd.nix
292
293
./services/networking/ssh/sshd.nix
293
294
./services/networking/strongswan.nix
+83
nixos/modules/services/networking/sslh.nix
···
1
1
+
{ config, lib, pkgs, ... }:
2
2
+
3
3
+
with lib;
4
4
+
5
5
+
let
6
6
+
cfg = config.services.sslh;
7
7
+
configFile = pkgs.writeText "sslh.conf" ''
8
8
+
verbose: ${if cfg.verbose then "true" else "false"};
9
9
+
foreground: false;
10
10
+
inetd: false;
11
11
+
numeric: false;
12
12
+
transparent: false;
13
13
+
timeout: "${toString cfg.timeout}";
14
14
+
user: "nobody";
15
15
+
pidfile: "/run/sslh.pid";
16
16
+
17
17
+
listen:
18
18
+
(
19
19
+
{ host: "${cfg.host}"; port: "${toString cfg.port}"; }
20
20
+
);
21
21
+
22
22
+
${cfg.appendConfig}
23
23
+
'';
24
24
+
defaultAppendConfig = ''
25
25
+
protocols:
26
26
+
(
27
27
+
{ name: "ssh"; service: "ssh"; host: "localhost"; port: "22"; probe: "builtin"; },
28
28
+
{ name: "openvpn"; host: "localhost"; port: "1194"; probe: "builtin"; },
29
29
+
{ name: "xmpp"; host: "localhost"; port: "5222"; probe: "builtin"; },
30
30
+
{ name: "http"; host: "localhost"; port: "80"; probe: "builtin"; },
31
31
+
{ name: "ssl"; host: "localhost"; port: "443"; probe: "builtin"; },
32
32
+
{ name: "anyprot"; host: "localhost"; port: "443"; probe: "builtin"; }
33
33
+
);
34
34
+
'';
35
35
+
in
36
36
+
{
37
37
+
options = {
38
38
+
services.sslh = {
39
39
+
enable = mkEnableOption "sslh";
40
40
+
41
41
+
verbose = mkOption {
42
42
+
type = types.bool;
43
43
+
default = false;
44
44
+
description = "Verbose logs.";
45
45
+
};
46
46
+
47
47
+
timeout = mkOption {
48
48
+
type = types.int;
49
49
+
default = 2;
50
50
+
description = "Timeout in seconds.";
51
51
+
};
52
52
+
53
53
+
host = mkOption {
54
54
+
type = types.str;
55
55
+
default = config.networking.hostName;
56
56
+
description = "Listening hostname.";
57
57
+
};
58
58
+
59
59
+
port = mkOption {
60
60
+
type = types.int;
61
61
+
default = 443;
62
62
+
description = "Listening port.";
63
63
+
};
64
64
+
65
65
+
appendConfig = mkOption {
66
66
+
type = types.str;
67
67
+
default = defaultAppendConfig;
68
68
+
description = "Verbatim configuration file.";
69
69
+
};
70
70
+
};
71
71
+
};
72
72
+
73
73
+
config = mkIf cfg.enable {
74
74
+
systemd.services.sslh = {
75
75
+
description = "Applicative Protocol Multiplexer (e.g. share SSH and HTTPS on the same port)";
76
76
+
after = [ "network.target" ];
77
77
+
wantedBy = [ "multi-user.target" ];
78
78
+
serviceConfig.ExecStart = "${pkgs.sslh}/bin/sslh -F ${configFile}";
79
79
+
serviceConfig.KillMode = "process";
80
80
+
serviceConfig.PIDFile = "/run/sslh.pid";
81
81
+
};
82
82
+
};
83
83
+
}
+27
pkgs/servers/sslh/default.nix
···
1
1
+
{ stdenv, fetchurl, libcap, libconfig, perl }:
2
2
+
3
3
+
stdenv.mkDerivation rec {
4
4
+
name = "sslh-${version}";
5
5
+
version = "1.16";
6
6
+
7
7
+
src = fetchurl {
8
8
+
url = "https://github.com/yrutschle/sslh/archive/v${version}.tar.gz";
9
9
+
sha256 = "0xwi2bflvq4phrqjic84xch20jkg3wdys219mw2cy23sjkzk63mb";
10
10
+
};
11
11
+
12
12
+
postPatch = "patchShebangs *.sh";
13
13
+
14
14
+
buildInputs = [ libcap libconfig perl ];
15
15
+
16
16
+
makeFlags = "USELIBCAP=1";
17
17
+
18
18
+
installFlags = "PREFIX=$(out)";
19
19
+
20
20
+
meta = with stdenv.lib; {
21
21
+
description = "Applicative Protocol Multiplexer (e.g. share SSH and HTTPS on the same port)";
22
22
+
license = licenses.gpl2Plus;
23
23
+
homepage = http://www.rutschle.net/tech/sslh.shtml;
24
24
+
maintainers = [ maintainers.koral ];
25
25
+
platforms = platforms.all;
26
26
+
};
27
27
+
}
+2
pkgs/top-level/all-packages.nix
···
8231
8231
});
8232
8232
squid = squids.squid31; # has ipv6 support
8233
8233
8234
8234
+
sslh = callPackage ../servers/sslh { };
8235
8235
+
8234
8236
thttpd = callPackage ../servers/http/thttpd { };
8235
8237
8236
8238
storm = callPackage ../servers/computing/storm { };