minersebas
12/04/2023, 6:29 PMnix
{ config, ... }:
let
localDomain = "${config.networking.hostName}.tailb9bed.ts.net";
in
{
services.lldap = {
enable = true;
settings = {
ldap_base_dn = "dc=minersebas,dc=com";
http_url = "https://${localDomain}/lldap";
};
};
services.caddy.virtualHosts.${localDomain}.extraConfig = ''
@lldap path /lldap /lldap/*
handle @lldap {
reverse_proxy http://127.0.0.1:${toString config.services.lldap.settings.http_port}
}
'';
}minersebas
12/04/2023, 6:34 PMnix
services.caddy.virtualHosts.${localDomain}.extraConfig = ''
reverse_proxy http://127.0.0.1:${toString config.services.lldap.settings.http_port}
'';
But that makes it annoying for me, as Tailscale doesnt allow subdomains for its MagicDNS. 😢minersebas
12/04/2023, 6:49 PMoracle.tailb9bed.ts.net/login (presumably it cached something), but that doesnt work because it should redirect to oracle.tailb9bed.ts.net/lldap/login. 😒nitnelave
12/04/2023, 6:55 PMnitnelave
12/04/2023, 7:04 PMminersebas
12/05/2023, 1:24 AMhandle_path /lldap* in caddy which automatically strips the lldap/ prefix away and this override:
nix
pkgs.lldap.overrideAttrs
(_: prev:
let
frontend = prev.passthru.frontend.overrideAttrs (_: previousAttrs: {
postPatch = (previousAttrs.postPatch or "") + ''
substituteInPlace app/src/infra/api.rs --replace "/api/" "/lldap/api/"
substituteInPlace app/src/infra/api.rs --replace "/auth/" "/lldap/auth/"
'';
installPhase = ''
substituteInPlace app/index.html --replace "</title>" "</title><base href=\"/lldap/\" />"
substituteInPlace app/index.html --replace "/static/" "/lldap/static/"
substituteInPlace app/static/main.js --replace "/pkg/" "/lldap/pkg/"
'' + previousAttrs.installPhase;
});
in
{
postPatch = ''
substituteInPlace server/src/infra/tcp_server.rs --subst-var-by frontend '${frontend}'
'';
doCheck = false;
}
);
I got a hardcoded version working. A customisable Version shouldn't be too hard, now that i know the five Locations/URI to change.
Now Time for 🛏️nitnelave
12/05/2023, 3:04 AMminersebas
12/05/2023, 3:49 PMnitnelave
12/05/2023, 3:54 PMminersebas
12/05/2023, 4:17 PM## The public URL of the server, for password reset links.
#http_url = "http://localhost"
But i havent activly tested it, as dont know how to test it.nitnelave
12/05/2023, 4:20 PMnitnelave
12/05/2023, 4:20 PMminersebas
12/05/2023, 4:27 PMnitnelave
12/05/2023, 4:37 PMminersebas
12/05/2023, 5:14 PMDez 05 18:09:39 oracle lldap[1459566]: 2023-12-05T17:09:39.863875716+00:00 DEBUG │ ┝━ 🐛 [debug]: Sending email to 'scherthan_sebastian@web.de' as 'LLDAP Admin <scherthan_sebastian@web.de>' via 'scherthan_sebastian@web.de'@'smtp.web.de':'587'
Dez 05 18:09:39 oracle lldap[1459566]: 2023-12-05T17:09:39.934350708+00:00 DEBUG │ ┝━ 🐛 [debug]: No cached session for DnsName(DnsName(DnsName("smtp.web.de"))) | log.target: "rustls::client::hs" | log.module_path: "rustls::client::hs" | log.file: "/build/cargo-vendor-dir/rustls-0.20.8/src/client/hs.rs" | log.line: 55
Dez 05 18:09:39 oracle lldap[1459566]: 2023-12-05T17:09:39.934420188+00:00 DEBUG │ ┝━ 🐛 [debug]: Not resuming any session | log.target: "rustls::client::hs" | log.module_path: "rustls::client::hs" | log.file: "/build/cargo-vendor-dir/rustls-0.20.8/src/client/hs.rs" | log.line: 127
Dez 05 18:09:39 oracle lldap[1459566]: 2023-12-05T17:09:39.938659200+00:00 WARN │ ┝━ 🚧 [warn]: Error sending email: lettre::transport::smtp::Error {
Dez 05 18:09:39 oracle lldap[1459566]: kind: Connection,
Dez 05 18:09:39 oracle lldap[1459566]: source: lettre::transport::smtp::Error {
Dez 05 18:09:39 oracle lldap[1459566]: kind: Connection,
Dez 05 18:09:39 oracle lldap[1459566]: source: Custom {
Dez 05 18:09:39 oracle lldap[1459566]: kind: InvalidData,
Dez 05 18:09:39 oracle lldap[1459566]: error: CorruptMessage,
Dez 05 18:09:39 oracle lldap[1459566]: },
Dez 05 18:09:39 oracle lldap[1459566]: },
Dez 05 18:09:39 oracle lldap[1459566]: }
Dez 05 18:09:39 oracle lldap[1459566]: 2023-12-05T17:09:39.938660760+00:00 INFO │ ┕━ i [info]: Reset token: cYuBHilhGjnnm3MY4Audw8ZMhOJFXKHRXEOJnCoolc0rPGY3vyylNlQKq1HJ8ehHlhZXO8MK2976RqjYqphloEqu1RTDmDHNGMvf
Dez 05 18:09:39 oracle lldap[1459566]: 2023-12-05T17:09:39.938673240+00:00 DEBUG ┕━ 🐛 [debug]: | status_code: 500minersebas
12/05/2023, 5:15 PMnitnelave
12/05/2023, 5:15 PMnitnelave
12/05/2023, 5:15 PMminersebas
12/05/2023, 5:26 PMstarttls was the Solution, and the link succesfully worked.
P.S. The Webui should only show/allow a password reset when enable_password_reset is true.
I was confused initally why i could "succesfully" send the email, and nothing appeared.nitnelave
12/05/2023, 5:27 PMnitnelave
12/05/2023, 5:27 PMnitnelave
12/05/2023, 5:27 PMminersebas
12/05/2023, 5:28 PMnitnelave
12/05/2023, 5:28 PMnitnelave
12/05/2023, 5:29 PMminersebas
12/05/2023, 5:32 PM