Skip to content

Instantly share code, notes, and snippets.

@esoel
Created November 8, 2023 11:39
Show Gist options
  • Save esoel/8a4d564981374737e00c70f34c2f6e77 to your computer and use it in GitHub Desktop.
Save esoel/8a4d564981374737e00c70f34c2f6e77 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
output_file=$(mktemp)
exec &> >(tee -a "$output_file")
file="/etc/pam.d/sudo"
pattern="auth sufficient pam_tid.so"
replacement="2i\\
auth sufficient pam_tid.so"
datecmd='date +%F_%H.%M.%S '
echo -n "$($datecmd)"
echo " running $0"
if ! grep -qF "$pattern" "$file"; then
/opt/local/bin/ssed -i "$replacement" "$file"
echo -n "$($datecmd)"
echo " $file updated"
fi
# send_notification "\`$(cat $output_file)\`"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>me.illogical.fingerprintsudo</string>
<key>ProgramArguments</key>
<array>
<string>/Users/enrico/bin/fingerprint_sudo_helper.sh</string>
</array>
<key>WatchPaths</key>
<array>
<string>/etc/pam.d/sudo</string>
</array>
<key>EnvironmentVariables</key>
<dict>
<key>TMPDIR</key>
<string>/var/tmp</string>
</dict>
<key>StandardOutPath</key>
<string>/var/log/me.illogical.fingerprintsudo.log</string>
<key>StandardErrorPath</key>
<string>/var/log/me.illogical.fingerprintsudo.log</string>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment