init
This commit is contained in:
84
results/run.bat
Normal file
84
results/run.bat
Normal file
@@ -0,0 +1,84 @@
|
||||
@echo off
|
||||
setlocal EnableExtensions
|
||||
cd /d "%~dp0"
|
||||
|
||||
echo [%date% %time%] nginx PMI stand - start
|
||||
|
||||
for /f %%i in ('docker run --rm alpine date +%%Y-%%m-%%d_%%H-%%M-%%S') do set TS=%%i
|
||||
set REPORTS=%CD%\reports
|
||||
set PMI_LOG=%TS%_pmi.log
|
||||
set AUDIT_LOG=%TS%_audit.log
|
||||
set FIM_LOG=%TS%_fim.log
|
||||
|
||||
echo Timestamp: %TS%
|
||||
|
||||
echo.
|
||||
echo [1/8] Generate TLS certificates...
|
||||
if not exist ssl mkdir ssl
|
||||
docker run --rm --entrypoint sh -v "%CD%/ssl:/ssl" -v "%CD%/scripts/gen-certs.sh:/gen-certs.sh:ro" alpine/openssl /gen-certs.sh
|
||||
if errorlevel 1 goto :fail
|
||||
|
||||
echo.
|
||||
echo [2/8] Generate htpasswd...
|
||||
docker run --rm --entrypoint sh -v "%CD%/nginx:/out" -v "%CD%/scripts/gen-htpasswd.sh:/gen-htpasswd.sh:ro" alpine/openssl /gen-htpasswd.sh
|
||||
if errorlevel 1 goto :fail
|
||||
|
||||
echo.
|
||||
echo [3/8] Build and start containers...
|
||||
docker compose build
|
||||
if errorlevel 1 goto :fail
|
||||
docker compose up -d
|
||||
if errorlevel 1 goto :fail
|
||||
docker compose restart nginx syslog-ng
|
||||
if errorlevel 1 goto :fail
|
||||
|
||||
echo.
|
||||
echo [4/8] Wait for nginx...
|
||||
docker compose exec -T test-runner sh /scripts/wait-ready.sh
|
||||
if errorlevel 1 goto :fail
|
||||
|
||||
echo.
|
||||
echo [5/8] Run PMI tests...
|
||||
docker compose exec -T -e REPORT=/reports/%PMI_LOG% test-runner sh /scripts/run-pmi-tests.sh
|
||||
set PMI_RC=%ERRORLEVEL%
|
||||
|
||||
docker compose exec -T -e REPORT=/reports/%PMI_LOG% nginx sh /scripts/run-pmi-log-checks.sh
|
||||
if errorlevel 1 set PMI_RC=1
|
||||
|
||||
echo.
|
||||
echo [6/8] Run audits...
|
||||
docker compose exec -T -e REPORT=/reports/%AUDIT_LOG% nginx sh /scripts/run-audit-permissions.sh
|
||||
docker compose exec -T -e REPORT=/reports/%AUDIT_LOG% nginx sh /scripts/run-audit-attack-surface.sh
|
||||
docker compose exec -T -e REPORT=/reports/%AUDIT_LOG% nginx sh /scripts/run-audit-code-control.sh
|
||||
|
||||
echo.
|
||||
echo [7/8] Run FIM checksum (afick stand-in)...
|
||||
docker compose exec -T -e REPORT=/reports/%FIM_LOG% nginx sh /scripts/run-fim-checksum.sh
|
||||
set FIM_RC=%ERRORLEVEL%
|
||||
|
||||
echo.
|
||||
echo [8/8] Generate summary...
|
||||
docker compose exec -T -e REPORTS_DIR=/reports test-runner sh /scripts/generate-summary.sh %TS%
|
||||
|
||||
echo.
|
||||
echo Done. Reports in: %REPORTS%
|
||||
echo %PMI_LOG%
|
||||
echo %AUDIT_LOG%
|
||||
echo %FIM_LOG%
|
||||
echo %TS%_summary.md
|
||||
|
||||
if not "%PMI_RC%"=="0" (
|
||||
echo PMI tests: FAILED
|
||||
exit /b 1
|
||||
)
|
||||
if not "%FIM_RC%"=="0" (
|
||||
echo FIM check: FAILED
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo All checks completed successfully.
|
||||
exit /b 0
|
||||
|
||||
:fail
|
||||
echo ERROR: step failed.
|
||||
exit /b 1
|
||||
Reference in New Issue
Block a user