mirror of
https://github.com/wickedyoda/public-setupfiles.git
synced 2026-11-16 13:31:56 -06:00
fix: critical security issues in update and docker setup scripts
- dist-upgrade.sh: Fix invalid shebang, add strict mode, use dynamic Ubuntu codename - install_docker.sh: Quote variables in package removal, replace su with re-login message - install_docker_ubuntu.sh: Remove legacy pip compose install, update to Compose v2.27.0
This commit is contained in:
1 parent
1e25e36ce6
commit
95f39ee99a
3 files changed
+24
-18
No files matched your search
@@ -1,5 +1,10 @@
|
|||||||
#remove previous conflicting packages
|
#!/usr/bin/env bash
|
||||||
for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt remove $pkg; done
|
set -euo pipefail
|
||||||
|
|
||||||
|
# Remove previous conflicting packages
|
||||||
|
for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do
|
||||||
|
sudo apt remove "$pkg" -y
|
||||||
|
done
|
||||||
|
|
||||||
#updates, setup souces and install.
|
#updates, setup souces and install.
|
||||||
sudo install -m 0755 -d /etc/apt/keyrings
|
sudo install -m 0755 -d /etc/apt/keyrings
|
||||||
@@ -14,8 +19,10 @@ sudo apt update
|
|||||||
#install docker
|
#install docker
|
||||||
sudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin -y
|
sudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin -y
|
||||||
|
|
||||||
#Adduser to docker
|
# Add user to docker group
|
||||||
sudo usermod -aG docker $USER && su $USER
|
sudo usermod -aG docker "$USER"
|
||||||
|
echo "[*] Added $USER to docker group."
|
||||||
|
echo "[!] Log out and log back in for Docker group changes to take effect."
|
||||||
|
|
||||||
# create download dir:
|
# create download dir:
|
||||||
export DOWNLOAD_DIR=$HOME/greenbone-community-container && mkdir -p $DOWNLOAD_DIR
|
export DOWNLOAD_DIR=$HOME/greenbone-community-container && mkdir -p $DOWNLOAD_DIR
|
||||||
@@ -9,14 +9,10 @@ sh get-docker.sh
|
|||||||
# Script: install_docker_compose.sh
|
# Script: install_docker_compose.sh
|
||||||
# Description: Script to install Docker Compose and its dependencies on Linux
|
# Description: Script to install Docker Compose and its dependencies on Linux
|
||||||
|
|
||||||
# Install Docker Compose using pip
|
# Install Docker Compose (v2) binary (standalone method)
|
||||||
sudo pip3 install docker-compose
|
DOCKER_COMPOSE_VERSION=2.27.0
|
||||||
|
sudo curl -L --fail "https://github.com/docker/compose/releases/download/v${DOCKER_COMPOSE_VERSION}/docker-compose-linux-x86_64" \
|
||||||
# Download Docker Compose executable
|
-o /usr/local/bin/docker-compose
|
||||||
DOCKER_COMPOSE_VERSION=2.20.3
|
|
||||||
sudo curl -L --fail https://github.com/docker/compose/releases/download/v${DOCKER_COMPOSE_VERSION}/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
|
|
||||||
|
|
||||||
# Make Docker Compose executable
|
|
||||||
sudo chmod +x /usr/local/bin/docker-compose
|
sudo chmod +x /usr/local/bin/docker-compose
|
||||||
|
|
||||||
# Check if Docker Compose installation was successful
|
# Check if Docker Compose installation was successful
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
# /bin/bash
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
# Backup of existing sources.list file
|
# Backup of existing sources.list file
|
||||||
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
|
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
|
||||||
|
|
||||||
# Create variable from /etc/os-release file to get ID
|
# Create variable from /etc/os-release file to get ID
|
||||||
ID=$(grep -oP '(?<=^ID=).+' /etc/os-release)
|
# shellcheck disable=SC1091
|
||||||
|
. /etc/os-release
|
||||||
|
ID="${ID:-}"
|
||||||
|
|
||||||
if [ "$ID" == "debian" ]; then
|
if [ "$ID" == "debian" ]; then
|
||||||
echo "ID_LIKE is debian"
|
echo "ID_LIKE is debian"
|
||||||
@@ -22,10 +25,10 @@ fi
|
|||||||
if [ "$ID" == "ubuntu" ]; then
|
if [ "$ID" == "ubuntu" ]; then
|
||||||
echo "ID_LIKE is ubuntu"
|
echo "ID_LIKE is ubuntu"
|
||||||
echo "Updating sources.list file"
|
echo "Updating sources.list file"
|
||||||
echo "deb http://archive.ubuntu.com/ubuntu/ Minotaur restricted universe multiverse" | sudo tee /etc/apt/sources.list
|
CODENAME="${VERSION_CODENAME:?missing VERSION_CODENAME}"
|
||||||
echo "deb http://archive.ubuntu.com/ubuntu/ Minotaur main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list
|
echo "deb http://archive.ubuntu.com/ubuntu/ ${CODENAME} main restricted universe multiverse" | sudo tee /etc/apt/sources.list
|
||||||
echo "deb http://archive.ubuntu.com/ubuntu/ Minotaur main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list
|
echo "deb http://archive.ubuntu.com/ubuntu/ ${CODENAME}-updates main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list
|
||||||
echo "deb http://security.ubuntu.com/ubuntu Minotaur main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list
|
echo "deb http://security.ubuntu.com/ubuntu ${CODENAME}-security main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# update repositories
|
# update repositories
|
||||||
|
|||||||
Reference in new issue
Block a user