diff --git a/Dockerfile b/Dockerfile index 8d435d1..15c32df 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,9 +20,10 @@ COPY bashgen/templates/ ./templates/ # Copy banner markdown files # Use templates directory as source, copy to workingscope in container -COPY bashgen/templates/loginbanner.md.template bashgen/templates/postloginbanner.md.template /tmp/ +COPY bashgen/templates/loginbanner.md.template bashgen/templates/loginbanner_dod_cmmc.md.template bashgen/templates/postloginbanner.md.template /tmp/ RUN mkdir -p /app/workingscope && \ cp /tmp/loginbanner.md.template /app/workingscope/loginbanner.md && \ + cp /tmp/loginbanner_dod_cmmc.md.template /app/workingscope/loginbanner_dod_cmmc.md && \ cp /tmp/postloginbanner.md.template /app/workingscope/postloginbanner.md # Expose port diff --git a/app.py b/app.py index e92113c..0bfa412 100644 --- a/app.py +++ b/app.py @@ -42,6 +42,7 @@ def generate( ssh_harden: str | None = Form(default=None), install_fail2ban: str | None = Form(default=None), prelogin_banner: str | None = Form(default=None), + banner_type: str = Form(default="default"), # "default" or "dod_cmmc" postlogin_banner: str | None = Form(default=None), ssh_2fa: str | None = Form(default=None), @@ -90,19 +91,26 @@ def generate( app_path = Path(__file__).parent base_path = app_path.parent + # Determine which pre-login banner to use based on banner_type + banner_filename = "loginbanner_dod_cmmc.md.template" if banner_type == "dod_cmmc" else "loginbanner.md.template" + # Priority order: 1) workingscope directory, 2) templates directory, 3) Docker workingscope prelogin_banner_path = base_path / "workingscope" / "loginbanner.md" postlogin_banner_path = base_path / "workingscope" / "postloginbanner.md" # Fallback to templates directory (for repository templates) if not prelogin_banner_path.exists(): - prelogin_banner_path = app_path / "templates" / "loginbanner.md.template" + prelogin_banner_path = app_path / "templates" / banner_filename if not postlogin_banner_path.exists(): postlogin_banner_path = app_path / "templates" / "postloginbanner.md.template" # Final fallback: Docker container workingscope directory if not prelogin_banner_path.exists(): - prelogin_banner_path = Path("workingscope") / "loginbanner.md" + # Try DOD CMMC banner if selected, otherwise default + if banner_type == "dod_cmmc": + prelogin_banner_path = Path("workingscope") / "loginbanner_dod_cmmc.md" + else: + prelogin_banner_path = Path("workingscope") / "loginbanner.md" if not postlogin_banner_path.exists(): postlogin_banner_path = Path("workingscope") / "postloginbanner.md" diff --git a/templates/index.html b/templates/index.html index 191a5be..8357a8a 100644 --- a/templates/index.html +++ b/templates/index.html @@ -36,6 +36,10 @@ +