[IMPROVED] Instalación de Mozilla SOPS
This commit is contained in:
		
							parent
							
								
									b86ad06bb9
								
							
						
					
					
						commit
						9c7192ed0d
					
				
					 5 changed files with 122 additions and 23 deletions
				
			
		|  | @ -20,3 +20,11 @@ A partir de este momento, la carpeta $HOME/devs será nuestra área de desarroll | ||||||
| 
 | 
 | ||||||
|     $ cd $HOME/devs |     $ cd $HOME/devs | ||||||
|     $ bin/bootstrap.sh |     $ bin/bootstrap.sh | ||||||
|  | 
 | ||||||
|  | ### GESTIÓN DE DNS LOCAL PARA DESARROLLADORES (DNSMASQ) | ||||||
|  | 
 | ||||||
|  | #### Habilitar permiso local para puerto 53 (DNS) | ||||||
|  | 
 | ||||||
|  | Antes de poder levantar el contenedor dnsmasq, se requiere dar permisos para poder habilitar el puerto 53: | ||||||
|  | 
 | ||||||
|  |     $ dns/setport53.sh | ||||||
|  | @ -54,6 +54,7 @@ install() { | ||||||
| 	local CURL_PACKAGE=curl | 	local CURL_PACKAGE=curl | ||||||
|     local WGET_PACKAGE=wget |     local WGET_PACKAGE=wget | ||||||
|     local DIALOG_PACKAGE=dialog |     local DIALOG_PACKAGE=dialog | ||||||
|  | 	local SOPS_PACKAGE=sops | ||||||
| 
 | 
 | ||||||
| 	# Load base bash library | 	# Load base bash library | ||||||
| 	source $BIN_PATH/$LIBRARY/base.lib | 	source $BIN_PATH/$LIBRARY/base.lib | ||||||
|  | @ -99,6 +100,13 @@ install() { | ||||||
| 	  python3_install | 	  python3_install | ||||||
| 	fi | 	fi | ||||||
| 
 | 
 | ||||||
|  | 	# Install mozilla sops from OS Packages | ||||||
|  | 	command_installed $SOPS_PACKAGE | ||||||
|  | 	if [ $? -ne 0 ] | ||||||
|  | 	then | ||||||
|  | 	  sops_install | ||||||
|  | 	fi | ||||||
|  | 
 | ||||||
| 	# Check for container management installed and install podman | 	# Check for container management installed and install podman | ||||||
| 	container_mode | 	container_mode | ||||||
| 	if [ $? -eq 255 ] | 	if [ $? -eq 255 ] | ||||||
|  |  | ||||||
|  | @ -285,6 +285,7 @@ function get_osname() { | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | # Build container with docker | ||||||
| function docker_build() { | function docker_build() { | ||||||
| 
 | 
 | ||||||
|   local CONTAINER=$1 |   local CONTAINER=$1 | ||||||
|  | @ -295,6 +296,7 @@ function docker_build() { | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | # Build container with podman | ||||||
| function podman_build() { | function podman_build() { | ||||||
| 
 | 
 | ||||||
|   local CONTAINER=$1 |   local CONTAINER=$1 | ||||||
|  | @ -313,6 +315,7 @@ function podman_build() { | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | # Build container with podman or docker | ||||||
| function build_container() { | function build_container() { | ||||||
| 
 | 
 | ||||||
|   local CONTAINER=$1 |   local CONTAINER=$1 | ||||||
|  | @ -335,3 +338,4 @@ function build_container() { | ||||||
|   return 1 |   return 1 | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  |  | ||||||
|  | @ -17,6 +17,9 @@ | ||||||
| # Debería haber recibido una copia de la Licencia Pública Affero General | # Debería haber recibido una copia de la Licencia Pública Affero General | ||||||
| # junto con este programa. Si no la recibió, consulte <https://www.gnu.org/licenses/>. | # junto con este programa. Si no la recibió, consulte <https://www.gnu.org/licenses/>. | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|  | SOPS_VERSION=v3.9.2 | ||||||
|  | 
 | ||||||
| # Install python3 package | # Install python3 package | ||||||
| function python3_install() { | function python3_install() { | ||||||
| 
 | 
 | ||||||
|  | @ -46,6 +49,56 @@ function python3_install() { | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | # Install mozilla sops package on os system supported | ||||||
|  | function sops_install() { | ||||||
|  | 
 | ||||||
|  |   echo "${bomsg_006}" | ||||||
|  |   if [ "$(uname)" == "Darwin" ]; then | ||||||
|  |     # En macOS, instalamos o actualizamos Python a través de Homebrew | ||||||
|  |     brew install sops | ||||||
|  |     return $? | ||||||
|  |   fi | ||||||
|  | 
 | ||||||
|  |   # Get architecture info | ||||||
|  |   cd /tmp | ||||||
|  |   local arch=$(uname -m) | ||||||
|  | 
 | ||||||
|  |   case $arch in | ||||||
|  |     x86_64) | ||||||
|  |       # Download the binary | ||||||
|  |       curl -LO https://github.com/getsops/sops/releases/download/v$SOPS_VERSION/sops-$SOPS_VERSION.linux.amd64 | ||||||
|  |       if [ $? -eq 0 ]; then | ||||||
|  |         # Move the binary in to your PATH | ||||||
|  |         mv sops-v$SOPS_VERSION.linux.amd64 /usr/local/bin/sops | ||||||
|  |         # Make the binary executable | ||||||
|  |         chmod +x /usr/local/bin/sops | ||||||
|  |       else | ||||||
|  |         return 1 | ||||||
|  |       fi | ||||||
|  |       ;; | ||||||
|  |     arm*) | ||||||
|  |       # Download the binary | ||||||
|  |       curl -LO https://github.com/getsops/sops/releases/download/v$SOPS_VERSION/sops-$SOPS_VERSION.linux.arm64 | ||||||
|  |       if [ $? -eq 0 ]; then | ||||||
|  |         # Move the binary in to your PATH | ||||||
|  |         mv sops-v$SOPS_VERSION.linux.arm64 /usr/local/bin/sops | ||||||
|  |         # Make the binary executable | ||||||
|  |         chmod +x /usr/local/bin/sops | ||||||
|  |       else | ||||||
|  |         return 1 | ||||||
|  |       fi | ||||||
|  |       ;; | ||||||
|  |     *) | ||||||
|  |       echo "$bomsg_005 $arch" | ||||||
|  |       return 2 | ||||||
|  |       ;; | ||||||
|  |   esac | ||||||
|  | 
 | ||||||
|  |   echo "${bomsg_007}" | ||||||
|  |   return 0 | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  | 
 | ||||||
| # Install podman package | # Install podman package | ||||||
| function podman_install() { | function podman_install() { | ||||||
| 
 | 
 | ||||||
|  | @ -76,3 +129,23 @@ function podman_install() { | ||||||
|     echo "${pdmsg_003}" |     echo "${pdmsg_003}" | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | # Set how unprivileged port 53 (dns) | ||||||
|  | function unprivileged_port53() { | ||||||
|  | 
 | ||||||
|  |     local sysctlfile=/etc/sysctl.conf | ||||||
|  |     local line="net.ipv4.ip_unprivileged_port_start=53" | ||||||
|  | 
 | ||||||
|  |     if [[ ! -f $sysctlfile ]]; then | ||||||
|  |         return 1 | ||||||
|  |     fi | ||||||
|  | 
 | ||||||
|  |     if ! grep -q "$line" "$sysctlfile"; then | ||||||
|  |         echo "$line" >> $sysctlfile | ||||||
|  |     fi | ||||||
|  | 
 | ||||||
|  |     sysctl -p | ||||||
|  |     return $? | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -12,6 +12,12 @@ | ||||||
| #============================================================================== | #============================================================================== | ||||||
| 
 | 
 | ||||||
| bomsg_000="BOOTSTRAP" | bomsg_000="BOOTSTRAP" | ||||||
|  | bomsg_002="PERMITIR PUERTO 53" | ||||||
|  | bomsg_003="Puerto 53 no se ha liberado!" | ||||||
|  | bomsg_004="Puerto 53 (dns) ha sido liberado para uso no-root" | ||||||
|  | bomsg_005="Arquitectura desconocida:" | ||||||
|  | bomsg_006="Instalando Mozilla SOPS..." | ||||||
|  | bomsg_007="Instalación de Mozilla SOPS completada..." | ||||||
| 
 | 
 | ||||||
| pymsg_001="Instalando python3" | pymsg_001="Instalando python3" | ||||||
| pymsg_002="Instalando dialog" | pymsg_002="Instalando dialog" | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue