homelab-automation/Scripts/ssh-compliance.sh
Benjamin Hays c403578372
Some checks failed
Ansible Deploy / deploy (Ansible/playbooks/debian.yml) (push) Successful in 2m4s
Ansible Deploy / deploy (Ansible/playbooks/proxmox.yml) (push) Failing after 59s
Ansible Lint / build (push) Successful in 33s
reorganize entire ansible folder and related misc edits
2024-10-12 22:34:48 -04:00

33 lines
920 B
Bash
Executable File

#!/bin/sh
if [ "$#" -eq 0 ]; then
echo "Usage: $0 (--install-deps) <file-with-hosts>"
exit 1
fi
if [ "$1" = "--install-deps" ]; then
echo "[+] Installing dependencies"
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
if lsb_release -a 2>/dev/null | grep -q 'Debian'; then
sudo apt-get update && sudo apt-get install -y ssh-audit || pip3 install --upgrade ssh-audit
elif lsb_release -a 2>/dev/null | grep -q 'Fedora'; then
sudo dnf install -y ssh-audit || pip3 install --upgrade ssh-audit
elif lsb_release -a 2>/dev/null | grep -q 'Arch\|Manjaro'; then
sudo pacman -Syu ssh-audit || pip3 install --upgrade ssh-audit
fi
else
pip3 install --upgrade ssh-audit
fi
filename="$2"
else
filename="$1"
fi
if [ ! -f "$filename" ]; then
echo "Error: File '$filename' not found."
exit 1
fi
ssh-audit -T $1 | tee ssh.log