Commit graph

49 commits

Author SHA1 Message Date
Maximilian Bosch
69fac057b2
update: 2025.8.3 -> 2025.8.4
ChangeLog: https://github.com/goauthentik/authentik/releases/tag/version%2F2025.8.4
2025-10-01 14:42:09 +02:00
Maximilian Bosch
0c6391c85e
module: also use non-conflicting ports for other outposts
Incidentally I had parts of that already in my private config and immediately
forgot. But now that we're at it, let's fix it up properly as well.
2025-09-17 10:44:09 +02:00
Maximilian Bosch
15d4d6f9fc
module: fmt 2025-09-17 10:44:08 +02:00
Maximilian Bosch
6a080328a3
module: override metrics & http address for worker
Closes #72

So, #72 is about a segfault in the LDAP outpost, but this is the actual
culprit[0]:

* Both server & worker share the same configuration in this setup.

* Since 2025.8 this means that both try to start a server for metrics at
  port 9300 and an HTTP server (in the worker case for healthchecks) at
  port 9000.

* On upgrades, migrations are performed. Only the server waited for the
  migrations to finish, hence the worker started up earlier. As a
  result, it was quicker in binding port 9000 in ONLY this case (and
  thus, this was never reproducible on a second attempt!). Now, on port
  9000 was NOT the authentik server, but something that returned an
  empty response for everything that's not the healthcheck.

* As a result, the LDAP outpost got a response from what it believed was
  authentik, but actually `nil, nil` because of the empty response.
  Trying to dereference values from that response[1] caused the
  segfault.

The fix is pretty easy, just override the listen ports via the
environment. Unfortunately, the docs[2] are apparently not entirely correct[3],
given the Python code it must be LISTEN__LISTEN_HTTP[4]. I added a
test-case to ensure that the config is properly applied.

[0] Reported as https://github.com/goauthentik/authentik/issues/16850
[1] 57e12cef06/internal/outpost/ak/api.go (L95)
[2] https://docs.goauthentik.io/install-config/configuration/#listen-settings
[3] Reported as https://github.com/goauthentik/authentik/issues/16851
[4] 57e12cef06/authentik/lib/config.py (L238)
2025-09-17 10:43:50 +02:00
Maximilian Bosch
1c79d48248
module: run migrations before attempting to start worker
`manage.py` attempts migrations on its own[1], so try let's try to
prevent another potential for races.

[1] https://github.com/goauthentik/authentik/blob/version/2025.8.3/manage.py#L17-L24
2025-09-17 10:12:38 +02:00
Maximilian Bosch
039fcdfd00
module: replace requiredBy with inverse requires
IMHO that way it's easier to reason about what relationship exists here.
2025-09-16 11:32:11 +02:00
Maximilian Bosch
04db807ac0
Merge pull request #35 from SuperSandro2000/patch-1
Fix indentation of markdown code blocks
2025-09-12 13:35:06 +02:00
Maximilian Bosch
cfa634fd2d
Merge pull request #70 from nix-community/authentik-2025.8
update: 2025.6.4 -> 2025.8.1
2025-09-05 10:49:56 +02:00
Maximilian Bosch
6dc84faaec
update: 2025.6.4 -> 2025.8.1
See https://next.goauthentik.io/releases/2025.8/
ChangeLog: https://next.goauthentik.io/releases/2025.8/#fixed-in-202581

The following things changed:

* We're blocked on going to NodeJS 24.x (which is the version upstream
  uses) because it breaks with napalm[1].

* The worker has been switched from celery to dramatiq. An automatic
  migration of the tasks doesn't exist, the operator must make sure to
  stop the server and let the queue drain[2].

  While this eliminates the need of Redis for Celery, the tests fails
  without Redis. After inspecting the code, it looks like it's still
  needed for e.g. session management.

[1] https://github.com/npm/cli/issues/8541
[2] https://next.goauthentik.io/releases/2025.8/#fixed-in-202581
2025-08-30 12:34:10 +02:00
Quentin Smith
940f49870b
module: support additional properties in "ak"
This changes the "ak" script to contain all properties from the
authentik.service unit except the Exec* and Restart* properties. This allows the
script to work when the user has added additional properties to the unit (e.g.
the `SupplementaryGroups` property to connect to Redis over a Unix socket).
2025-08-26 17:24:35 -04:00
Geoffrey “Frogeye” Preud'homme
794eb56bac
module: add basic proxy outpost service 2025-05-01 18:46:01 +02:00
Maximilian Bosch
e9bde1ace0
module: prohibit store-paths for environmentFile
The store is world-readable, so secrets shouldn't end up there in the
first place. On top, `types.path` has the following behavior:

* `toString foo` returns the absolute path
* `${foo}` copies the path silently into the store and returns the
  store-path.

This happens without any real feedback, so this can be caused by an
innocent looking change.

To address this problem, `pathsWith` was introduced into <nixpkgs/lib>
which allows absolute paths represented as string, but rejects things
pointing to the store and path literals which may be copied later on.
2025-04-28 13:52:51 +02:00
WilliButz
dbfc2207df
treewide: nixfmt 2025-02-02 14:25:09 +01:00
Marcel
9107922274
doc: remove mdDoc 2024-12-06 10:22:51 +01:00
Sandro
858735116a
Fix indentation of markdown code blocks 2024-10-28 00:23:50 +01:00
WilliButz
0932385a36
module: restart services on-failure 2024-09-08 17:12:43 +02:00
Maximilian Bosch
d4c45b01f2
module: fix media root config
Was changed within upstream commit abc0c2d2a2a0bfb0214798ed6bca9d59359b39f8.

The sole reason this worked was that `settings.storage.media.file.path`
pointed to `./media`, relative to `/var/lib/authentik`.

Update our config accordingly.
2024-06-02 17:40:27 +02:00
WilliButz
47e376250e
module: increase priority for posgresql package default
This gives the default value from this module a slightly higher
priority than the upstream module's default, while still allowing users
to simply set `services.postgresql.package` using the default priority.

The change in 8bc790171f introduced
`mkDefault` for the postgresql package.
Unfortunately the upstream package option default is also specified
using `mkDefault` instead of the more appropriate `mkOptionDefault`.

This meant that users with a `system.stateVersion` other than `22.05`,
`22.11` or `23.05` got an evaluation error because there are two
conflicting definitions for the package option.
2024-05-02 18:27:53 +02:00
WilliButz
965f4d4012
module: drop default settings for airgapped mode
These settings were originally taken from
https://docs.goauthentik.io/docs/installation/air-gapped
but I think they should be configured by users themselves rather than
being enforced by this module.

Notes:
* error reporting is already disabled by default
* the update check setting obviously didn't do anthing as the update
  check was always running
* "startup analytics" currently refers to a post request[1] to upstream authentik,
  that includes the running version and a SHA-512 digest of the unique
  installation id and an env string that refers to the environment in which
  authentik is running, that should be "custom"[2] for NixOS.

[1]: https://github.com/goauthentik/authentik/blob/version/2024.4.1/lifecycle/gunicorn.conf.py#L122-L137
[2]: https://github.com/goauthentik/authentik/blob/version/2024.4.1/authentik/lib/utils/reflection.py#L52-L64
2024-04-28 14:18:53 +02:00
WilliButz
876db63217
module: don't set services.postgresql.package for new installations 2024-04-28 14:18:53 +02:00
Quentin Smith
8bc790171f
module: don't force Postgres 14 2024-04-28 13:13:42 +02:00
Quentin Smith
c178d820d7
module: use TZ environment variable to set UTC timezone instead of overriding system zone 2024-04-28 13:13:26 +02:00
WilliButz
608c5dd4f5
update: 2024.2.3 -> 2024.4.1
Release notes: https://docs.goauthentik.io/docs/releases/2024.4

Notable dependency updates:
python 3.11 -> python 3.12
golang 1.21 -> golang 1.22
nixpkgs-23.11 -> nixpkgs-unstable (for golang 1.22 until 24.05)

Introduces patch to `web/package-lock.json`, see `components/frontend.nix`,
this will cause IFD until the issue is resolved.
https://nixos.org/manual/nix/stable/language/import-from-derivation

Flake lock file updates:

• Updated input 'authentik-src':
    'github:goauthentik/authentik/6bb180f94ec124092c4f87ae5f5d892a70b32ff3' (2024-04-17)
  → 'github:goauthentik/authentik/ca70c963e55daf73b479a4513da06ac5cea77718' (2024-04-26)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/53a2c32bc66f5ae41a28d7a9a49d321172af621e' (2024-04-15)
  → 'github:NixOS/nixpkgs/6143fc5eeb9c4f00163267708e26191d1e918932' (2024-04-21)
• Updated input 'poetry2nix':
    'github:nix-community/poetry2nix/3c92540611f42d3fb2d0d084a6c694cd6544b609' (2024-02-22)
  → 'github:nix-community/poetry2nix/9245811b58905453033f1ef551f516cbee71c42c' (2024-04-26)
2024-04-27 20:59:27 +02:00
Marcel
29c944aece
fixed broken online dependencies 2024-04-06 21:51:16 +02:00
Maximilian Bosch
2da27254c1
module: add ak script
This was made possible by d85dacb6c2
which allows to directly use `manage.py`. That script is
effectively used whenever the `ak` command is referenced in the docs,
e.g. to set a new password for the superuser or to send a test email.

This needs to run as the same (dynamic) user and with the same env file,
otherwise `manage.py` exits early. To achieve that, I
decided to use `systemd-run(1)` because now the invocation can be
configured the same way as services are.
2024-02-26 09:32:48 +01:00
WilliButz
189ab274f5
Merge pull request #17 from MarcelCoding/radius
Added radius outpost
2024-02-22 15:01:51 +01:00
WilliButz
d060292aa6
add patch to fix failing "tenant_files" migration
The new migration in tenant_files.py references a MEDIA_ROOT directory
based on its own path, which in our case is in the read-only /nix/store.

