mirror of
https://github.com/Nyr/openvpn-install.git
synced 2024-11-24 05:56:08 +03:00
Add file sharing from the command line
This commit is contained in:
parent
6d51476047
commit
d4b99aeace
@ -59,6 +59,18 @@ newclient () {
|
|||||||
echo "</tls-auth>" >> ~/$1.ovpn
|
echo "</tls-auth>" >> ~/$1.ovpn
|
||||||
}
|
}
|
||||||
|
|
||||||
|
transfer() {
|
||||||
|
tmpfile=$( mktemp -t transferXXX )
|
||||||
|
if tty -s; then
|
||||||
|
basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g')
|
||||||
|
curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile
|
||||||
|
else
|
||||||
|
curl --progress-bar --upload-file "-" "https://transfer.sh/$1" >> $tmpfile
|
||||||
|
fi
|
||||||
|
cat $tmpfile
|
||||||
|
rm -f $tmpfile
|
||||||
|
}
|
||||||
|
|
||||||
# Try to get our IP from the system and fallback to the Internet.
|
# Try to get our IP from the system and fallback to the Internet.
|
||||||
# I do this to make the script compatible with NATed servers (lowendspirit.com)
|
# I do this to make the script compatible with NATed servers (lowendspirit.com)
|
||||||
# and to avoid getting an IPv6.
|
# and to avoid getting an IPv6.
|
||||||
@ -91,6 +103,8 @@ if [[ -e /etc/openvpn/server.conf ]]; then
|
|||||||
newclient "$CLIENT"
|
newclient "$CLIENT"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Client $CLIENT added, configuration is available at" ~/"$CLIENT.ovpn"
|
echo "Client $CLIENT added, configuration is available at" ~/"$CLIENT.ovpn"
|
||||||
|
echo "You can also download it from the following address"
|
||||||
|
transfer "$CLIENT.ovpn"
|
||||||
exit
|
exit
|
||||||
;;
|
;;
|
||||||
2)
|
2)
|
||||||
@ -223,11 +237,11 @@ else
|
|||||||
read -n1 -r -p "Press any key to continue..."
|
read -n1 -r -p "Press any key to continue..."
|
||||||
if [[ "$OS" = 'debian' ]]; then
|
if [[ "$OS" = 'debian' ]]; then
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get install openvpn iptables openssl ca-certificates -y
|
apt-get install openvpn iptables openssl ca-certificates curl -y
|
||||||
else
|
else
|
||||||
# Else, the distro is CentOS
|
# Else, the distro is CentOS
|
||||||
yum install epel-release -y
|
yum install epel-release -y
|
||||||
yum install openvpn iptables openssl wget ca-certificates -y
|
yum install openvpn iptables openssl wget ca-certificates curl -y
|
||||||
fi
|
fi
|
||||||
# An old version of easy-rsa was available by default in some openvpn packages
|
# An old version of easy-rsa was available by default in some openvpn packages
|
||||||
if [[ -d /etc/openvpn/easy-rsa/ ]]; then
|
if [[ -d /etc/openvpn/easy-rsa/ ]]; then
|
||||||
@ -413,5 +427,7 @@ verb 3" > /etc/openvpn/client-common.txt
|
|||||||
echo "Finished!"
|
echo "Finished!"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Your client configuration is available at" ~/"$CLIENT.ovpn"
|
echo "Your client configuration is available at" ~/"$CLIENT.ovpn"
|
||||||
|
echo "You can also download it from the following address"
|
||||||
|
transfer "$CLIENT.ovpn"
|
||||||
echo "If you want to add more clients, you simply need to run this script again!"
|
echo "If you want to add more clients, you simply need to run this script again!"
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user