diff --git a/SwarselSystems.org b/SwarselSystems.org
index 41a67b2..0147772 100644
--- a/SwarselSystems.org
+++ b/SwarselSystems.org
@@ -7221,6 +7221,8 @@ Here I am forcing =startWhenNeeded= to false so that the value will not be set t
ScanSchedule = "@every 24h";
MPVPath = "${pkgs.mpv}/bin/mpv";
MPVCommandTemplate = "mpv --audio-device=%d --no-audio-display --pause %f";
+ ReverseProxyWhitelist = "0.0.0.0/0";
+ ReverseProxyUserHeader = "X-User";
Jukebox = {
Enabled = true;
Default = "default";
@@ -7253,6 +7255,23 @@ Here I am forcing =startWhenNeeded= to false so that the value will not be set t
proxyPass = "http://localhost:4040";
proxyWebsockets = true;
extraConfig = ''
+ auth_request /oauth2/auth;
+ error_page 401 = /oauth2/sign_in;
+
+ # pass information via X-User and X-Email headers to backend,
+ # requires running with --set-xauthrequest flag (done by NixOS)
+ auth_request_set $user $upstream_http_x_auth_request_user;
+ auth_request_set $email $upstream_http_x_auth_request_email;
+ proxy_set_header X-User $user;
+ proxy_set_header X-Email $email;
+
+ # if you enabled --pass-access-token, this will pass the token to the backend
+ auth_request_set $token $upstream_http_x_auth_request_access_token;
+ proxy_set_header X-Access-Token $token;
+
+ # if you enabled --cookie-refresh, this is needed for it to work with auth_request
+ auth_request_set $auth_cookie $upstream_http_set_cookie;
+ add_header Set-Cookie $auth_cookie;
proxy_redirect http:// https://;
proxy_read_timeout 600s;
proxy_send_timeout 600s;
@@ -7261,6 +7280,52 @@ Here I am forcing =startWhenNeeded= to false so that the value will not be set t
client_max_body_size 0;
'';
};
+ "/oauth2/" = {
+ proxyPass = "http://oauth2-proxy";
+ extraConfig = ''
+ proxy_set_header X-Scheme $scheme;
+ proxy_set_header X-Auth-Request-Redirect $scheme://$host$request_uri;
+ '';
+ };
+ "= /oauth2/auth" = {
+ proxyPass = "http://oauth2-proxy/oauth2/auth";
+ extraConfig = ''
+ internal;
+
+ proxy_set_header X-Scheme $scheme;
+ # nginx auth_request includes headers but not body
+ proxy_set_header Content-Length "";
+ proxy_pass_request_body off;
+ '';
+ };
+ "/share" = {
+ proxyPass = "http://localhost:4040";
+ proxyWebsockets = true;
+ extraConfig = ''
+ proxy_redirect http:// https://;
+ proxy_read_timeout 600s;
+ proxy_send_timeout 600s;
+ proxy_buffering off;
+ proxy_request_buffering off;
+ client_max_body_size 0;
+ proxy_set_header X-User "";
+ proxy_set_header X-Email "";
+ '';
+ };
+ "/rest" = {
+ proxyPass = "http://localhost:4040";
+ proxyWebsockets = true;
+ extraConfig = ''
+ proxy_redirect http:// https://;
+ proxy_read_timeout 600s;
+ proxy_send_timeout 600s;
+ proxy_buffering off;
+ proxy_request_buffering off;
+ client_max_body_size 0;
+ proxy_set_header X-User "";
+ proxy_set_header X-Email "";
+ '';
+ };
};
};
};
@@ -8601,6 +8666,8 @@ It serves both a Greader API at https://signpost.swarsel.win/api/greader.php, as
I am using this with CapyReader on my phone, set it up as a FreshRSS account with Server URL =https://signpost.swarsel.win/api/greader.php
+FreshRSS claims to support HTTP header auth, but at least it does not work with my oauth2-proxy setup. Until this is fixed, I resorted to the "form" login, since I mostly do not use the web version anyways.
+
#+begin_src nix :tangle modules/nixos/server/freshrss.nix
{ lib, config, ... }:
{
@@ -9009,24 +9076,9 @@ To get other URLs (token, etc.), use https://
-This file has 66782 words spanning 17613 lines and was last revised on 2025-06-13 02:34:40 +0200.
+This file has 67098 words spanning 17669 lines and was last revised on 2025-06-13 03:31:20 +0200.
@@ -772,7 +772,7 @@ This section defines my Emacs configuration. For a while, I considered to use ry
-My emacs is built using the emacs-overlay nix flake, which builds a bleeding edge emacs on wayland (pgtk) with utilities like treesitter support. By executing the below source block, the current build setting can be updated at any time, and you can see my most up-to-date build options (last updated: 2025-06-13 02:34:40 +0200)
+My emacs is built using the emacs-overlay nix flake, which builds a bleeding edge emacs on wayland (pgtk) with utilities like treesitter support. By executing the below source block, the current build setting can be updated at any time, and you can see my most up-to-date build options (last updated: 2025-06-13 03:31:20 +0200)
-
@@ -719,7 +719,7 @@
WLR_RENDERER_ALLOW_SOFTWARE=1 to allow this configuration to run in a virtualized environment. I also enable qemuGuest for a smoother experience when testing on QEMU.
{ self, inputs, config, pkgs, lib, primaryUser, ... }:
@@ -2988,8 +2988,8 @@ in
_: @@ -2999,8 +2999,8 @@ in
_:
@@ -4781,8 +4781,8 @@ appimageTools.wrapType2 {
# heavily inspired from https://github.com/oddlama/nix-config/blob/d42cbde676001a7ad8a3cace156e050933a4dcc3/pkgs/deploy.nix
@@ -4913,8 +4913,8 @@ writeShellApplication {
This programs simply runs ssh-keygen on the last host that I tried to ssh into. I need this frequently when working with cloud-init usually. @@ -5071,8 +5071,8 @@ in
{ lib, config, ... }:
@@ -5142,8 +5142,8 @@ in
{ lib, config, ... }:
@@ -5205,8 +5205,8 @@ in
{ lib, config, ... }:
@@ -5238,8 +5238,8 @@ in
{ lib, config, ... }:
@@ -5260,8 +5260,8 @@ in
{ lib, config, ... }:
@@ -5282,8 +5282,8 @@ in
{ lib, config, ... }:
@@ -5304,8 +5304,8 @@ in
{ lib, config, ... }:
@@ -5326,8 +5326,8 @@ in
{ lib, config, ... }:
@@ -5348,8 +5348,8 @@ in
{ lib, config, ... }:
@@ -5370,8 +5370,8 @@ in
{ lib, config, ... }:
@@ -5424,8 +5424,8 @@ in
{ lib, config, ... }:
@@ -5481,8 +5481,8 @@ in
{ lib, config, ... }:
@@ -5539,8 +5539,8 @@ in
{ lib, config, ... }:
@@ -5592,8 +5592,8 @@ in
{ lib, config, ... }:
@@ -5613,8 +5613,8 @@ in
{ lib, config, ... }:
@@ -5634,8 +5634,8 @@ in
{ lib, config, ... }:
@@ -5656,8 +5656,8 @@ in
{ lib, config, ... }:
@@ -5675,8 +5675,8 @@ in
{ lib, config, ... }:
@@ -5916,12 +5916,12 @@ in
@@ -5956,8 +5956,8 @@ in
#!/usr/bin/env bash @@ -6936,8 +6936,8 @@ Setup timezone and locale. I want to use the US layout, but have the rest adapte
{ lib, ... }:
@@ -7025,8 +7025,8 @@ in
{ config, inputs, lib, ... }:
@@ -7418,8 +7418,8 @@ Most of the time I am using power-saver, however, it is good to be
{ lib, pkgs, config, ... }:
@@ -8547,6 +8547,8 @@ Here I am forcing startWhenNeeded to false so that the value will n
ScanSchedule = "@every 24h";
MPVPath = "${pkgs.mpv}/bin/mpv";
MPVCommandTemplate = "mpv --audio-device=%d --no-audio-display --pause %f";
+ ReverseProxyWhitelist = "0.0.0.0/0";
+ ReverseProxyUserHeader = "X-User";
Jukebox = {
Enabled = true;
Default = "default";
@@ -8579,6 +8581,23 @@ Here I am forcing startWhenNeeded to false so that the value will n
proxyPass = "http://localhost:4040";
proxyWebsockets = true;
extraConfig = ''
+ auth_request /oauth2/auth;
+ error_page 401 = /oauth2/sign_in;
+
+ # pass information via X-User and X-Email headers to backend,
+ # requires running with --set-xauthrequest flag (done by NixOS)
+ auth_request_set $user $upstream_http_x_auth_request_user;
+ auth_request_set $email $upstream_http_x_auth_request_email;
+ proxy_set_header X-User $user;
+ proxy_set_header X-Email $email;
+
+ # if you enabled --pass-access-token, this will pass the token to the backend
+ auth_request_set $token $upstream_http_x_auth_request_access_token;
+ proxy_set_header X-Access-Token $token;
+
+ # if you enabled --cookie-refresh, this is needed for it to work with auth_request
+ auth_request_set $auth_cookie $upstream_http_set_cookie;
+ add_header Set-Cookie $auth_cookie;
proxy_redirect http:// https://;
proxy_read_timeout 600s;
proxy_send_timeout 600s;
@@ -8587,6 +8606,52 @@ Here I am forcing startWhenNeeded to false so that the value will n
client_max_body_size 0;
'';
};
+ "/oauth2/" = {
+ proxyPass = "http://oauth2-proxy";
+ extraConfig = ''
+ proxy_set_header X-Scheme $scheme;
+ proxy_set_header X-Auth-Request-Redirect $scheme://$host$request_uri;
+ '';
+ };
+ "= /oauth2/auth" = {
+ proxyPass = "http://oauth2-proxy/oauth2/auth";
+ extraConfig = ''
+ internal;
+
+ proxy_set_header X-Scheme $scheme;
+ # nginx auth_request includes headers but not body
+ proxy_set_header Content-Length "";
+ proxy_pass_request_body off;
+ '';
+ };
+ "/share" = {
+ proxyPass = "http://localhost:4040";
+ proxyWebsockets = true;
+ extraConfig = ''
+ proxy_redirect http:// https://;
+ proxy_read_timeout 600s;
+ proxy_send_timeout 600s;
+ proxy_buffering off;
+ proxy_request_buffering off;
+ client_max_body_size 0;
+ proxy_set_header X-User "";
+ proxy_set_header X-Email "";
+ '';
+ };
+ "/rest" = {
+ proxyPass = "http://localhost:4040";
+ proxyWebsockets = true;
+ extraConfig = ''
+ proxy_redirect http:// https://;
+ proxy_read_timeout 600s;
+ proxy_send_timeout 600s;
+ proxy_buffering off;
+ proxy_request_buffering off;
+ client_max_body_size 0;
+ proxy_set_header X-User "";
+ proxy_set_header X-Email "";
+ '';
+ };
};
};
};
@@ -9945,6 +10010,10 @@ It serves both a Greader API at https://signpost.swarsel.win/api/greader.php
+
+FreshRSS claims to support HTTP header auth, but at least it does not work with my oauth2-proxy setup. Until this is fixed, I resorted to the "form" login, since I mostly do not use the web version anyways.
+
+
{ lib, config, ... }:
{
@@ -9990,7 +10059,7 @@ I am using this with CapyReader on my phone, set it up as a FreshRSS account wit
enable = true;
virtualHost = "signpost.swarsel.win";
baseUrl = "https://signpost.swarsel.win";
- authType = "none";
+ authType = "form";
dataDir = "/Vault/data/tt-rss";
defaultUser = "Swarsel";
passwordFile = config.sops.secrets.fresh.path;
@@ -10014,11 +10083,15 @@ I am using this with CapyReader on my phone, set it up as a FreshRSS account wit
# pass information via X-User and X-Email headers to backend,
# requires running with --set-xauthrequest flag (done by NixOS)
- auth_request_set $user $upstream_http_x_auth_request_preferred_username;
- # Set the email to our own domain in case user change their mail
- auth_request_set $email "''${upstream_http_x_auth_request_preferred_username}@swarsel.win";
+ auth_request_set $user $upstream_http_x_auth_request_user;
+ auth_request_set $email $upstream_http_x_auth_request_email;
proxy_set_header X-User $user;
proxy_set_header X-Email $email;
+ proxy_set_header Remote-User $user;
+
+ # if you enabled --pass-access-token, this will pass the token to the backend
+ auth_request_set $token $upstream_http_x_auth_request_access_token;
+ proxy_set_header X-Access-Token $token;
# if you enabled --cookie-refresh, this is needed for it to work with auth_request
auth_request_set $auth_cookie $upstream_http_set_cookie;
@@ -10255,8 +10328,8 @@ in
The forgejo configuration is a little broken and will show a 500 error when signing in through kanidm. However, when pressing back and refreshing the page, I am logged in. Currently I cannot be bothered to fix this. @@ -10358,24 +10431,9 @@ in "freshrss.access" = { }; "firefly.access" = { }; }; - persons = { - swarsel = { - present = true; - mailAddresses = [ "leon@swarsel.win" ]; - legalName = "Leon Schwarzäugl"; - groups = [ - "immich.access" - "paperless.access" - "grafana.access" - "forgejo.access" - "nextcloud.access" - "freshrss.access" - "navidrome.access" - "firefly.access" - ]; - displayName = "Swarsel"; - }; - }; + + inherit (config.repo.secrets.local) persons; + systems = { oauth2 = { immich = { @@ -10613,8 +10671,8 @@ in
{ lib, config, ... }:
@@ -10939,8 +10997,8 @@ This smashes Atmosphere 1.3.2 on the switch, which is what I am currenty using.
This holds configuration that is specific to framework laptops. @@ -10978,8 +11036,8 @@ This holds configuration that is specific to framework laptops.
{ lib, config, ... }:
@@ -10995,8 +11053,8 @@ This holds configuration that is specific to framework laptops.
{ lib, config, ... }:
@@ -11018,8 +11076,8 @@ This holds configuration that is specific to framework laptops.
{ lib, config, ... }:
@@ -11050,8 +11108,8 @@ This holds configuration that is specific to framework laptops.
{ lib, config, ... }:
@@ -13989,8 +14047,8 @@ The `extraConfig` section here CANNOT be reindented. This has something to do wi
{ lib, config, ... }:
@@ -15236,8 +15294,8 @@ in
This holds configuration that is specific to framework laptops. @@ -19077,8 +19135,8 @@ autocmd DocStart vc-impimba-1.m.imp.ac.at/ui/webconsole mode ignore
@@ -19575,7 +19633,7 @@ sync USER HOST: