feat(homeserver): Authelia で SSO を入れる - #550
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
なぜ Authentik ではないか
Authentik は設定をデータベースに持ち、Web UI のフローエディタで編集する。宣言できない。uptime-kuma を捨てた理由と同じ形 (監視リストが誰もレビューできない SQLite に入っていた) をもう一度作ることになる。
Authelia は設定が YAML 1 枚、ユーザーもファイル、秘密は
/var/lib/secretsの下で完結する。差分が git に出るし、まっさらな箱でも同じ形に戻る。何を front するか
sitesの表にauth = trueを足し、mkVhostがそれを見てforward_authを差す。掛けたのは 11 件だけ。掛けた:
dashsearchmoneyfilestubeesphomenoderedcomfytoolsstatusarchiveいずれも認証を一切持たず、tailnet の中にいることだけが境界だったもの。
money(fava) は「fava 自体はログインを持たないので、境界はここの vhost が tailnet アドレスにしか生えていないこと。外に出すなら認証を足すこと」とコメントに書いてあった通りのもので、filesは restic リポジトリの中身が見える。掛けなかったものと理由:
track(Dawarich が OwnTracks の POST を受ける)、obsidian(CouchDB LiveSync)、anki(同期プロトコル)、dav(CalDAV)、ntfy、cache(attic)、shell(atuin)、sync(Syncthing API)、dns2。ここに人間向けのログイン画面を挟むと、iPhone の位置ログもビルドキャッシュも通知も黙って止まるjellyfinnavidromegitpaperlessrssromsgames。前段にログイン画面を置くとアプリと git が壊れるvault(Vaultwarden) — 保管庫を SSO の後ろに置くと、SSO のパスワードを思い出せないときに保管庫が開けない循環になるhome(Home Assistant) — 独自認証とアプリ連携があるので、front させるならネイティブ OIDC で繋ぐほうcalpollsplit— cloudflared 経由なので Caddy を通らない。方針として対象外authvhost 自身には掛けていない。掛けると認証を求める先が自分になって永久に回る。二要素
two_factorを既定にした。tailnet にいることを本人性の根拠にしない、という判断 (tailnet に載る端末が増えるほどその前提は弱くなる)。緩めるならaccess_controlの policy をone_factorにする、1 箇所。確認
nix evalで生成された Caddy 設定を実際に見た。money/filesにはforward_auth 127.0.0.1:9092が付き、trackには付かず、auth自身にも付いていない。homeserver の toplevel も評価が通る。反映前に手作業が要る
/var/lib/secrets/authelia/に 4 つのファイルを置く必要がある (README の表に追記済み)。3 つはopenssl rand -hex 32、残りは argon2id ハッシュを持つユーザーファイル。これを置かずに切り替えると、対象の 11 件が全部開かなくなるので、置いてからデプロイすること。TOTP の登録リンクは SMTP が無いのでファイルに出る:
sudo cat /var/lib/authelia-main/notification.txt