new migration mode
This commit is contained in:
parent
e94ed21061
commit
337b6b9736
2 changed files with 179 additions and 58 deletions
|
|
@ -14,56 +14,19 @@
|
|||
{
|
||||
nexusbot = {
|
||||
enable = true;
|
||||
botPasswordFile = config.age.secrets."botPassword.age".path;
|
||||
smtpPasswordFile = config.age.secrets."smtpPassword.age".path;
|
||||
# An access token from a password login, made before continuwuity switched to Kanidm logins
|
||||
botTokenFile = config.age.secrets."botToken.age".path;
|
||||
args = [
|
||||
"--socket"
|
||||
socket
|
||||
"--homeserver"
|
||||
config.services.matrix-continuwuity.settings.global.well_known.client
|
||||
"--username"
|
||||
"nexusbot"
|
||||
"--adminRoom"
|
||||
"#admins:federated.nexus"
|
||||
"--successUri"
|
||||
"https://federated.nexus/success"
|
||||
"--failureUri"
|
||||
"https://federated.nexus/failure"
|
||||
"--inviteTo"
|
||||
"#space:federated.nexus"
|
||||
"--adminName"
|
||||
"conduit"
|
||||
"--email"
|
||||
("inf" + "o@f" + "edera" + "ted.n" + "exus")
|
||||
"--mailDomain"
|
||||
"email-smtp.us-east-1.amazonaws.com"
|
||||
"--mailName"
|
||||
"Federated Nexus"
|
||||
"--mailUsername"
|
||||
"AKIAREHCBHZLJ3FNCCSM"
|
||||
"--subject"
|
||||
"Your registration for Federated Nexus has been accepted!"
|
||||
"--plainText"
|
||||
"Your registration for Federated Nexus has been accepted! Your credentials are:
|
||||
Username: @{username}
|
||||
Password: @{password}
|
||||
|
||||
You can change your password in your favorite Matrix client, or here: https://matrix.federated.nexus/_continuwuity/account/password/change
|
||||
|
||||
If you have any questions, check out our documentation: https://federated.nexus/services/matrix/.
|
||||
|
||||
If you have any issues, reply to this email."
|
||||
"--markdown"
|
||||
"# Your registration for Federated Nexus has been accepted!
|
||||
## Your credentials are:
|
||||
- ### Username: @{username}
|
||||
- ### Password: @{password}
|
||||
|
||||
You can change your password in your favorite Matrix client, or [here](https://matrix.federated.nexus/_continuwuity/account/password/change).
|
||||
|
||||
If you have any questions, check out [our documentation](https://federated.nexus/services/matrix/).
|
||||
|
||||
If you have any issues, reply to this email."
|
||||
];
|
||||
group = "caddy";
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,19 +1,73 @@
|
|||
{ lib, pkgs, ... }: {
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
inputs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
client = "matrix";
|
||||
in
|
||||
{
|
||||
systemd.services.continuwuity = {
|
||||
unitConfig.RequiresMountsFor = [ "/var/lib/private/continuwuity/media" ];
|
||||
# It fetches Kanidm's OIDC metadata once at startup, and logins fail until a restart if that fails
|
||||
requires = [ "kanidm-oauth2-secrets.service" ];
|
||||
wants = [ "kanidm.service" ];
|
||||
after = [
|
||||
"kanidm-oauth2-secrets.service"
|
||||
"kanidm.service"
|
||||
"caddy.service"
|
||||
];
|
||||
serviceConfig = {
|
||||
MemoryMax = "5.5G";
|
||||
MemorySwapMax = "4.5G";
|
||||
TimeoutStartSec = "10m";
|
||||
Restart = lib.mkForce "always";
|
||||
ExecStartPost = "/bin/sh -c 'until ${lib.getExe pkgs.curl} -s -f https://matrix.federated.nexus/.well-known/matrix/client; do sleep 1; done'";
|
||||
LoadCredential = [
|
||||
"oidc-secret:${config.services.kanidm.provision.systems.oauth2.${client}.basicSecretFile}"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
services.kanidm.provision.systems.oauth2.${client} = {
|
||||
displayName = "Matrix";
|
||||
originUrl = "${config.services.matrix-continuwuity.settings.global.well_known.client}/_continuwuity/oidc/complete";
|
||||
originLanding = "https://app.${config.quad.matrix.domain}";
|
||||
imageFile = "${
|
||||
inputs.sable.packages.${pkgs.stdenv.hostPlatform.system}.default
|
||||
}/public/svg/logo.svg";
|
||||
basicSecretFile = "/var/lib/kanidm-oauth2-secrets/${client}";
|
||||
# The username claim is the Matrix localpart
|
||||
preferShortUsername = true;
|
||||
scopeMaps.idm_all_persons = [
|
||||
"openid"
|
||||
"email"
|
||||
"profile"
|
||||
];
|
||||
};
|
||||
|
||||
quad.matrix = rec {
|
||||
enable = true;
|
||||
domain = "federated.nexus";
|
||||
settings = {
|
||||
auto_join_rooms = [ "#space:${domain}" ];
|
||||
|
||||
# Logins go through Kanidm only. Existing accounts are linked by username
|
||||
# on first login, and new ones are created then
|
||||
oauth.oidc = {
|
||||
discovery_url = "${config.services.kanidm.server.settings.origin}/oauth2/openid/${client}";
|
||||
client_id = client;
|
||||
client_secret_file = "/run/credentials/continuwuity.service/oidc-secret";
|
||||
provider_name = "Federated Nexus";
|
||||
prompt_for_localpart = false;
|
||||
additional_scopes = [
|
||||
"email"
|
||||
"profile"
|
||||
];
|
||||
};
|
||||
|
||||
admins_list = [
|
||||
"@nexusbot:federated.nexus"
|
||||
"@quadradical:federated.nexus"
|
||||
|
|
|
|||
Loading…
Reference in a new issue