- Console log format simplified: OK, FAIL, WARN, INFO with colors - Log file to contain everything else with timestamp - User creation optional and only happens when -u <username> is provided - SSH config: PubkeyAuthentication setting added - Script now supports: debian, ubuntu, fedora & freebsd - Service management fallbacks: service, systemctl, init.d - UFW: enable ssh, http, https - Fail2ban: WIP feat(test): Docker file to test across all active debian, ubuntu & fedora dist refactor(script): improve code organization and logging - Group functions into helper and operations sections - Order operations chronologically - Enhance console log formatting and messages - Update usage examples and comments - Improve error handling and output logging - Use darker color for credentials output for security - Add shellcheck disable comments where necessary
34 lines
700 B
Docker
34 lines
700 B
Docker
# Fail2ban failed
|
|
# FROM debian:12-slim
|
|
|
|
# UFW failed
|
|
# FROM debian:11-slim
|
|
|
|
# All good
|
|
FROM ubuntu:24.10
|
|
|
|
# All good
|
|
# FROM ubuntu:24.04
|
|
|
|
# All good
|
|
# FROM ubuntu:22.04
|
|
|
|
# Fail2ban failed
|
|
# FROM ubuntu:20.04
|
|
|
|
# User creation failed, Fail2ban failed
|
|
# FROM fedora:41
|
|
|
|
# User creation failed, Fail2ban failed
|
|
# FROM fedora:40
|
|
# RUN dnf update -y && dnf install -y sudo openssh-server && dnf clean all && systemctl enable sshd
|
|
|
|
RUN apt-get update && apt-get install -y sudo openssh-server && rm -rf /var/lib/apt/lists/* && service ssh start
|
|
|
|
WORKDIR /script
|
|
COPY init-linux-harden.sh .
|
|
RUN chmod +x init-linux-harden.sh
|
|
|
|
# Default command to run the script
|
|
CMD ["./init-linux-harden.sh", "-u", "test"]
|