Repository navigation
Strip password keyring auth from sddm-autologin too #10396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
calledtoconstruct
wants to merge
2
commits into
omacom:quattro
Choose a base branch
from
calledtoconstruct:fix/sddm-autologin-keyring
base: quattro
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| echo "Strip password keyring auth from the SDDM autologin PAM stack" | ||
|
|
||
| # Autologin uses /etc/pam.d/sddm-autologin, not sddm. Existing installs that | ||
| # already ran install/login/sddm.sh still have gnome-keyring auth/password | ||
| # modules on the autologin stack, which create an encrypted login keyring | ||
| # against Omarchy's passwordless default. | ||
|
|
||
| pam=/etc/pam.d/sddm-autologin | ||
| [[ -f $pam ]] || exit 0 | ||
|
|
||
| if ! grep -qE -- '-auth.*pam_gnome_keyring\.so|-password.*pam_gnome_keyring\.so' "$pam"; then | ||
| exit 0 | ||
| fi | ||
|
|
||
| if (( EUID == 0 )); then | ||
| sed -i '/-auth.*pam_gnome_keyring\.so/d' "$pam" | ||
| sed -i '/-password.*pam_gnome_keyring\.so/d' "$pam" | ||
| else | ||
| sudo sed -i '/-auth.*pam_gnome_keyring\.so/d' "$pam" | ||
| sudo sed -i '/-password.*pam_gnome_keyring\.so/d' "$pam" | ||
| fi |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh" | ||
|
|
||
| script="$ROOT/install/login/sddm.sh" | ||
| shipped_migration="$ROOT/migrations/1788600002.sh" | ||
|
|
||
| grep -q 'sddm-autologin' "$script" || | ||
| fail "SDDM keyring strip covers the autologin PAM stack" | ||
| grep -q "/etc/pam.d/sddm-autologin" "$script" || | ||
| fail "SDDM keyring strip names the autologin PAM file" | ||
| [[ -f $shipped_migration ]] || fail "existing installs get an autologin keyring migration" | ||
| [[ $(head -n 1 "$shipped_migration") == echo* ]] || | ||
| fail "autologin keyring migration starts with an echo" | ||
| ! grep -q '^#!' "$shipped_migration" || fail "autologin keyring migration has no shebang" | ||
| grep -Fxq 'pam=/etc/pam.d/sddm-autologin' "$shipped_migration" || | ||
| fail "the production autologin PAM path is a fixed literal" | ||
| if grep -q 'OMARCHY_.*PAM' "$shipped_migration"; then | ||
| fail "the migration does not accept caller-controlled privileged paths" | ||
| fi | ||
| pass "SDDM keyring strip covers password and autologin stacks" | ||
|
|
||
| test_dir=$(mktemp -d) | ||
| trap 'rm -rf "$test_dir"' EXIT | ||
| mkdir -p "$test_dir/bin" | ||
| pam="$test_dir/sddm-autologin" | ||
| calls="$test_dir/calls" | ||
|
|
||
| cat >"$test_dir/bin/sudo" <<'STUB' | ||
| #!/bin/bash | ||
| printf 'sudo %s\n' "$*" >>"${CALLS:?}" | ||
| exec "$@" | ||
| STUB | ||
| chmod +x "$test_dir/bin/sudo" | ||
|
|
||
| sed "s|^pam=/etc/pam.d/sddm-autologin$|pam=$pam|" "$shipped_migration" >"$test_dir/migration.sh" | ||
|
|
||
| cat >"$pam" <<'PAM' | ||
| #%PAM-1.0 | ||
| auth required pam_permit.so | ||
| -auth optional pam_gnome_keyring.so | ||
| account include system-local-login | ||
| password include system-local-login | ||
| -password optional pam_gnome_keyring.so use_authtok | ||
| -session optional pam_gnome_keyring.so auto_start | ||
| session include system-local-login | ||
| PAM | ||
|
|
||
| : >"$calls" | ||
| CALLS="$calls" PATH="$test_dir/bin:$PATH" bash -euo pipefail "$test_dir/migration.sh" >/dev/null | ||
|
|
||
| grep -q 'pam_permit.so' "$pam" || fail "keyring strip keeps required autologin auth" | ||
| grep -q 'pam_gnome_keyring.so auto_start' "$pam" || | ||
| fail "keyring strip keeps session keyring auto_start" | ||
| if grep -qE -- '-auth.*pam_gnome_keyring\.so|-password.*pam_gnome_keyring\.so' "$pam"; then | ||
| fail "keyring strip removes autologin auth and password gnome-keyring modules" | ||
| fi | ||
| grep -q '^sudo sed' "$calls" || fail "non-root migration elevates with sudo" | ||
|
greptile-apps[bot] marked this conversation as resolved.
Resolved
|
||
| pass "keyring strip removes autologin auth and password gnome-keyring modules" | ||
|
|
||
| : >"$calls" | ||
| CALLS="$calls" PATH="$test_dir/bin:$PATH" bash -euo pipefail "$test_dir/migration.sh" >/dev/null | ||
| [[ ! -s $calls ]] || fail "an already-stripped autologin stack is a no-op" "$(<"$calls")" | ||
| pass "an already-stripped autologin stack is a no-op" | ||
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.
Uh oh!
There was an error while loading. Please reload this page.