Skip to content

Commit

Permalink
Corrections made due to 'shellshock'-infos. - Committed at: 2023-12-1…
Browse files Browse the repository at this point in the history
…6 03:56 Uhr
  • Loading branch information
mmuyakwa committed Dec 16, 2023
1 parent 0389e41 commit 0ab4126
Show file tree
Hide file tree
Showing 20 changed files with 43 additions and 40 deletions.
10 changes: 5 additions & 5 deletions all-update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
#==============================================================================

# Save current directory
set PWD = pwd
PWD=$(pwd)

# Goto Script-Folder
cd "$HOME/scripts/bash-scripts"
cd "$HOME/scripts/bash-scripts" || exit

# Check if "git" is installed
if [ -x "$(command -v git)" ]; then
Expand All @@ -30,14 +30,14 @@ sh update.sh
if [ -x "$(command -v docker)" ]; then
echo "Update docker"
# Check if Portainer is installed
if [ $( docker ps -a | grep portainer | wc -l ) -gt 0 ]; then
if [ "$(docker ps -a | grep -c portainer)" -gt 0 ]; then
# Update Portainer-Container
cd "installers/docker/portainer"
cd "installers/docker/portainer" || exit
sh update_portainer.sh
else
echo "Portainer seems not to be installed."
fi

fi

cd "$PWD"
cd "$PWD" || exit
5 changes: 5 additions & 0 deletions generate_key.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@
#usage: ./generate_key.sh
#==============================================================================

# Useless echo? Instead of 'echo $(cmd)', just use 'cmd'.
# Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
echo "$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 64 | head -n 1)"

# Nach shellshock wäre der befehl so besser. Muss ich jedoch noch testen.
#tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 64 | head -n 1
2 changes: 1 addition & 1 deletion git_it.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ else
#git remote add origin [email protected]:mmuyakwa/bash-scripts.git

