Skip to content

Commit

Permalink
Merge pull request #39 from abhishekmj303/new-branch
Browse files Browse the repository at this point in the history
update
  • Loading branch information
abhishekmj303 authored Dec 20, 2023
2 parents 2c68ccd + d78edb9 commit 24e70e0
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions harden/file_systems/tmp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 24e70e0

Please sign in to comment.