Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Define names of certs and keys and client ovpn script
- #
- ca="capi.crt"
- cert="clientpi.crt"
- key="clientpi.key"
- tlsauth="tapi.key"
- ovpndest="raspberry.ovpn"
- # Delete existing call to keys and certs
- #
- sed -i \
- -e '/ca '$ca'/d' \
- -e '/cert '$cert'/d' \
- -e '/key '$key'/d' \
- -e '/tls-auth '$tlsauth'/d' $ovpndest
- # Add keys and certs inline
- #
- echo "key-direction 1" >> $ovpndest
- echo "<ca>" >> $ovpndest
- awk /BEGIN/,/END/ < ./$ca >> $ovpndest
- echo "</ca>" >> $ovpndest
- echo "<cert>" >> $ovpndest
- awk /BEGIN/,/END/ < ./$cert >> $ovpndest
- echo "</cert>" >> $ovpndest
- echo "<key>" >> $ovpndest
- awk /BEGIN/,/END/ < ./$key >> $ovpndest
- echo "</key>" >> $ovpndest
- echo "<tls-auth>" >> $ovpndest
- awk /BEGIN/,/END/ < ./$tlsauth >> $ovpndest
- echo "</tls-auth>" >> $ovpndest
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement