Headscale support (upgrade to latest nixpkgs) #9
12 changed files with 113 additions and 19 deletions
|
@ -8,7 +8,7 @@ let
|
||||||
nixos-config.symlink = "config/${machine}/configuration.nix";
|
nixos-config.symlink = "config/${machine}/configuration.nix";
|
||||||
nixpkgs.git = {
|
nixpkgs.git = {
|
||||||
clean.exclude = [ "/.version-suffix" ];
|
clean.exclude = [ "/.version-suffix" ];
|
||||||
ref = "e96c668072d7c98ddf2062f6d2b37f84909a572b"; # nixos-22.05
|
ref = "0d68d7c857fe301d49cdcd56130e0beea4ecd5aa"; # nixos-unstable
|
||||||
url = "https://github.com/NixOS/nixpkgs";
|
url = "https://github.com/NixOS/nixpkgs";
|
||||||
};
|
};
|
||||||
}];
|
}];
|
||||||
|
|
|
@ -5,9 +5,9 @@ let
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
security.acme.acceptTerms = true;
|
security.acme.acceptTerms = true;
|
||||||
security.acme.email = my.email;
|
security.acme.defaults.email = my.email;
|
||||||
|
|
||||||
security.acme.server =
|
security.acme.defaults.server =
|
||||||
if my.acmeStaging
|
if my.acmeStaging
|
||||||
then "https://acme-staging-v02.api.letsencrypt.org/directory"
|
then "https://acme-staging-v02.api.letsencrypt.org/directory"
|
||||||
else null;
|
else null;
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
./keycloak.nix
|
./keycloak.nix
|
||||||
./acme-dns.nix
|
./acme-dns.nix
|
||||||
./backups.nix
|
./backups.nix
|
||||||
|
./headscale.nix
|
||||||
# ./dex.nix
|
# ./dex.nix
|
||||||
./oauth2_proxy.nix
|
./oauth2_proxy.nix
|
||||||
./secrets
|
./secrets
|
||||||
|
|
|
@ -14,5 +14,5 @@ in
|
||||||
envFile = config.age.secrets.droneKeyFile.path;
|
envFile = config.age.secrets.droneKeyFile.path;
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.services."drone-exec-runner-nix01".after = [ "gitea" ];
|
systemd.services."drone-exec-runner-nix01".after = [ "gitea.service" ];
|
||||||
}
|
}
|
||||||
|
|
51
machines/core-services-01/fix-crc-computation.patch
Normal file
51
machines/core-services-01/fix-crc-computation.patch
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
From ec3df00224d4b396e2ac6586ab5d25f673caa4c2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Mark Adler <madler@alumni.caltech.edu>
|
||||||
|
Date: Wed, 30 Mar 2022 11:14:53 -0700
|
||||||
|
Subject: [PATCH] Correct incorrect inputs provided to the CRC functions.
|
||||||
|
|
||||||
|
The previous releases of zlib were not sensitive to incorrect CRC
|
||||||
|
inputs with bits set above the low 32. This commit restores that
|
||||||
|
behavior, so that applications with such bugs will continue to
|
||||||
|
operate as before.
|
||||||
|
---
|
||||||
|
crc32.c | 8 ++++----
|
||||||
|
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/crc32.c b/crc32.c
|
||||||
|
index a1bdce5c2..451887bc7 100644
|
||||||
|
--- a/crc32.c
|
||||||
|
+++ b/crc32.c
|
||||||
|
@@ -630,7 +630,7 @@ unsigned long ZEXPORT crc32_z(crc, buf, len)
|
||||||
|
#endif /* DYNAMIC_CRC_TABLE */
|
||||||
|
|
||||||
|
/* Pre-condition the CRC */
|
||||||
|
- crc ^= 0xffffffff;
|
||||||
|
+ crc = (~crc) & 0xffffffff;
|
||||||
|
|
||||||
|
/* Compute the CRC up to a word boundary. */
|
||||||
|
while (len && ((z_size_t)buf & 7) != 0) {
|
||||||
|
@@ -749,7 +749,7 @@ unsigned long ZEXPORT crc32_z(crc, buf, len)
|
||||||
|
#endif /* DYNAMIC_CRC_TABLE */
|
||||||
|
|
||||||
|
/* Pre-condition the CRC */
|
||||||
|
- crc ^= 0xffffffff;
|
||||||
|
+ crc = (~crc) & 0xffffffff;
|
||||||
|
|
||||||
|
#ifdef W
|
||||||
|
|
||||||
|
@@ -1077,7 +1077,7 @@ uLong ZEXPORT crc32_combine64(crc1, crc2, len2)
|
||||||
|
#ifdef DYNAMIC_CRC_TABLE
|
||||||
|
once(&made, make_crc_table);
|
||||||
|
#endif /* DYNAMIC_CRC_TABLE */
|
||||||
|
- return multmodp(x2nmodp(len2, 3), crc1) ^ crc2;
|
||||||
|
+ return multmodp(x2nmodp(len2, 3), crc1) ^ (crc2 & 0xffffffff);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ========================================================================= */
|
||||||
|
@@ -1112,5 +1112,5 @@ uLong crc32_combine_op(crc1, crc2, op)
|
||||||
|
uLong crc2;
|
||||||
|
uLong op;
|
||||||
|
{
|
||||||
|
- return multmodp(op, crc1) ^ crc2;
|
||||||
|
+ return multmodp(op, crc1) ^ (crc2 & 0xffffffff);
|
||||||
|
}
|
8
machines/core-services-01/headscale.nix
Normal file
8
machines/core-services-01/headscale.nix
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
services.headscale = {
|
||||||
|
enable = true;
|
||||||
|
serverUrl = "https://tailscale.rz.ens.wtf";
|
||||||
|
tls.letsencrypt.hostname = "tailscale.rz.ens.wtf";
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,26 +1,33 @@
|
||||||
{ config, pkgs, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
let
|
let
|
||||||
my = config.my;
|
my = config.my;
|
||||||
port = 8080;
|
port = 8080;
|
||||||
|
keycloak-protocol-cas = pkgs.callPackage ./keycloak/keycloak-protocol-cas.nix {};
|
||||||
|
domain = "auth.${my.subZone}";
|
||||||
|
certs = config.security.acme.certs."${domain}".directory;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
services.keycloak = {
|
services.keycloak = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = pkgs.keycloak.override {
|
|
||||||
jre = pkgs.jre8;
|
|
||||||
};
|
|
||||||
initialAdminPassword = "changemeasap";
|
initialAdminPassword = "changemeasap";
|
||||||
database.createLocally = true;
|
plugins = [ pkgs.keycloak.plugins.keycloak-metrics-spi keycloak-protocol-cas ];
|
||||||
database.passwordFile = config.age.secrets.keycloakDatabasePasswordFile.path;
|
database = {
|
||||||
frontendUrl = "https://auth.${my.subZone}/auth/";
|
type = "postgresql";
|
||||||
forceBackendUrlToFrontendUrl = true;
|
username = "keycloak";
|
||||||
httpPort = toString port;
|
name = "keycloak";
|
||||||
extraConfig = {
|
createLocally = true;
|
||||||
"subsystem=undertow"."server=default-server"."http-listener=default".proxy-address-forwarding = true;
|
passwordFile = "${config.age.secrets.keycloakDatabasePasswordFile.path}";
|
||||||
|
};
|
||||||
|
settings = {
|
||||||
|
hostname-strict-backchannel = true;
|
||||||
|
http-port = port;
|
||||||
|
proxy = "edge";
|
||||||
|
http-relative-path = "/auth";
|
||||||
|
hostname = domain;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
services.nginx.virtualHosts."auth.${my.subZone}" = {
|
services.nginx.virtualHosts."${domain}" = {
|
||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
enableACME = true;
|
enableACME = true;
|
||||||
locations."/" = {
|
locations."/" = {
|
||||||
|
|
26
machines/core-services-01/keycloak/keycloak-protocol-cas.nix
Normal file
26
machines/core-services-01/keycloak/keycloak-protocol-cas.nix
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
{ stdenv, lib, fetchurl }:
|
||||||
|
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
|
pname = "keycloak-protocol-cas";
|
||||||
|
version = "18.0.0";
|
||||||
|
|
||||||
|
src = fetchurl {
|
||||||
|
url = "https://github.com/jacekkow/keycloak-protocol-cas/releases/download/${version}/keycloak-protocol-cas-${version}.jar";
|
||||||
|
sha256 = "sha256-N+IJqD7oQ4T4MI8klt96kfHwFnPJy5l8MK6bq62nBrM=";
|
||||||
|
};
|
||||||
|
|
||||||
|
dontUnpack = true;
|
||||||
|
dontBuild = true;
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out
|
||||||
|
install "$src" "$out"
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
|
homepage = "https://github.com/jacekkow/keycloak-protocol-cas";
|
||||||
|
description = "Keycloak Service Provider that adds CAS as an authentication protocol";
|
||||||
|
license = licenses.apsl20;
|
||||||
|
maintainers = with maintainers; [ raitobezarius ];
|
||||||
|
};
|
||||||
|
}
|
|
@ -65,7 +65,7 @@ in
|
||||||
"health_alarm_notify"
|
"health_alarm_notify"
|
||||||
];
|
];
|
||||||
|
|
||||||
environment.etc."netdata/netdata.conf" = {
|
environment.etc."netdata/netdata.conf" = lib.mkForce {
|
||||||
user = "netdata";
|
user = "netdata";
|
||||||
group = "netdata";
|
group = "netdata";
|
||||||
mode = "0600";
|
mode = "0600";
|
||||||
|
|
|
@ -37,6 +37,7 @@ dualstack // {
|
||||||
monitoring = dualstack;
|
monitoring = dualstack;
|
||||||
auth = dualstack;
|
auth = dualstack;
|
||||||
push = dualstack;
|
push = dualstack;
|
||||||
|
tailscale = dualstack;
|
||||||
core01 = dualstack;
|
core01 = dualstack;
|
||||||
ns1 = dualstack;
|
ns1 = dualstack;
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
./nur.nix
|
./nur.nix
|
||||||
# ./factorio.nix # TODO
|
# ./factorio.nix # TODO
|
||||||
./nginx.nix
|
./nginx.nix
|
||||||
./cryptpad.nix
|
# ./cryptpad.nix
|
||||||
./hedgedoc.nix
|
./hedgedoc.nix
|
||||||
./secrets
|
./secrets
|
||||||
# TODO monitoring
|
# TODO monitoring
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
hostName = "nuage.beta.rz.ens.wtf";
|
hostName = "nuage.beta.rz.ens.wtf";
|
||||||
https = true;
|
https = true;
|
||||||
|
|
||||||
package = pkgs.nextcloud22;
|
package = pkgs.nextcloud23;
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
overwriteProtocol = "https";
|
overwriteProtocol = "https";
|
||||||
|
|
Loading…
Reference in a new issue