Run the following script to verify automatic mounting of removable media is not overridden and correctly configured in a configuration file:
- automount=false
- automount-open=false
#!/usr/bin/env bash{a_output=()a_output2=()check_setting(){grep-Psrilq"^\h*$1\h*=\h*false\b"/etc/dconf/db/local.d/locks/*2>/dev/null&&\echo"- \"$3\" is locked and set to false"||echo"- \"$3\" is not locked or not set to false"}declare-Asettings=(["automount"]="org/gnome/desktop/media-handling"["automount-open"]="org/gnome/desktop/media-handling")forsettingin"${!settings[@]}";doresult=$(check_setting"$setting""${settings[$setting]}""$setting")if[[$result==*"is not locked"*||$result==*"not set to false"*]];thena_output2+=("$result")elsea_output+=("$result")fidoneprintf'%s\n'"""- Audit Result:"if["${#a_output2[@]}"-gt0];thenprintf'%s\n'" ** FAIL **"" - Reason(s) for audit failure:""${a_output2[@]}"["${#a_output[@]}"-gt0]&&printf'%s\n'"""- Correctly set:""${a_output[@]}"elseprintf'%s\n'" ** PASS **""${a_output[@]}"fi}