mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
Fix permissions messages and test parms
This commit is contained in:
@@ -67,8 +67,9 @@ EOF
|
|||||||
chown -R netalertx:netalertx ${READ_WRITE_PATHS}
|
chown -R netalertx:netalertx ${READ_WRITE_PATHS}
|
||||||
|
|
||||||
# Set directory and file permissions for all read-write paths
|
# Set directory and file permissions for all read-write paths
|
||||||
find ${READ_WRITE_PATHS} -type d -exec chmod 700 {} +
|
find ${READ_WRITE_PATHS} -type d -exec chmod 700 {} + 2>/dev/null
|
||||||
find ${READ_WRITE_PATHS} -type f -exec chmod 600 {} +
|
find ${READ_WRITE_PATHS} -type f -exec chmod 600 {} + 2>/dev/null
|
||||||
|
echo Permissions fixed for read-write paths. Please restart the container as user 20211.
|
||||||
sleep infinity & wait $!; exit 211
|
sleep infinity & wait $!; exit 211
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -831,6 +831,7 @@ def test_running_as_root_is_blocked(tmp_path: pathlib.Path) -> None:
|
|||||||
user="0",
|
user="0",
|
||||||
)
|
)
|
||||||
_assert_contains(result, "NetAlertX is running as ROOT", result.args)
|
_assert_contains(result, "NetAlertX is running as ROOT", result.args)
|
||||||
|
_assert_contains(result, "Permissions fixed for read-write paths.", result.args)
|
||||||
assert result.returncode == 0 # container must be forced to exit 0 by termination after warning
|
assert result.returncode == 0 # container must be forced to exit 0 by termination after warning
|
||||||
|
|
||||||
|
|
||||||
@@ -885,8 +886,10 @@ def test_missing_app_conf_triggers_seed(tmp_path: pathlib.Path) -> None:
|
|||||||
Container automatically regenerates default configuration on startup.
|
Container automatically regenerates default configuration on startup.
|
||||||
Expected: Automatic regeneration of default configuration.
|
Expected: Automatic regeneration of default configuration.
|
||||||
"""
|
"""
|
||||||
paths = _setup_mount_tree(tmp_path, "missing_app_conf")
|
base = tmp_path / "missing_app_conf_base"
|
||||||
(paths["app_config"] / "app.conf").unlink()
|
paths = _setup_fixed_mount_tree(base)
|
||||||
|
_chown_netalertx(paths["app_config"])
|
||||||
|
(paths["app_config"] / "testfile.txt").write_text("test")
|
||||||
volumes = _build_volume_args(paths)
|
volumes = _build_volume_args(paths)
|
||||||
result = _run_container("missing-app-conf", volumes)
|
result = _run_container("missing-app-conf", volumes)
|
||||||
_assert_contains(result, "Default configuration written to", result.args)
|
_assert_contains(result, "Default configuration written to", result.args)
|
||||||
@@ -900,10 +903,12 @@ def test_missing_app_db_triggers_seed(tmp_path: pathlib.Path) -> None:
|
|||||||
Container automatically creates initial database schema on startup.
|
Container automatically creates initial database schema on startup.
|
||||||
Expected: Automatic creation of initial database schema.
|
Expected: Automatic creation of initial database schema.
|
||||||
"""
|
"""
|
||||||
paths = _setup_mount_tree(tmp_path, "missing_app_db")
|
base = tmp_path / "missing_app_db_base"
|
||||||
(paths["app_db"] / "app.db").unlink()
|
paths = _setup_fixed_mount_tree(base)
|
||||||
|
_chown_netalertx(paths["app_db"])
|
||||||
|
(paths["app_db"] / "testfile.txt").write_text("test")
|
||||||
volumes = _build_volume_args(paths)
|
volumes = _build_volume_args(paths)
|
||||||
result = _run_container("missing-app-db", volumes, user="0:0")
|
result = _run_container("missing-app-db", volumes, user="20211:20211")
|
||||||
_assert_contains(result, "Building initial database schema", result.args)
|
_assert_contains(result, "Building initial database schema", result.args)
|
||||||
assert result.returncode != 0
|
assert result.returncode != 0
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user