We need it to refer to the actual authentik state directory instead,
which defaults to /var/lib/authentik/media in module.nix
2024-02-21 22:12:02 +01:00
WilliButz
d85dacb6c2
components: drop celery, package manage.py instead 2024-02-21 22:12:02 +01:00
Marcel
52b831735c
Added radius outpost 2024-02-14 22:00:58 +01:00
Marcel
347066b2ca
Made postgres optional 2024-01-31 10:26:11 +01:00
WilliButz
3904e3d29b
module: remove restartTriggers from ldap outpost service
Fixes #15

Before this change it was non-trivial to deploy the ldap outpost without
also activating the main authentik service on the same host. Adding
functionality to provide a separate configuration file for the outpost
service remains an open task.
2024-01-28 21:15:41 +01:00
shokinn
4dd485a366 Add dependency to network-online.target for authentik-ldap.service 2024-01-28 00:42:02 +01:00
shokinn
3bf78b1126 Add dependency to network-online.target for authentik.service 2024-01-24 18:42:16 +01:00
Alexander Sieg
8e23ad0cef
enable media uploads
The media upload feature is build around being deployed in a container
and only enables uploads when `/media` is a mountpoint. This isn't the
case on nixos and as such media uploads are disable.

In order to enable this, we need to patch authentik so that the
`can_save_media` capability is enabled.
2024-01-15 17:10:22 +01:00
WilliButz
1d2fe8bd1e
Merge pull request #9 from Ma27/restart-ldap-outpost
authentik-ldap: restart on failure
2024-01-03 20:06:33 +01:00
Maximilian Bosch
7c6103be81
authentik-ldap: restart on failure
I'm occasionally seeing the following error:

    Jan 01 22:02:10 auth ldap[151813]: fatal error: concurrent map writes
    Jan 01 22:02:10 auth ldap[151813]: fatal error: concurrent map writes
    Jan 01 22:02:10 auth ldap[151813]: goroutine 4841 [running]:
    Jan 01 22:02:10 auth ldap[151813]: goauthentik.io/api/v3.(*Configuration).AddDefaultHeader(...)
    Jan 01 22:02:10 auth ldap[151813]:         goauthentik.io/api/v3@v3.2023101.1/configuration.go:120
    Jan 01 22:02:10 auth ldap[151813]: goauthentik.io/internal/outpost/ldap/search/direct.(*DirectSearcher).Search(0xc0002ba4f8, 0xc000510dd0)
    Jan 01 22:02:10 auth ldap[151813]:         goauthentik.io/internal/outpost/ldap/search/direct/direct.go:112 +0x65a
    [...]
    Jan 01 22:02:10 auth systemd[1]: authentik-ldap.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
    Jan 01 22:02:10 auth systemd[1]: authentik-ldap.service: Failed with result 'exit-code'.

Obviously, I need to find out what's up there. However, services
shouldn't just die on a crash, but restart in that case. If that happens
too often, StartLimitBurst/StartLimitIntervalSec ensure that the
(re)start attempt is aborted eventually.

This is especially problematic because Nextcloud tries to contact the
LDAP server on every single request for a sync which means that the
entire service is down when such a crash happens.
2024-01-03 12:52:42 +01:00
shokinn
47e0cb8e14 link static workdir deps to /run/authentik 2023-12-29 15:01:03 +01:00
WilliButz
07c6476fbf
module: make authentikComponents a simple attrset 2023-12-10 15:16:53 +01:00
WilliButz
8b05ebf200
module: drop unused recursiveUpdate 2023-12-10 15:16:53 +01:00
WilliButz
332d717766
module: update postgres config (ensurePermissions -> ensureDBOwnership)
see https://github.com/NixOS/nixpkgs/pull/266270
2023-12-10 15:16:41 +01:00
WilliButz
f7fa85cc1f
module: add nginx support with cert auto-discovery 2023-10-04 17:55:39 +02:00
WilliButz
251d78a7f2
module: provide option to specify EnvironmentFile for secrets
The systemd service module references the module's environmentFile in a
list to allow for merging with EnvironmentFiles injected elsewhere.
2023-10-04 14:47:29 +02:00
WilliButz
fcc7b2f997
module: authentik-ldap drop environment variables
This should be configured with a proper authentik hostname and a
matching certificate that can be validated with the system CA bundle.
2023-06-29 22:51:57 +02:00
WilliButz
62f7cce184
module: add basic ldap outpost service 2023-06-29 13:24:17 +02:00
WilliButz
360f4c7321
module: refactor as preparation for ldap-outpost 2023-06-28 17:12:36 +02:00
WilliButz
6830ada44a
refactor flake
* switched from flake-utils to flake-parts
* dropped the overlay and instead populate configurable options for all
required authentik components in the module
* `nixosModule.default` is now a top-level output following the flake spec,
instead of the previously incorrect system-specific definition
2023-06-28 16:39:23 +02:00
WilliButz
e079fe0719
module: restart services if global config file changes 2023-06-07 15:11:54 +02:00
WilliButz
3c661c5095
module: use postgres peer auth instead of password auth 2023-06-07 15:11:54 +02:00
WilliButz
4a424259e4
init flake with package, module and test 2023-06-02 16:17:47 +02:00