Last active
February 18, 2019 23:17
-
-
Save ibejohn818/1c93f895e0247211954266569ea862eb to your computer and use it in GitHub Desktop.
CIS Level 1 Audit Test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -L 'https://gist.github.com/ibejohn818/1c93f895e0247211954266569ea862eb/download' -o gist.zip &&\ | |
unzip gist.zip -d ./ &&\ | |
cp -r 1c93f895e0247211954266569ea862eb-master/* . &&\ | |
make test &&\ | |
rm -rf *; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
install_env: | |
virtualenv -ppython3 env; \ | |
source env/bin/activate; \ | |
pip install -r requirements.txt; | |
venv: | |
source env/bin/activate; | |
test: install_env | |
source env/bin/activate; \ | |
pytest test_cis_level1.py -vv -s |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pytest | |
pytest-runner |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pytest | |
import subprocess | |
import shlex | |
def test_filesystems_disabled(): | |
systems = [ | |
'cramfs', | |
'freevxfs', | |
'jffs2', | |
'hfs', | |
'hfsplus', | |
'squashfs', | |
'udf', | |
'vfat'] | |
for fs in systems: | |
cmd = "modprobe -n -v {}".format(fs) | |
print("TESTING FS: {}".format(fs)) | |
result = subprocess.check_output(cmd, shell=True).strip() | |
assert b'install /bin/true' in result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment