Last active
August 29, 2015 14:01
-
-
Save JrCs/4bd6e77d25ff02e6a305 to your computer and use it in GitHub Desktop.
Check that svn is configured for using gnome-keyring
This file contains 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
#!/usr/bin/bash | |
# | |
# This script can be called directly with: | |
# bash < <(curl -sS "https://gist.githubusercontent.com/JrCs/4bd6e77d25ff02e6a305/raw/check-svn-config-gnome-keyring.sh") | |
# | |
CALL=$(basename $0) | |
[[ -z "$HOME" ]] && HOME=~ | |
SVN_DIR=$HOME/.subversion | |
SVN_CONFIG=$SVN_DIR/config | |
SVN_SERVERS=$SVN_DIR/servers | |
SVN_AUTH=$SVN_DIR/auth | |
warning=0 | |
if [[ -f $SVN_CONFIG ]]; then | |
[[ $(grep -cE '^password-stores\s*=.*gnome-keyring' $SVN_CONFIG) -eq 0 ]] && | |
echo "Warning: you must set 'password-stores = gnome-keyring' in $SVN_CONFIG" >&2 && | |
((warning++)) | |
fi | |
if [[ -f $SVN_SERVERS ]]; then | |
[[ $(grep -cE '^store-passwords\s*=\s*yes' $SVN_SERVERS) -eq 0 ]] && | |
echo "Warning: you must set 'store-passwords = yes' in $SVN_SERVERS" >&2 && | |
((warning++)) | |
[[ $(grep -cE '^store-plaintext-passwords\s*=\s*no' $SVN_SERVERS) -eq 0 ]] && | |
echo "Warning: you must set 'store-plaintext-passwords = no' in $SVN_SERVERS" >&2 && | |
((warning++)) | |
fi | |
# | |
# Check there are no plaintext passwords in the Subversion auth cache | |
# | |
for file in $SVN_AUTH/svn.simple/*; do | |
[[ ! -f $file ]] && continue | |
[[ $(grep -c ^simple $file) -gt 0 ]] && | |
echo "Warning: $file contains a plaintext password, you should delete this file" >&2 && | |
((warning++)) | |
done | |
[[ "$warning" -eq 0 ]] && echo "All is good !" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment