Get kas.codes minimally functioning
This commit is contained in:
parent
dec0048a7b
commit
9bd9eb328b
3 changed files with 28 additions and 15 deletions
|
@ -87,8 +87,8 @@ in
|
||||||
mailer = {
|
mailer = {
|
||||||
ENABLED = true;
|
ENABLED = true;
|
||||||
SMTP_ADDR = "kas.codes";
|
SMTP_ADDR = "kas.codes";
|
||||||
FROM = "forgejo@khs.codes";
|
FROM = "forgejo@kas.codes";
|
||||||
USER = "forgejo@khs.codes";
|
USER = "forgejo@kas.codes";
|
||||||
};
|
};
|
||||||
"ui.meta" = {
|
"ui.meta" = {
|
||||||
AUTHOR = "Kaare Hoff Skovgaard <kaare@kaareskovgaard.net>";
|
AUTHOR = "Kaare Hoff Skovgaard <kaare@kaareskovgaard.net>";
|
||||||
|
|
|
@ -16,22 +16,28 @@ let
|
||||||
config="${config.services.forgejo.stateDir}/custom/conf/app.ini"
|
config="${config.services.forgejo.stateDir}/custom/conf/app.ini"
|
||||||
secret="$(cat ${oauthSecretIdFile})"
|
secret="$(cat ${oauthSecretIdFile})"
|
||||||
|
|
||||||
|
options=(
|
||||||
|
"--name" "Kanidm" \
|
||||||
|
"--key" "forgejo" \
|
||||||
|
"--secret" "$secret" \
|
||||||
|
"--auto-discover-url" https://login.kaareskovgaard.net/oauth2/openid/forgejo/.well-known/openid-configuration \
|
||||||
|
"--scopes" "email profile" \
|
||||||
|
"--skip-local-2fa" \
|
||||||
|
"--provider" openidConnect \
|
||||||
|
"--group-claim-name" "groups" \
|
||||||
|
"--admin-group" "admin" \
|
||||||
|
"--group-team-map-removal" \
|
||||||
|
"--group-team-map" '{"nix": {"nix": [] }, "actions": { "actons": [] }}'
|
||||||
|
)
|
||||||
|
|
||||||
if gitea "--config=$config" admin auth list | grep -q "Kanidm" 2> /dev/null; then
|
if gitea "--config=$config" admin auth list | grep -q "Kanidm" 2> /dev/null; then
|
||||||
echo "Oauth2 app already exists, updating not yet implemented"
|
id="$(gitea "--config=$config" admin auth list | grep "Kanidm" | cut -d$'\t' -f1)"
|
||||||
exit 0
|
gitea "--config=$config" admin auth update-oauth \
|
||||||
|
--id "$id" \
|
||||||
|
"''${options[@]}"
|
||||||
else
|
else
|
||||||
gitea "--config=$config" admin auth add-oauth \
|
gitea "--config=$config" admin auth add-oauth \
|
||||||
--name "Kanidm" \
|
"''${options[@]}"
|
||||||
--key "forgejo" \
|
|
||||||
--secret "$secret" \
|
|
||||||
--auto-discover-url https://login.kaareskovgaard.net/oauth2/openid/forgejo/.well-known/openid-configuration \
|
|
||||||
--scopes "email profile" \
|
|
||||||
--skip-local-2fa \
|
|
||||||
--provider openidConnect \
|
|
||||||
--group-claim-name groups \
|
|
||||||
--admin-group admin \
|
|
||||||
--group-team-map-removal \
|
|
||||||
--group-team-map '{"nix": ["nix"], "actions": ["actons"]}'
|
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
|
@ -79,6 +79,10 @@ in
|
||||||
present = true;
|
present = true;
|
||||||
members = [ "khs" ];
|
members = [ "khs" ];
|
||||||
};
|
};
|
||||||
|
groups.forgejo_admin = {
|
||||||
|
present = true;
|
||||||
|
members = [ "khs" ];
|
||||||
|
};
|
||||||
# We cannot add oauth2 apps before the secrets for them are generated.
|
# We cannot add oauth2 apps before the secrets for them are generated.
|
||||||
systems.oauth2 = lib.mkIf (!bootstrapping) {
|
systems.oauth2 = lib.mkIf (!bootstrapping) {
|
||||||
openbao = {
|
openbao = {
|
||||||
|
@ -167,6 +171,9 @@ in
|
||||||
"forgejo_comitter" = [
|
"forgejo_comitter" = [
|
||||||
"comitter"
|
"comitter"
|
||||||
];
|
];
|
||||||
|
"forgejo_admin" = [
|
||||||
|
"admin"
|
||||||
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue