Remove obsolete script files that are no longer needed. Root run.sh has all functionality. Clean src/ directory to only contain necessary source scripts. Deleted files: - bin/cleanup.sh (functionality in run.sh) - bin/docker-manage.sh (functionality in run.sh) - lib/docker.sh (not used, deleted) - src/build.sh (obsolete, not referenced) - src/run.sh (obsolete, duplicate of root run.sh) - src/run-new.sh (broken, references deleted lib/docker.sh) - plan/PreFlightDiscussion-*.md (planning docs no longer needed) Modified files: - .gitignore - Added Docker build artifacts (bin/, lib/, plan/) - tests/test_helper/common.bash - Fixed for standalone execution Current src/ directory (essential scripts only): - build-iso.sh - ISO build orchestration - firewall-setup.sh - Firewall configuration - security-hardening.sh - Security hardening functions 💘 Generated with Crush Assisted-by: GLM-4.7 via Crush <crush@charm.land>
52 lines
1.8 KiB
Bash
52 lines
1.8 KiB
Bash
#!/usr/bin/env bats
|
|
# Unit tests for security hardening functions
|
|
|
|
# Add bats library to BATS_LIB_PATH
|
|
|
|
|
|
@test "create_wifi_blacklist creates correct configuration" {
|
|
source "${PROJECT_ROOT}/src/security-hardening.sh"
|
|
|
|
local test_output="$TEST_TEMP_DIR/blacklist-wifi.conf"
|
|
create_wifi_blacklist "$test_output"
|
|
|
|
assert [ -f "$test_output" ]
|
|
assert_file_contains "$test_output" "blacklist cfg80211"
|
|
assert_file_contains "$test_output" "blacklist mac80211"
|
|
assert_file_contains "$test_output" "blacklist iwlwifi"
|
|
}
|
|
|
|
@test "create_bluetooth_blacklist creates correct configuration" {
|
|
source "${PROJECT_ROOT}/src/security-hardening.sh"
|
|
|
|
local test_output="$TEST_TEMP_DIR/blacklist-bluetooth.conf"
|
|
create_bluetooth_blacklist "$test_output"
|
|
|
|
assert [ -f "$test_output" ]
|
|
assert_file_contains "$test_output" "blacklist btusb"
|
|
assert_file_contains "$test_output" "blacklist bluetooth"
|
|
}
|
|
|
|
@test "configure_ssh creates secure configuration" {
|
|
source "${PROJECT_ROOT}/src/security-hardening.sh"
|
|
|
|
local test_output="$TEST_TEMP_DIR/sshd_config"
|
|
configure_ssh "$test_output"
|
|
|
|
assert [ -f "$test_output" ]
|
|
assert_file_contains "$test_output" "PermitRootLogin no"
|
|
assert_file_contains "$test_output" "PasswordAuthentication yes"
|
|
assert_file_contains "$test_output" "MaxAuthTries 3"
|
|
}
|
|
|
|
@test "configure_password_policy creates secure policy" {
|
|
source "${PROJECT_ROOT}/src/security-hardening.sh"
|
|
|
|
local test_output="$TEST_TEMP_DIR/pwquality.conf"
|
|
configure_password_policy "$test_output"
|
|
|
|
assert [ -f "$test_output" ]
|
|
assert_file_contains "$test_output" "minlen = 14"
|
|
assert_file_contains "$test_output" "dcredit = -1"
|
|
assert_file_contains "$test_output" "ucredit = -1"
|
|
} |