Created
August 6, 2020 17:57
-
-
Save mcprat/b81a9c35ec90f69e8b09e064cf47fc7c to your computer and use it in GitHub Desktop.
ASH shell Openwrt Openvpn .ovpn script
This file contains hidden or 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/sh | |
PKI_DIR=/etc/easy-rsa/pki | |
CRT_DIR=/etc/easy-rsa/pki/issued | |
KEY_DIR=/etc/easy-rsa/pki/private | |
OUTPUT_DIR=/etc/openvpn | |
BASE_CONFIG=/etc/openvpn/client.confbase | |
cat ${BASE_CONFIG} >> ${OUTPUT_DIR}/${1}.ovpn | |
echo -e '<ca>' | cat >> ${OUTPUT_DIR}/${1}.ovpn | |
cat ${PKI_DIR}/ca.crt >> ${OUTPUT_DIR}/${1}.ovpn | |
echo -e '</ca>\n<cert>' | cat >> ${OUTPUT_DIR}/${1}.ovpn | |
cat ${CRT_DIR}/${1}.crt >> ${OUTPUT_DIR}/${1}.ovpn | |
echo -e '</cert>\n<key>' | cat >> ${OUTPUT_DIR}/${1}.ovpn | |
cat ${KEY_DIR}/${1}.key >> ${OUTPUT_DIR}/${1}.ovpn | |
echo -e '</key>\n<tls-crypt>' | cat >> ${OUTPUT_DIR}/${1}.ovpn | |
cat ${PKI_DIR}/hmac.key >> ${OUTPUT_DIR}/${1}.ovpn | |
echo -e '</tls-crypt>' | cat >> ${OUTPUT_DIR}/${1}.ovpn |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment