nixos/tests/spiped: init
This commit is contained in:
parent
6b8c4f116c
commit
692b12ceea
@ -929,6 +929,7 @@ in {
|
||||
sourcehut = handleTest ./sourcehut {};
|
||||
spacecookie = handleTest ./spacecookie.nix {};
|
||||
spark = handleTestOn [ "x86_64-linux" "aarch64-linux" ] ./spark {};
|
||||
spiped = runTest ./spiped.nix;
|
||||
sqlite3-to-mysql = handleTest ./sqlite3-to-mysql.nix {};
|
||||
sslh = handleTest ./sslh.nix {};
|
||||
ssh-agent-auth = handleTest ./ssh-agent-auth.nix {};
|
||||
|
73
nixos/tests/spiped.nix
Normal file
73
nixos/tests/spiped.nix
Normal file
@ -0,0 +1,73 @@
|
||||
{ pkgs, ... }:
|
||||
let
|
||||
key = pkgs.runCommand "key" { } "${pkgs.openssl}/bin/openssl rand 32 > $out";
|
||||
in
|
||||
{
|
||||
name = "spiped";
|
||||
meta = with pkgs.lib.maintainers; {
|
||||
maintainers = [ tomfitzhenry ];
|
||||
};
|
||||
|
||||
nodes = {
|
||||
server =
|
||||
{ pkgs, lib, ... }:
|
||||
{
|
||||
services.caddy = {
|
||||
enable = true;
|
||||
settings = {
|
||||
apps.http.servers.default = {
|
||||
listen = [ ":80" ];
|
||||
routes = [
|
||||
{
|
||||
handle = [
|
||||
{
|
||||
body = "hello world";
|
||||
handler = "static_response";
|
||||
status_code = 200;
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services."spiped@server" = {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
overrideStrategy = "asDropin";
|
||||
};
|
||||
systemd.services."spiped@client" = {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
overrideStrategy = "asDropin";
|
||||
};
|
||||
services.spiped = {
|
||||
enable = true;
|
||||
config = {
|
||||
server = {
|
||||
source = "localhost:8080";
|
||||
target = "localhost:80";
|
||||
keyfile = key;
|
||||
decrypt = true;
|
||||
};
|
||||
client = {
|
||||
source = "localhost:8081";
|
||||
target = "localhost:8080";
|
||||
keyfile = key;
|
||||
encrypt = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
testScript =
|
||||
{ nodes, ... }:
|
||||
''
|
||||
server.wait_for_unit("caddy")
|
||||
server.wait_for_open_port(80)
|
||||
server.wait_for_open_port(8080)
|
||||
server.wait_for_open_port(8081)
|
||||
|
||||
server.succeed("curl http://localhost:8081 | grep hello")
|
||||
'';
|
||||
}
|
@ -4,6 +4,7 @@
|
||||
fetchurl,
|
||||
openssl,
|
||||
coreutils,
|
||||
nixosTests,
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
@ -34,6 +35,8 @@ stdenv.mkDerivation rec {
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
passthru.tests.spiped = nixosTests.spiped;
|
||||
|
||||
meta = {
|
||||
description = "Utility for secure encrypted channels between sockets";
|
||||
homepage = "https://www.tarsnap.com/spiped.html";
|
||||
|
Loading…
Reference in New Issue
Block a user