# Check if a remote Repo is set.
if grep -q "url = " ${directory}/config
if grep -q "url = " "${directory}"/config
then
# Remote Repo ist set. Push changes to remote Repo.
echo "Pushing to remote Git-Repo.";
Expand Down
1 change: 1 addition & 0 deletions installers/bash_profile/pfetch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ get_title() {
# the intention for using it is allowing the user to overwrite the
# value on invocation.
# shellcheck disable=SC2039
# shellcheck disable=SC3028
hostname=${HOSTNAME:-${hostname:-$(hostname)}}

log "[3${PF_COL3:-1}m${user}${c7}@[3${PF_COL3:-1}m${hostname}" " " >&6
Expand Down
2 changes: 1 addition & 1 deletion installers/compliance/install_inspec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

# root is always user_id 0
SUDO=''
if [ $(id -u) -ne 0 ]; then
if [ "$(id -u)" -ne 0 ]; then
SUDO='sudo'
echo "Your not root."
echo "Running apt-get with SUDO."
Expand Down
2 changes: 1 addition & 1 deletion installers/docker/jenkins/install_jenkins_debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ docker-compose up -d --build

# show endpoint
echo 'Jenkinsn is installed'
echo 'You should now be able to access jenkins at: http://'$(curl -s ifconfig.co)':8780'
echo "You should now be able to access jenkins at: http://$(curl -s ifconfig.co):8780"

1 change: 1 addition & 0 deletions installers/install_composer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ $SUDO mv composer.phar /usr/local/bin/composer
# Install Lavarel globaly (A PHP MVC-Framework)
composer global require "laravel/installer"
# Write LAVAREL to $PATH
# shellcheck disable=SC2016
echo 'export PATH="$PATH:$HOME/.config/composer/vendor/bin"' >> ~/.bashrc

# install Node.js
Expand Down
1 change: 1 addition & 0 deletions installers/install_defaults-GUI.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ $SUDO DEBIAN_FRONTEND=noninteractive apt-get install obs-studio -y
# Download Google-Chrome DEB.
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
$SUDO dpkg -i google-chrome-stable_current_amd64.deb > /dev/null 2>&1
# shellcheck disable=SC2181
if [ $? -gt 0 ]; then
# Download missing dependencies for Google-Chrome.
$SUDO apt-get -f --force-yes --yes install > /dev/null 2>&1
Expand Down
6 changes: 4 additions & 2 deletions installers/install_jellyfin-mediaserver.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash

#Install HTTPS transport for APT if you haven't already:
apt install apt-transport-https

Expand All @@ -19,5 +21,5 @@ apt install jellyfin -y
service jellyfin status
systemctl restart jellyfin

echo http://$(echo $HOSTNAME):8096

# Open the Jellyfin web interface in your browser:
echo "http://${HOSTNAME}:8096"
2 changes: 2 additions & 0 deletions installers/install_jitsi.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash

wget -qO - https://download.jitsi.org/jitsi-key.gpg.key | sudo apt-key add -
sudo sh -c "echo 'deb https://download.jitsi.org stable/' > /etc/apt/sources.list.d/jitsi-stable.list"
sudo apt-get -y update
Expand Down
11 changes: 6 additions & 5 deletions installers/kubernetes/init_kubernetes.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

# root is always user_id 0
$SUDO=''
SUDO=''
[ "$(id -u)" -ne 0 ] && { SUDO='sudo'; echo "Your not root."; echo "Running commands with SUDO."; }

$SUDO kubeadm init
Expand All @@ -12,12 +12,13 @@ echo "Write the last line down!"
echo "!!!IMPORTANT!!!"
####################

mkdir -p $HOME/.kube
$SUDO cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
$SUDO chown $(id -u):$(id -g) $HOME/.kube/config
mkdir -p "$HOME"/.kube
$SUDO cp -i /etc/kubernetes/admin.conf "$HOME"/.kube/config
$SUDO chown "$(id -u):$(id -g)" "$HOME/.kube/config"

# Activate networking
export kubever=$(kubectl version | base64 | tr -d '\n')
kubever=$(kubectl version | base64 | tr -d '\n')
export kubever
kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$kubever"
#kubectl apply -f https://docs.projectcalico.org/v3.0/getting-started/kubernetes/installation/hosted/kubeadm/1.7/calico.yaml

Expand Down
2 changes: 1 addition & 1 deletion installers/plex/install-update-plex.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ $SUDO DEBIAN_FRONTEND=noninteractive apt-get install curl jq sqlite3 gdebi-core
plex_url=$(curl -s https://plex.tv/pms/downloads/5.json | jq -r '.computer.Linux.releases[] | select((.build=="linux-x86_64") and .distro=="debian") .url')

# Download the latest version of plex and install it
curl -O $plex_url && $SUDO gdebi --n ${plex_url##*/}
curl -O "$plex_url" && $SUDO gdebi --n "${plex_url##*/}"

# Run the following code to set your Keyboard-Language
# 'sudo dpkg-reconfigure keyboard-configuration'
2 changes: 1 addition & 1 deletion installers/raspberry_pi/install_defaults_RPi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ if [ ! -d $CLAMAVF ]; then
cd $CLAMAVF || exit
RESULT=$?
if [ $RESULT -eq 0 ]; then
$SUDO rm -rf *
$SUDO rm -rf ./*
$SUDO freshclam
fi
fi
Expand Down
12 changes: 6 additions & 6 deletions make_workdir.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@ WorkDirPath=~/Dokumente/Workbench/$(date +"%Y")/$(date +"%m")/$(date +"%Y-%m-%d"
if [ ! -d "${WorkDirPath}" ]
then
# Show Variables and path that will be generated
echo $now
echo "$now"

# mkdir "-p" (-p = "no error if existing, make parent directories as needed")
mkdir -p $WorkDirPath
mkdir -p "$WorkDirPath"

# Open created Folder in Filemanager
xdg-open $WorkDirPath &
xdg-open "$WorkDirPath" &
fi

echo $WorkDirPath
cd $WorkDirPath
echo "$WorkDirPath"
cd "$WorkDirPath" || exit

# Save Folder-Path to Clipboard
if [ -f "/usr/bin/xclip" ]; then
echo $WorkDirPath | xclip -selection c
echo "$WorkDirPath" | xclip -selection c
fi

9 changes: 2 additions & 7 deletions prowl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Options:
}

#set the API key from the environment variable
if [ ! -z "$PROWL_APIKEY" ]; then
if [ -z "$PROWL_APIKEY" ]; then
API_KEY=$PROWL_APIKEY
else
echo "Prowl API Key not set as an environment variable. Add \"export PROWL_APIKEY={key}\" to your .bash_profile or .profile"
Expand Down Expand Up @@ -56,34 +56,29 @@ MESSAGE=$*
if [ -z "$SUBJECT" ]; then
echo "Subject is required. Use \"-s\" to set it."
usage
exit 1
fi

#Ensure app is supplied as it's required
if [ -z "$APPLICATION" ]; then
echo "Application is required. Use \"-a\" to set it."
usage
exit 1
fi

if [ "$PRIORITY" -lt "-2" ]; then
echo "Priority cannoy be lower than -2 (Very Low)"
usage
exit 1
fi

if [ "$PRIORITY" -gt "2" ]; then
echo "Priority cannoy be higher than 2 (Emergency)"
usage
exit 1
fi

#Ensure that a message was provided after argument parsing
if [ -z "$MESSAGE" ]; then
echo "No message was provided to send."
usage
exit 1
fi

# Send off the message to prowl
call=$(curl -s -d "apikey=$API_KEY&priority=$PRIORITY&application=$APPLICATION&event=$SUBJECT&description=$MESSAGE" https://api.prowlapp.com/publicapi/add)
curl -s -d "apikey=$API_KEY&priority=$PRIORITY&application=$APPLICATION&event=$SUBJECT&description=$MESSAGE" https://api.prowlapp.com/publicapi/add
1 change: 1 addition & 0 deletions python/environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ python -m venv "$current_directory"

# Check if requirements.txt exists and install the imports
if [ -f "requirements.txt" ]; then
# shellcheck source=/dev/null
source "$current_directory/bin/activate"

if [[ "$VIRTUAL_ENV" != "$current_directory" ]]; then
Expand Down
4 changes: 1 addition & 3 deletions sshd/configure-sshd-google-totp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@ fi


# Check if Config has issues
$SUDO sshd -t

if [[ "${?}" -ne 0 ]]; then
if ! $SUDO sshd -t; then
echo "The sshd_config file was NOT modified successfully"
exit 1
else
Expand Down
4 changes: 1 addition & 3 deletions sshd/configure-sshd-minimum.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ else
fi

# Check if Config has issues
$SUDO sshd -t

if [[ "${?}" -ne 0 ]]; then
if ! $SUDO sshd -t; then
echo "The sshd_config file was not modified successfully"
exit 1
else
Expand Down
4 changes: 1 addition & 3 deletions sshd/configure-sshd-standard.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ else
fi

# Check if Config has issues
$SUDO sshd -t

if [[ "${?}" -ne 0 ]]; then
if ! $SUDO sshd -t; then
echo "The sshd_config file was not modified successfully"
exit 1
else
Expand Down
2 changes: 1 addition & 1 deletion vultr/update-rdp-firewall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ ext_ip=$(wget http://checkip.dyndns.org/ -q -O - | grep -Eo '\<[[:digit:]]{1,3}(
echo "My IP: $ext_ip"

vultr-cli firewall rule delete cc1360ad 1
vultr-cli firewall rule create -c $ext_ip/32 -i cc1360ad -o 3389 -p tcp
vultr-cli firewall rule create -c "$ext_ip"/32 -i cc1360ad -o 3389 -p tcp
vultr-cli firewall rule list cc1360ad

0 comments on commit 0ab4126

Please sign in to comment.