From d78edb938102ebbca330bb57a60d70e299ccccf6 Mon Sep 17 00:00:00 2001 From: chanakya Date: Wed, 20 Dec 2023 09:43:30 +0530 Subject: [PATCH] update --- harden/file_systems/tmp.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/harden/file_systems/tmp.py b/harden/file_systems/tmp.py index bd5e8e7..ac5d84f 100644 --- a/harden/file_systems/tmp.py +++ b/harden/file_systems/tmp.py @@ -6,20 +6,15 @@ def get_script(config): # Start with an empty script and build it up script = "#!/bin/bash\n\n" - if file_systems_config.get('configure_fs', {}).get('tmp', False): + if file_systems_config['configure_fs']: # Unmask the tmp.mount for systemd script += "sudo systemctl unmask tmp.mount\n" # Check if /etc/fstab needs to be updated - if file_systems_config['configure_fs']['tmp'].get('update_fstab', False): + if file_systems_config['configure_fs']['tmp']: script += ( "# Update /etc/fstab for tmpfs configuration\n" "echo 'tmpfs /tmp tmpfs defaults,rw,nosuid,nodev,noexec,relatime,size=2G 0 0' | sudo tee -a /etc/fstab\n" - ) - - # Check if tmp.mount file needs to be created/updated - if file_systems_config['configure_fs']['tmp'].get('update_tmp_mount', False): - script += ( "# Create/update tmp.mount file\n" "echo '[Unit]\\nDescription=Temporary Directory /tmp\\n" "ConditionPathIsSymbolicLink=!/tmp\\nDefaultDependencies=no\\n"