58 lines
1.3 KiB
Python
58 lines
1.3 KiB
Python
|
import os
|
||
|
|
||
|
def test_packages_are_installed(host):
|
||
|
packages = [
|
||
|
"git",
|
||
|
"zip",
|
||
|
"wget",
|
||
|
"curl",
|
||
|
"nginx",
|
||
|
]
|
||
|
for p in packages:
|
||
|
print(f"[*] Checking if {p} is installed")
|
||
|
pkg = host.package(p)
|
||
|
assert pkg.is_installed
|
||
|
|
||
|
#def test_nginx_service_running_and_enabled(host):
|
||
|
# service = host.service("nginx")
|
||
|
# assert service.is_running
|
||
|
# assert service.is_enabled
|
||
|
|
||
|
|
||
|
def test_ssh_is_listening(host):
|
||
|
socket = host.socket(f"tcp://0.0.0.0:22")
|
||
|
assert socket.is_listening
|
||
|
|
||
|
#
|
||
|
#def test_ufw_is_installed(host):
|
||
|
# pkg = host.package("ufw")
|
||
|
# assert pkg.is_installed
|
||
|
|
||
|
|
||
|
#def test_ufw_service_running_and_enabled(host):
|
||
|
# service = host.service("ufw")
|
||
|
# assert service.is_running
|
||
|
# assert service.is_enabled
|
||
|
#
|
||
|
#
|
||
|
#def test_fail2ban_is_installed(host):
|
||
|
# pkg = host.package("fail2ban")
|
||
|
# assert pkg.is_installed
|
||
|
#
|
||
|
#
|
||
|
#def test_fail2ban_is_enabled_and_running(host):
|
||
|
# service = host.service("fail2ban")
|
||
|
# assert service.is_running
|
||
|
# assert service.is_enabled
|
||
|
#
|
||
|
#
|
||
|
#def test_ssh_is_installed(host):
|
||
|
# pkg = host.package("openssh-server")
|
||
|
# assert pkg.is_installed
|
||
|
#
|
||
|
#
|
||
|
#def test_ssh_is_enabled_and_running(host):
|
||
|
# service = host.service("sshd")
|
||
|
# assert service.is_running
|
||
|
# assert service.is_enabled
|