The reconstructed evaluation script behind this rule's OVAL check(s) — every module a compound check combines, with this rule's own concrete values and DISA's SCC tool's real per-module mechanism curated from static teardown of SCC releases.
#!/bin/bash
# Reconstructed from oval:mil.disa.fso.hpux11:def:358
# The smb.conf file must use the hosts option to restrict access to Samba.
# Per-module read mechanism curated from static teardown of DISA's SCC tool
# (SCAP Compliance Checker) -- see the SCC Automation Reference above.
# samba not installed
# file_object (file_test)
test_1() {
! ( test -e '/opt/samba/bin/smbd' &>/dev/null )
}
# smb.conf has hosts restrictions
# textfilecontent54_object (textfilecontent54_test)
test_2() {
grep -Pq '^[ ]*[Hh][Oo][Ss][Tt][Ss]' '/etc/opt/samba/smb.conf' &>/dev/null
}
if ( test_1 || test_2 ); then
echo "PASS"
else
echo "FAIL"
fi Assessment Script Powered by AISandbox-executed
A standalone Shell script to assess this control automatically. Review before running it in your environment.
Syntax-checked and actually executed in an isolated sandbox (not the real system this checks) — confirmed to run without errors.
#!/bin/sh
# DISA STIG / SCAP compliance check for smb.conf hosts option restriction
# Check if smbd is installed
if [ ! -f "/opt/samba/bin/smbd" ]; then
echo "PASS"
exit 0
fi
# Check smb.conf for hosts allow/deny restrictions
if grep -q "^[ \t]*[Hh][Oo][Ss][Tt][Ss][ \t]*=[ \t]*127\.0\.0\.1[ \t]*192\.168\.2\.0/24[ \t]*192\.168\.3\.0/24" /etc/opt/samba/smb.conf && grep -q "^[ \t]*[Hh][Oo][Ss][Tt][Dd][ \t]*=[ \t]*0\.0\.0\.0/0" /etc/opt/samba/smb.conf; then
echo "PASS"
exit 0
else
echo "FAIL"
exit 1
fi