Skip to content

Instantly share code, notes, and snippets.

@bartvm
Last active September 8, 2017 03:42
Show Gist options
  • Save bartvm/936860ac2955348190d6 to your computer and use it in GitHub Desktop.
Save bartvm/936860ac2955348190d6 to your computer and use it in GitHub Desktop.
cd openvpn
connections=(*.ovpn)
i=1
for filename in "${connections[@]}"; do
extension="${filename##*.}"
base="${filename%.*}"
printf -v j "%02d" $((i+10))
mkdir "$j"
cp crl.rsa.2048.pem "$j/crl.rsa.2048.pem"
cp ca.rsa.2048.crt "$j/ca.rsa.2048.crt"
echo "#viscosity name $base" > "$j/config.conf"
echo -n "\"$base\", "
cat "$filename" >> "$j/config.conf"
rm "$filename"
i=$((i+1))
done
rm crl.rsa.2048.pem
rm ca.rsa.2048.crt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment