linux-tools/modules/fail2ban/__init__.py
2020-08-02 13:58:47 +02:00

23 lines
605 B
Python

import subprocess
from shutil import copyfile
from print_helpers import print_bold
def run():
subprocess.call("apt install fail2ban -y", shell=True)
try:
ufw_is_installed = subprocess.check_output("which ufw", shell=True).decode().strip()
print_bold(f"ufw is already installed in {ufw_is_installed}")
except subprocess.CalledProcessError:
subprocess.call("sudo apt install ufw -y", shell=True)
subprocess.call("ufw allow ssh && ufw enable", shell=True)
copyfile("./modules/fail2ban/jail.local", "/etc/fail2ban/jail.local")
functions = {
"run": run
}