openvpn.sh 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495
  1. #!/bin/bash
  2. #19/12/2019
  3. clear
  4. msg -bar
  5. # Detect Debian users running the script with "sh" instead of bash
  6. if readlink /proc/$$/exe | grep -q "dash"; then
  7. print_center -ama "Este script se utiliza con bash"
  8. enter
  9. fi
  10. if [[ "$EUID" -ne 0 ]]; then
  11. print_center -ama "Sorry, solo funciona como root"
  12. enter
  13. fi
  14. if [[ ! -e /dev/net/tun ]]; then
  15. print_center -ama "El TUN device no esta disponible"
  16. print_center -ama "Necesitas habilitar TUN antes de usar este script"
  17. enter
  18. fi
  19. if [[ -e /etc/debian_version ]]; then
  20. OS=debian
  21. GROUPNAME=nogroup
  22. RCLOCAL='/etc/rc.local'
  23. elif [[ -e /etc/centos-release || -e /etc/redhat-release ]]; then
  24. OS=centos
  25. GROUPNAME=nobody
  26. RCLOCAL='/etc/rc.d/rc.local'
  27. else
  28. print_center -ama "Sistema no compatible para este script"
  29. enter
  30. fi
  31. del(){
  32. for (( i = 0; i < $1; i++ )); do
  33. tput cuu1 && tput dl1
  34. done
  35. }
  36. agrega_dns(){
  37. msg -ama " Escriba el HOST DNS que desea Agregar"
  38. read -p " [NewDNS]: " SDNS
  39. cat /etc/hosts|grep -v "$SDNS" > /etc/hosts.bak && mv -f /etc/hosts.bak /etc/hosts
  40. if [[ -e /etc/opendns ]]; then
  41. cat /etc/opendns > /tmp/opnbak
  42. mv -f /tmp/opnbak /etc/opendns
  43. echo "$SDNS" >> /etc/opendns
  44. else
  45. echo "$SDNS" > /etc/opendns
  46. fi
  47. [[ -z $NEWDNS ]] && NEWDNS="$SDNS" || NEWDNS="$NEWDNS $SDNS"
  48. unset SDNS
  49. }
  50. dns_fun(){
  51. case $1 in
  52. 1)
  53. if grep -q "127.0.0.53" "/etc/resolv.conf"; then
  54. RESOLVCONF='/run/systemd/resolve/resolv.conf'
  55. else
  56. RESOLVCONF='/etc/resolv.conf'
  57. fi
  58. grep -v '#' $RESOLVCONF | grep 'nameserver' | grep -E -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | while read line; do
  59. echo "push \"dhcp-option DNS $line\"" >> /etc/openvpn/server.conf
  60. done;;
  61. 2) #cloudflare
  62. echo 'push "dhcp-option DNS 1.1.1.1"' >> /etc/openvpn/server.conf
  63. echo 'push "dhcp-option DNS 1.0.0.1"' >> /etc/openvpn/server.conf;;
  64. 3) #google
  65. echo 'push "dhcp-option DNS 8.8.8.8"' >> /etc/openvpn/server.conf
  66. echo 'push "dhcp-option DNS 8.8.4.4"' >> /etc/openvpn/server.conf;;
  67. 4) #OpenDNS
  68. echo 'push "dhcp-option DNS 208.67.222.222"' >> /etc/openvpn/server.conf
  69. echo 'push "dhcp-option DNS 208.67.220.220"' >> /etc/openvpn/server.conf;;
  70. 5) #Verisign
  71. echo 'push "dhcp-option DNS 64.6.64.6"' >> /etc/openvpn/server.conf
  72. echo 'push "dhcp-option DNS 64.6.65.6"' >> /etc/openvpn/server.conf;;
  73. 6) #Quad9
  74. echo 'push "dhcp-option DNS 9.9.9.9"' >> /etc/openvpn/server.conf
  75. echo 'push "dhcp-option DNS 149.112.112.112"' >> /etc/openvpn/server.conf;;
  76. 7) #UncensoredDNS
  77. echo 'push "dhcp-option DNS 91.239.100.100"' >> /etc/openvpn/server.conf
  78. echo 'push "dhcp-option DNS 89.233.43.71"' >> /etc/openvpn/server.conf;;
  79. esac
  80. }
  81. IP="$(fun_ip)"
  82. instala_ovpn(){
  83. clear
  84. msg -bar
  85. print_center -ama "INSTALADOR DE OPENVPN"
  86. msg -bar
  87. # OpenVPN setup and first user creation
  88. msg -ama " Algunos ajustes son necesario para conf OpenVPN"
  89. msg -bar
  90. # Autodetect IP address and pre-fill for the user
  91. IP=$(ip addr | grep 'inet' | grep -v inet6 | grep -vE '127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -1)
  92. if echo "$IP" | grep -qE '^(10\.|172\.1[6789]\.|172\.2[0-9]\.|172\.3[01]\.|192\.168)'; then
  93. PUBLICIP=$(fun_ip)
  94. fi
  95. msg -ama " Seleccione el protocolo de conexiones OpenVPN"
  96. msg -bar
  97. menu_func "UDP" "TCP"
  98. msg -bar
  99. while [[ -z $PROTOCOL ]]; do
  100. msg -ne " opcion: "
  101. read PROTOCOL
  102. case $PROTOCOL in
  103. 1)PROTOCOL=udp; del "6"; msg -nazu " PROTOCOLO: "; msg -verd "UDP";;
  104. 2)PROTOCOL=tcp; del "6"; msg -nazu " PROTOCOLO: "; msg -verd "TCP";;
  105. *)tput cuu1 && tput dl1; print_center -verm2 "selecciona una opcion entre 1 y 2"; sleep 2s; tput cuu1 && tput dl1; unset PROTOCOL;;
  106. esac
  107. done
  108. msg -bar
  109. print_center -ama "Ingresa un puerto OpenVPN (Default 1194)"
  110. msg -bar
  111. while [[ -z $PORT ]]; do
  112. msg -ne " Puerto: "
  113. read PORT
  114. if [[ -z $PORT ]]; then
  115. PORT="1194"
  116. elif [[ ! $PORT =~ $numero ]]; then
  117. tput cuu1 && tput dl1
  118. print_center -verm2 "ingresa solo numeros"
  119. sleep 2s
  120. tput cuu1 && tput dl1
  121. unset PORT
  122. fi
  123. [[ $(mportas|grep -w "${PORT}") ]] && {
  124. tput cuu1 && tput dl1
  125. print_center -verm2 "Puerto en uso"
  126. sleep 2s
  127. tput cuu1 && tput dl1
  128. unset PORT
  129. }
  130. done
  131. del "3"
  132. msg -nazu " PUERTO: "; msg -verd "$PORT"
  133. msg -bar
  134. print_center -ama "Seleccione DNS (default VPS)"
  135. msg -bar
  136. menu_func "DNS del Sistema" "Cloudflare" "Google" "OpenDNS" "Verisign" "Quad9" "UncensoredDNS"
  137. msg -bar
  138. while [[ -z $DNS ]]; do
  139. msg -ne " opcion: "
  140. read DNS
  141. if [[ -z $DNS ]]; then
  142. DNS="1"
  143. elif [[ ! $DNS =~ $numero ]]; then
  144. tput cuu1 && tput dl1
  145. print_center -verm2 "ingresa solo numeros"
  146. sleep 2s
  147. tput cuu1 && tput dl1
  148. unset DNS
  149. elif [[ $DNS != @([1-7]) ]]; then
  150. tput cuu1 && tput dl1
  151. print_center -ama "solo numeros entre 1 y 7"
  152. sleep 2s
  153. tput cuu1 && tput dl1
  154. unset DNS
  155. fi
  156. done
  157. case $DNS in
  158. 1)P_DNS="DNS del Sistema";;
  159. 2)P_DNS="Cloudflare";;
  160. 3)P_DNS="Google";;
  161. 4)P_DNS="OpenDNS";;
  162. 5)P_DNS="Verisign";;
  163. 6)P_DNS="Quad9";;
  164. 7)P_DNS="UncensoredDNS";;
  165. esac
  166. del "11"
  167. msg -nazu " DNS: "; msg -verd "$P_DNS"
  168. msg -bar
  169. print_center -ama " Seleccione la codificacion para el canal de datos"
  170. msg -bar
  171. menu_func "AES-128-CBC" "AES-192-CBC" "AES-256-CBC" "CAMELLIA-128-CBC" "CAMELLIA-192-CBC" "CAMELLIA-256-CBC" "SEED-CBC" "NONE"
  172. msg -bar
  173. while [[ -z $CIPHER ]]; do
  174. msg -ne " opcion: "
  175. read CIPHER
  176. if [[ -z $CIPHER ]]; then
  177. CIPHER="1"
  178. elif [[ ! $CIPHER =~ $numero ]]; then
  179. tput cuu1 && tput dl1
  180. print_center -verm2 "ingresa solo numeros"
  181. sleep 2s
  182. tput cuu1 && tput dl1
  183. unset CIPHER
  184. elif [[ $CIPHER != @([1-8]) ]]; then
  185. tput cuu1 && tput dl1
  186. print_center -ama "solo numeros entre 1 y 8"
  187. sleep 2s
  188. tput cuu1 && tput dl1
  189. unset CIPHER
  190. fi
  191. done
  192. case $CIPHER in
  193. 1) CIPHER="cipher AES-128-CBC";;
  194. 2) CIPHER="cipher AES-192-CBC";;
  195. 3) CIPHER="cipher AES-256-CBC";;
  196. 4) CIPHER="cipher CAMELLIA-128-CBC";;
  197. 5) CIPHER="cipher CAMELLIA-192-CBC";;
  198. 6) CIPHER="cipher CAMELLIA-256-CBC";;
  199. 7) CIPHER="cipher SEED-CBC";;
  200. 8) CIPHER="cipher none";;
  201. esac
  202. del "12"
  203. codi=$(echo $CIPHER|awk -F ' ' '{print $2}')
  204. msg -nazu " CODIFICACION: "; msg -verd "$codi"
  205. msg -bar
  206. msg -ama " Estamos listos para configurar su servidor OpenVPN"
  207. enter
  208. if [[ "$OS" = 'debian' ]]; then
  209. apt-get update
  210. apt-get install openvpn iptables openssl ca-certificates -y
  211. else
  212. #
  213. yum install epel-release -y
  214. yum install openvpn iptables openssl ca-certificates -y
  215. fi
  216. # Get easy-rsa
  217. EASYRSAURL='https://github.com/OpenVPN/easy-rsa/releases/download/v3.0.7/EasyRSA-3.0.7.tgz'
  218. wget -O ~/easyrsa.tgz "$EASYRSAURL" 2>/dev/null || curl -Lo ~/easyrsa.tgz "$EASYRSAURL"
  219. tar xzf ~/easyrsa.tgz -C ~/
  220. mv ~/EasyRSA-3.0.7/ /etc/openvpn/
  221. mv /etc/openvpn/EasyRSA-3.0.7/ /etc/openvpn/easy-rsa/
  222. chown -R root:root /etc/openvpn/easy-rsa/
  223. rm -f ~/easyrsa.tgz
  224. cd /etc/openvpn/easy-rsa/
  225. #
  226. ./easyrsa init-pki
  227. ./easyrsa --batch build-ca nopass
  228. ./easyrsa gen-dh
  229. ./easyrsa build-server-full server nopass
  230. EASYRSA_CRL_DAYS=3650 ./easyrsa gen-crl
  231. #
  232. cp pki/ca.crt pki/private/ca.key pki/dh.pem pki/issued/server.crt pki/private/server.key pki/crl.pem /etc/openvpn
  233. #
  234. chown nobody:$GROUPNAME /etc/openvpn/crl.pem
  235. #
  236. openvpn --genkey --secret /etc/openvpn/ta.key
  237. #
  238. echo "port $PORT
  239. proto $PROTOCOL
  240. dev tun
  241. sndbuf 0
  242. rcvbuf 0
  243. ca ca.crt
  244. cert server.crt
  245. key server.key
  246. dh dh.pem
  247. auth SHA512
  248. tls-auth ta.key 0
  249. topology subnet
  250. server 10.8.0.0 255.255.255.0
  251. ifconfig-pool-persist ipp.txt" > /etc/openvpn/server.conf
  252. echo 'push "redirect-gateway def1 bypass-dhcp"' >> /etc/openvpn/server.conf
  253. # DNS
  254. dns_fun "$DNS"
  255. echo "keepalive 10 120
  256. ${CIPHER}
  257. user nobody
  258. group $GROUPNAME
  259. persist-key
  260. persist-tun
  261. status openvpn-status.log
  262. verb 3
  263. crl-verify crl.pem" >> /etc/openvpn/server.conf
  264. updatedb
  265. PLUGIN=$(locate openvpn-plugin-auth-pam.so | head -1)
  266. [[ ! -z $(echo ${PLUGIN}) ]] && {
  267. echo "client-to-client
  268. client-cert-not-required
  269. username-as-common-name
  270. plugin $PLUGIN login" >> /etc/openvpn/server.conf
  271. }
  272. #
  273. echo 'net.ipv4.ip_forward=1' > /etc/sysctl.d/30-openvpn-forward.conf
  274. #
  275. echo 1 > /proc/sys/net/ipv4/ip_forward
  276. if pgrep firewalld; then
  277. #
  278. #
  279. #
  280. #
  281. firewall-cmd --zone=public --add-port=$PORT/$PROTOCOL
  282. firewall-cmd --zone=trusted --add-source=10.8.0.0/24
  283. firewall-cmd --permanent --zone=public --add-port=$PORT/$PROTOCOL
  284. firewall-cmd --permanent --zone=trusted --add-source=10.8.0.0/24
  285. #
  286. firewall-cmd --direct --add-rule ipv4 nat POSTROUTING 0 -s 10.8.0.0/24 ! -d 10.8.0.0/24 -j SNAT --to $IP
  287. firewall-cmd --permanent --direct --add-rule ipv4 nat POSTROUTING 0 -s 10.8.0.0/24 ! -d 10.8.0.0/24 -j SNAT --to $IP
  288. else
  289. #
  290. if [[ "$OS" = 'debian' && ! -e $RCLOCAL ]]; then
  291. echo '#!/bin/sh -e
  292. exit 0' > $RCLOCAL
  293. fi
  294. chmod +x $RCLOCAL
  295. #
  296. iptables -t nat -A POSTROUTING -s 10.8.0.0/24 ! -d 10.8.0.0/24 -j SNAT --to $IP
  297. sed -i "1 a\iptables -t nat -A POSTROUTING -s 10.8.0.0/24 ! -d 10.8.0.0/24 -j SNAT --to $IP" $RCLOCAL
  298. if iptables -L -n | grep -qE '^(REJECT|DROP)'; then
  299. #
  300. #
  301. #
  302. iptables -I INPUT -p $PROTOCOL --dport $PORT -j ACCEPT
  303. iptables -I FORWARD -s 10.8.0.0/24 -j ACCEPT
  304. iptables -I FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
  305. sed -i "1 a\iptables -I INPUT -p $PROTOCOL --dport $PORT -j ACCEPT" $RCLOCAL
  306. sed -i "1 a\iptables -I FORWARD -s 10.8.0.0/24 -j ACCEPT" $RCLOCAL
  307. sed -i "1 a\iptables -I FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT" $RCLOCAL
  308. fi
  309. fi
  310. #
  311. if sestatus 2>/dev/null | grep "Current mode" | grep -q "enforcing" && [[ "$PORT" != '1194' ]]; then
  312. #
  313. if ! hash semanage 2>/dev/null; then
  314. yum install policycoreutils-python -y
  315. fi
  316. semanage port -a -t openvpn_port_t -p $PROTOCOL $PORT
  317. fi
  318. #
  319. if [[ "$OS" = 'debian' ]]; then
  320. #
  321. if pgrep systemd-journal; then
  322. systemctl restart openvpn@server.service
  323. else
  324. /etc/init.d/openvpn restart
  325. fi
  326. else
  327. if pgrep systemd-journal; then
  328. systemctl restart openvpn@server.service
  329. systemctl enable openvpn@server.service
  330. else
  331. service openvpn restart
  332. chkconfig openvpn on
  333. fi
  334. fi
  335. #
  336. if [[ "$PUBLICIP" != "" ]]; then
  337. IP=$PUBLICIP
  338. fi
  339. #
  340. echo "# OVPN_ACCESS_SERVER_PROFILE=ADMRufu
  341. client
  342. dev tun
  343. proto $PROTOCOL
  344. sndbuf 0
  345. rcvbuf 0
  346. remote $IP $PORT
  347. resolv-retry infinite
  348. nobind
  349. persist-key
  350. persist-tun
  351. remote-cert-tls server
  352. auth SHA512
  353. ${CIPHER}
  354. setenv opt block-outside-dns
  355. key-direction 1
  356. verb 3
  357. auth-user-pass" > /etc/openvpn/client-common.txt
  358. clear
  359. msg -bar
  360. print_center -verd "Configuracion Finalizada!"
  361. msg -bar
  362. print_center -ama " Crear un usuario SSH para generar el (.ovpn)!"
  363. enter
  364. }
  365. edit_ovpn_host(){
  366. msg -ama " CONFIGURACION HOST DNS OPENVPN"
  367. msg -bar
  368. while [[ $DDNS != @(n|N) ]]; do
  369. echo -ne "\033[1;33m"
  370. read -p " Agregar host [S/N]: " -e -i n DDNS
  371. [[ $DDNS = @(s|S|y|Y) ]] && agrega_dns
  372. done
  373. [[ ! -z $NEWDNS ]] && sed -i "/127.0.0.1[[:blank:]]\+localhost/a 127.0.0.1 $NEWDNS" /etc/hosts
  374. msg -bar
  375. msg -ama " Es Necesario el Reboot del Servidor Para"
  376. msg -ama " Para que las configuraciones sean efectudas"
  377. enter
  378. }
  379. fun_openvpn(){
  380. [[ -e /etc/openvpn/server.conf ]] && {
  381. unset OPENBAR
  382. [[ $(mportas|grep -w "openvpn") ]] && OPENBAR="\033[1;32m [ONLINE]" || OPENBAR="\033[1;31m [OFFLINE]"
  383. clear
  384. msg -bar
  385. print_center -ama "CONFIGURACION OPENVPN"
  386. msg -bar
  387. menu_func "$(msg -verd "INICIAR O PARAR OPENVPN") $OPENBAR" "EDITAR CONFIGURACION CLIENTE $(msg -ama "(MEDIANTE NANO)")" "EDITAR CONFIGURACION SERVIDOR $(msg -ama "(MEDIANTE NANO)")" "CAMBIAR HOST DE OPENVPN" "$(msg -verm2 "DESINSTALAR OPENVPN")"
  388. back
  389. while [[ $xption != @([0-5]) ]]; do
  390. echo -ne "\033[1;33m $(fun_trans "Opcion"): " && read xption
  391. tput cuu1 && tput dl1
  392. done
  393. case $xption in
  394. 5)
  395. clear
  396. msg -bar
  397. echo -ne "\033[1;97m"
  398. read -p "QUIERES DESINTALAR OPENVPN? [Y/N]: " -e REMOVE
  399. msg -bar
  400. if [[ "$REMOVE" = 'y' || "$REMOVE" = 'Y' ]]; then
  401. PORT=$(grep '^port ' /etc/openvpn/server.conf | cut -d " " -f 2)
  402. PROTOCOL=$(grep '^proto ' /etc/openvpn/server.conf | cut -d " " -f 2)
  403. if pgrep firewalld; then
  404. IP=$(firewall-cmd --direct --get-rules ipv4 nat POSTROUTING | grep '\-s 10.8.0.0/24 '"'"'!'"'"' -d 10.8.0.0/24 -j SNAT --to ' | cut -d " " -f 10)
  405. #
  406. firewall-cmd --zone=public --remove-port=$PORT/$PROTOCOL
  407. firewall-cmd --zone=trusted --remove-source=10.8.0.0/24
  408. firewall-cmd --permanent --zone=public --remove-port=$PORT/$PROTOCOL
  409. firewall-cmd --permanent --zone=trusted --remove-source=10.8.0.0/24
  410. firewall-cmd --direct --remove-rule ipv4 nat POSTROUTING 0 -s 10.8.0.0/24 ! -d 10.8.0.0/24 -j SNAT --to $IP
  411. firewall-cmd --permanent --direct --remove-rule ipv4 nat POSTROUTING 0 -s 10.8.0.0/24 ! -d 10.8.0.0/24 -j SNAT --to $IP
  412. else
  413. IP=$(grep 'iptables -t nat -A POSTROUTING -s 10.8.0.0/24 ! -d 10.8.0.0/24 -j SNAT --to ' $RCLOCAL | cut -d " " -f 14)
  414. iptables -t nat -D POSTROUTING -s 10.8.0.0/24 ! -d 10.8.0.0/24 -j SNAT --to $IP
  415. sed -i '/iptables -t nat -A POSTROUTING -s 10.8.0.0\/24 ! -d 10.8.0.0\/24 -j SNAT --to /d' $RCLOCAL
  416. if iptables -L -n | grep -qE '^ACCEPT'; then
  417. iptables -D INPUT -p $PROTOCOL --dport $PORT -j ACCEPT
  418. iptables -D FORWARD -s 10.8.0.0/24 -j ACCEPT
  419. iptables -D FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
  420. sed -i "/iptables -I INPUT -p $PROTOCOL --dport $PORT -j ACCEPT/d" $RCLOCAL
  421. sed -i "/iptables -I FORWARD -s 10.8.0.0\/24 -j ACCEPT/d" $RCLOCAL
  422. sed -i "/iptables -I FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT/d" $RCLOCAL
  423. fi
  424. fi
  425. if sestatus 2>/dev/null | grep "Current mode" | grep -q "enforcing" && [[ "$PORT" != '1194' ]]; then
  426. semanage port -d -t openvpn_port_t -p $PROTOCOL $PORT
  427. fi
  428. if [[ "$OS" = 'debian' ]]; then
  429. apt-get remove --purge -y openvpn
  430. else
  431. yum remove openvpn -y
  432. fi
  433. rm -rf /etc/openvpn
  434. rm -f /etc/sysctl.d/30-openvpn-forward.conf
  435. clear
  436. msg -bar
  437. print_center -verd "OpenVPN removido!"
  438. enter
  439. else
  440. clear
  441. msg -bar
  442. print_center -verm2 "Desinstalacion abortada!"
  443. enter
  444. fi
  445. return 1;;
  446. 2)
  447. nano /etc/openvpn/client-common.txt;;
  448. 3)
  449. nano /etc/openvpn/server.conf;;
  450. 4)
  451. edit_ovpn_host;;
  452. 1)
  453. [[ $(mportas|grep -w openvpn) ]] && {
  454. /etc/init.d/openvpn stop > /dev/null 2>&1
  455. killall openvpn &>/dev/null
  456. systemctl stop openvpn@server.service &>/dev/null
  457. service openvpn stop &>/dev/null
  458. #ps x |grep openvpn |grep -v grep|awk '{print $1}' | while read pid; do kill -9 $pid; done
  459. } || {
  460. cd /etc/openvpn
  461. screen -dmS ovpnscr openvpn --config "server.conf" > /dev/null 2>&1
  462. cd $HOME
  463. }
  464. print_center -ama "Procedimiento con Exito"
  465. enter;;
  466. 0)
  467. return 1;;
  468. esac
  469. return 0
  470. }
  471. [[ -e /etc/squid/squid.conf ]] && instala_ovpn && return 0
  472. [[ -e /etc/squid3/squid.conf ]] && instala_ovpn && return 0
  473. instala_ovpn || return 1
  474. }
  475. while [[ ! $rec = 1 ]]; do
  476. fun_openvpn
  477. rec="$?"
  478. unset xption
  479. done
  480. return 1