Last active
November 4, 2017 07:23
-
-
Save fionn/f908c315298960589c6cb07b7c06383f to your computer and use it in GitHub Desktop.
Add a credential file to OpenVPN configurations
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
#/bin/bash | |
if [ $(id -u) != 0 ]; then | |
echo "You must be root" | |
sudo "$0" "$@" | |
exit $? | |
fi | |
for file in $@; do | |
sed -i "s|^auth-user-pass$|& /etc/openvpn/client/provider/secret.password|" $file | |
if [[ $? -ne 0 ]]; then | |
exit $? | |
fi | |
done | |
exit $? |
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
#!/bin/bash | |
if [ $(id -u) != 0 ]; then | |
echo "You must be root" | |
sudo "$0" "$@" | |
exit $? | |
fi | |
resolv_path=/etc/openvpn/client/update-resolv-conf.sh | |
for file in $@; do | |
echo "script-security 2" >> $file | |
echo "up $resolv_path" >> $file | |
echo "down $resolv_path" >> $file | |
if [[ $? -ne 0 ]]; then | |
exit $? | |
fi | |
done | |
exit $? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment