[IMPROVED] vpn_install.sh - Se agrega la funcionalidad para instalar cliente vpn pritunl

This commit is contained in:
Mauro Rosero P. 2024-12-08 23:48:45 -05:00
parent d6b4014e1c
commit 7062e1b2fb
Signed by: mrosero
GPG key ID: 83BD2A5F674B7E26
4 changed files with 64 additions and 11 deletions

View file

@ -55,6 +55,7 @@ install() {
local WGET_PACKAGE=wget
local DIALOG_PACKAGE=dialog
local SOPS_PACKAGE=sops
local GNUPG_PACKAGE=gnupg
# Load base bash library
source $BIN_PATH/$LIBRARY/base.lib
@ -86,6 +87,13 @@ install() {
os_pkgs_install $GIT_PACKAGE
fi
# Install gnupg from OS Packages
command_installed $GNUPG_PACKAGE
if [ $? -ne 0 ]
then
os_pkgs_install $GNUGP_PACKAGE
fi
# Install dialog from OS Packages
command_installed $DIALOG_PACKAGE
if [ $? -ne 0 ]

View file

@ -19,6 +19,42 @@
SOPS_VERSION=3.9.2
PRITUNL_SIGN=7568D9BB55FF9E5287D586017AE645C0CF8E292A
UBUNTU_LIST=("jammy" "noble" "oracular")
# Install pritunl vpn package
function install_pritunl() {
if [ "$(uname)" == "Darwin" ]; then
# En macOS, instalamos o actualizamos Python a través de Homebrew
brew install git go node
bash <(curl -s https://raw.githubusercontent.com/pritunl/pritunl-client-electron/master/tools/install_macos.sh)
return $?
fi
OS_INFO=$(lsb_release -a 2>/dev/null)
if [ $? -eq 0 ]; then
OS_VERSION=$(echo "$OS_INFO" | grep "Codename" | awk '{print $2}' | tr -d ' ')
else
OS_INFO=$(cat /etc/os-release 2>/dev/null)
OS_VERSION=$(echo "$OS_INFO" | grep "VERSION_CODENAME" | awk -F ': +' '{print $2}')
fi
if echo "$OS_INFO" | grep -q "Ubuntu"; then
if printf "%s\n" "${UBUNTU_LIST[@]}" | grep -q "^${OS_VERSION}$"
then
echo "deb https://repo.pritunl.com/stable/apt $OS_VERSION main" > /etc/apt/sources.list.d/pritunl.list
gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys $PRITUNL_SIGN
gpg --armor --export $PRITUNL_SIGN | tee /etc/apt/trusted.gpg.d/pritunl.asc
apt update
apt install pritunl-client-electron -y
return $?
fi
fi
return 10
}
# Install python3 package
function python3_install() {

View file

@ -21,6 +21,11 @@ bomsg_006="Instalando Mozilla SOPS..."
bomsg_007="Instalación de Mozilla SOPS completada..."
bomsg_008_1="Carpeta"
bomsg_008_2="no es del ambiente de desarrollo!"
bomsg_010="INSTALAR VPN"
bomsg_011="Instalando cliente VPN (pritunl)"
bomsg_012="No se completo la instalación del cliente VPN (pritunl)"
bomsg_013="Cliente VPN (pritunl) instalado satisfactoriamente!"
bomsg_014="Sistema Operativo no soportado por pritunl"
pymsg_001="Instalando python3"
pymsg_002="Instalando dialog"

View file

@ -1,6 +1,6 @@
#!/bin/bash
#
# set_port53.sh
# vpn_install.sh
# Modified: 2024/12/01 15:27:00
# Derechos de Autor (C) [2024] [Mauro Rosero P. <mauro@roser.one>]
#
@ -58,22 +58,26 @@ install() {
# Load bootstrap messages
load_bootstrap_msg $BIN_PATH $MESSAGES $INSTALL_LANG
# Set port 53 (dns) tu unprivileged
unprivileged_port53
if [ $? -ne 0 ]
then
echo "$bomsg_003"
else
echo "$bomsg_004"
fi
# Install pritunl vpn client (gui)
install_pritunl
case $? in
0)
echo "$bomsg_013"
;;
10)
echo "$bomsg_014"
;;
*)
echo "$bomsg_012"
;;
esac
}
# Load messages
load_bootstrap_msg $BIN_HOME $BIN_MESG $BIN_LANG
# Display Headers
display_devstools_header "- $bomsg_002"
display_devstools_header "- $bomsg_010"
# Run install with sudo
sudo bash -c "$(declare -f load_bootstrap_msg; declare -f install); install $BIN_HOME $BIN_LIBS $BIN_MESG $BIN_LANG"