mirror of
https://github.com/pivpn/pivpn.git
synced 2024-12-19 19:30:16 +00:00
/feature/add_tcp_option
Adding a correct tcp option
This commit is contained in:
parent
8f09ee9afd
commit
a7c9a35352
1 changed files with 54 additions and 17 deletions
39
auto_install/install.sh
Normal file → Executable file
39
auto_install/install.sh
Normal file → Executable file
|
@ -475,6 +475,34 @@ update_repo() {
|
|||
echo " done!"
|
||||
}
|
||||
|
||||
setCustomProto() {
|
||||
# Turn the available interfaces into an array so it can be used with a whiptail dialog
|
||||
protoArray=()
|
||||
|
||||
protoArray+=("udp" "available" "ON")
|
||||
protoArray+=("tcp" "available" "OFF")
|
||||
|
||||
# Find out how many interfaces are available to choose from
|
||||
chooseProtoCmd=(whiptail --separate-output --radiolist "Choose A Protocol" $r $c 2)
|
||||
echo "${chooseProtoCmd[@]}" "${protoArray[@]}"
|
||||
chooseProtoOptions=$("${chooseProtoCmd[@]}" "${protoArray[@]}" 2>&1 >/dev/tty)
|
||||
if [[ $? = 0 ]]; then
|
||||
for desiredProto in $chooseProtoOptions
|
||||
do
|
||||
pivpnProto=$desiredProto
|
||||
echo "::: Using protocol: $pivpnProto"
|
||||
echo "${pivpnProto}" > /tmp/pivpnPROTO
|
||||
done
|
||||
else
|
||||
echo "::: Cancel selected, exiting...."
|
||||
exit 1
|
||||
fi
|
||||
# write out the PROTO
|
||||
PROTO=$pivpnProto
|
||||
$SUDO cp /tmp/pivpnPROTO /etc/pivpn/INSTALL_PROTO
|
||||
}
|
||||
|
||||
|
||||
setCustomPort() {
|
||||
until [[ $PORTNumCorrect = True ]]
|
||||
do
|
||||
|
@ -735,6 +763,10 @@ confOpenVPN() {
|
|||
$SUDO sed -i "s/1194/${PORT}/g" /etc/openvpn/server.conf
|
||||
fi
|
||||
|
||||
if [ $PROTO != "udp" ]; then
|
||||
$SUDO sed -i "s/proto udp/proto tcp/g" /etc/openvpn/server.conf
|
||||
fi
|
||||
|
||||
# write out server certs to conf file
|
||||
$SUDO sed -i "s/\(key \/etc\/openvpn\/easy-rsa\/keys\/\).*/\1${SERVER_NAME}.key/" /etc/openvpn/server.conf
|
||||
$SUDO sed -i "s/\(cert \/etc\/openvpn\/easy-rsa\/keys\/\).*/\1${SERVER_NAME}.crt/" /etc/openvpn/server.conf
|
||||
|
@ -783,7 +815,7 @@ confNetwork() {
|
|||
$SUDO sed -i 's/IPv4dev/'$IPv4dev'/' /tmp/ufw_add.txt
|
||||
$SUDO sed -i "s/\(DEFAULT_FORWARD_POLICY=\).*/\1\"ACCEPT\"/" /etc/default/ufw
|
||||
$SUDO sed -i -e '/delete these required/r /tmp/ufw_add.txt' -e//N /etc/ufw/before.rules
|
||||
$SUDO ufw allow ${PORT}/udp
|
||||
$SUDO ufw allow ${PORT}/${PROTO}
|
||||
$SUDO ufw allow from 10.8.0.0/24
|
||||
$SUDO ufw reload
|
||||
echo "::: UFW configuration completed."
|
||||
|
@ -854,6 +886,10 @@ confOVPN() {
|
|||
$SUDO sed -i -e "s/1194/${PORT}/g" /etc/openvpn/easy-rsa/keys/Default.txt
|
||||
fi
|
||||
|
||||
if [ $PROTO != "udp" ]; then
|
||||
$SUDO sed -i -e "s/proto udp/proto tcp/g" /etc/openvpn/easy-rsa/keys/Default.txt
|
||||
fi
|
||||
|
||||
# verify server name to strengthen security
|
||||
$SUDO sed -i "s/SRVRNAME/${SERVER_NAME}/" /etc/openvpn/easy-rsa/keys/Default.txt
|
||||
|
||||
|
@ -868,6 +904,7 @@ installPiVPN() {
|
|||
$SUDO mkdir -p /etc/pivpn/
|
||||
getGitFiles
|
||||
installScripts
|
||||
setCustomProto
|
||||
setCustomPort
|
||||
confOpenVPN
|
||||
confNetwork
|
||||
|
|
Loading…
Reference in a new issue