schm1d/AwesomeArchLinux
Sobre
Hardened Arch linux installation script. Focusing primary on security.
SegurançaCrescimento medido de estrelas
- em 24 h
- 0
- em 7 dias
- 0
- em 15 dias
- Coletando histórico
- em 1 mês
- Coletando histórico
Variações líquidas em períodos sobrepostos, não totais diários. Medições ausentes ficam em branco. Estrelas indicam interesse, não qualidade.
README.md
Original
Wallpaper: https://www.reddit.com/user/alienpirate5/
Awesome Arch Linux
A collection of shell scripts for hardened Arch Linux installation, configuration, and security enhancements. The aim is to make this repository a reliable and curated reference for Arch Linux hardened installation setups and configurations.
Two installation paths are provided:
- Bare-metal / Desktop (
archinstall.sh) — Full disk encryption with LVM on LUKS and an explicit choice between encrypted-boot GRUB or signed systemd-boot UKIs, with optional TPM2 binding. - VPS / Cloud (
vps-install.sh) — Simplified partitioning (no LUKS, no TPM, no GRUB encryption), swap file instead of LVM, serial console support for VPS provider access. All software hardening is preserved.
Both paths share the same hardening philosophy: the scripts will prepare everything for you. No need to worry about partitioning or encryption. All you have to do is provide a few inputs (disk, username, hostname, passwords) and the installer handles the rest.
You will get a very clean, solid, and secure base installation.
Repository Structure
AwesomeArchLinux/
+-- .github/
| +-- workflows/
| +-- shellcheck.yml # CI: ShellCheck linting for all scripts
+-- base/
| +-- archinstall.sh # Bare-metal installer (LUKS + LVM + UEFI + TPM2)
| +-- chroot.sh # Bare-metal chroot configuration & hardening
| +-- bootloader.sh # GRUB and systemd-boot/UKI configuration helpers
| +-- install-aur-packages.sh # Post-install reviewed AUR security setup (aide, acct)
| +-- lib/
| | +-- chroot-security.sh # Shared PAM, journal sealing, auditd, and arch-audit helpers
| +-- vps-install.sh # VPS/cloud installer (no encryption, swap file)
| +-- vps-chroot.sh # VPS chroot configuration & hardening
| +-- vps-harden.sh # VPS live hardening (running system, no reformat)
| +-- recovery-mount.sh # Recovery menu: unmount/remount encrypted install
| +-- secureBoot.sh # Standalone UEFI Secure Boot key generation & signing
| +-- README.md # Base installation documentation
+-- hardening/
| +-- lib/
| | +-- aur-review.sh # Commit-pinned, terminal-reviewed unprivileged AUR builder
| | +-- nftables.sh # Shared validated, ownership-scoped nftables persistence
| | +-- validation.sh # Shared hostname/FQDN and email input validators
| +-- apparmor/
| | +-- apparmor.sh # AppArmor profiles for 7 services (sshd log-only until --enforce)
| | +-- README.md
| +-- chrony/
| | +-- chrony.sh # Chrony NTS (authenticated time synchronization)
| | +-- README.md
| +-- docker/
| | +-- docker.sh # Docker runtime security (CIS benchmark, Trivy, seccomp)
| | +-- README.md
| +-- openclaw/
| | +-- openclaw.sh # OpenClaw/ClawdBot AI agent hardening (27 steps)
| | +-- README.md
| +-- crowdsec/
| | +-- crowdsec.sh # CrowdSec IDS with nftables bouncer (nginx bouncer installed & registered)
| | +-- README.md
| +-- fail2ban/
| | +-- fail2ban.sh # Extended fail2ban jails (SSH, nginx, mail, recidive)
| | +-- README.md
| +-- firehol/
| | +-- firehol.sh # FireHOL firewall with IP blocklist integration
| +-- fscrypt/
| | +-- fscrypt.sh # Per-user ext4 home encryption tied to login password (opt-in)
| | +-- README.md
| +-- mariadb/
| | +-- mariadb.sh # MariaDB/MySQL server hardening
| | +-- README.md
| +-- nginx/
| | +-- nginx.sh # nginx-mainline hardening + Let's Encrypt (SSL Labs A+)
| | +-- README.md
| +-- nodejs/
| | +-- nodejs.sh # Node.js/Express production hardening
| | +-- README.md
| +-- php/
| | +-- php.sh # PHP production hardening (php.ini, FPM, nginx)
| | +-- README.md
| +-- postgresql/
| | +-- postgresql.sh # PostgreSQL server hardening
| | +-- README.md
| +-- postfix/
| | +-- postfix.sh # Full mail server (Postfix, Dovecot, OpenDKIM, rspamd, ClamAV)
| | +-- README.md
| +-- proxy/
| | +-- proxy.sh # Hardened Squid forward/transparent proxy + optional DNS filter
| | +-- README.md
| +-- react/
| | +-- react.sh # React/SPA production deployment hardening (nginx)
| | +-- README.md
| +-- ssh/
| | +-- ssh.sh # SSH server hardening (sshd_config, host keys)
| | +-- ssh_client.sh # SSH client configuration & key generation
| | +-- README.md
| +-- sysctl/
| | +-- sysctl.sh # Composable sysctl profile installer
| | +-- 60-awesome-security-core.conf # Shared compatible hardening
| | +-- 70-awesome-workstation-network.conf # IPv4/IPv6 host policy
| | +-- 80-awesome-performance.conf # Optional fq + BBR overlay
| | +-- 90-awesome-strict.conf # Compatibility-breaking overlay
| | +-- 90-awesome-ipv6-disabled.conf # Explicit IPv6-disable overlay
| | +-- WORKSTATION.md # Companion checklist for non-sysctl workstation tuning
| +-- totp/
| | +-- totp.sh # TOTP two-factor authentication for SSH
| | +-- README.md
| +-- u2f/
| | +-- u2f.sh # FIDO2/U2F hardware keys for local login (opt-in)
| | +-- README.md
| +-- wifi/
| | +-- wifi.sh # Wi-Fi scan MAC randomization + opt-in WPA3
| | +-- README.md
| +-- browser/
| | +-- browser.sh # Firefox/Chromium/Brave enterprise policies + Firejail
| | +-- README.md
| +-- memcrypt/
| | +-- memcrypt.sh # AMD SME / Intel TME probe and opt-in enable
| | +-- README.md
| +-- wireguard/
| | +-- wireguard.sh # WireGuard VPN server with client config generation
| | +-- README.md
| +-- wordpress/
| +-- wordpress.sh # WordPress security hardening
| +-- README.md
+-- tests/
| +-- run-tests.sh # Pure-Bash syntax and regression test runner
| +-- test_*.sh # Isolated unit & regression suites
+-- utils/
| +-- aide-config.sh # AIDE file integrity monitoring automation
| +-- audit-check.sh # Hardening compliance checker (pass/fail/warn report)
| +-- auditd-attack.rules # Auditd rules mapped to MITRE ATT&CK Framework
| +-- backup.sh # Encrypted borg backups with systemd timer
| +-- board-health.sh # ASUS ROG Zenith II Extreme Alpha thermal monitoring
| +-- brave.sh # Brave browser installer, ACL/SUID fixer & pacman hook
| +-- docker.sh # Docker/Podman hardening (rootless, seccomp, AppArmor)
| +-- monitoring.sh # Prometheus node_exporter + optional Grafana
| +-- gnome.sh # GNOME desktop setup (Wayland/NVIDIA & NM->resolved fixes)
| +-- neovim.sh # NeoVim + Treesitter configuration & hardening
| +-- nvme-stability.sh # Reversible NVMe power-management workaround for signed UKIs
| +-- vim.sh # Vim plugins & hardening
| +-- vmware-workstation.sh # VMware Workstation installer, SUID/ACL fixer & pacman hook
| +-- nano.sh # Nano configuration & hardening
| +-- zsh.sh # Zsh configuration & hardening
| +-- yay.sh # yay AUR helper installation (reviewed build; noexec /tmp & ACL safe)
| +-- theme.sh # Desktop & GRUB theming
| +-- zram.sh # zram-generator compressed RAM swap
| +-- cpufreq.sh # CPU governor via cpupower
| +-- iosched.sh # udev I/O scheduler by device type
| +-- vaapi.sh # VA-API / VDPAU packages and driver pin
| +-- gpu-unlock.sh # Optional Zagitta/gpu-unlock tensor-core unlock (RTX 20/30/40)
Features
Installation
- Automated Arch Linux Installation — Automates disk partitioning, formatting, mounting, base system installation, and chroot configuration.
- Full Disk Encryption (bare-metal) — LVM on LUKS2,
aes-xts-plain64cipher, 512-bit key,sha512hash, 3000ms iteration time. The key derivation function follows the boot profile: the GRUB profile usespbkdf2(GRUB cannot read Argon2id) and keeps/bootencrypted; the systemd-boot + UKI profile uses the strongerargon2iddefault. - TPM2 Support (bare-metal) — Optional TPM 2.0 auto-detection and LUKS key enrollment with configurable PCR binding (
7default,0+7,0+1+4+7+9, or custom PCR list). Defaulting to PCR 7 binds unlock to Secure Boot policy state so routine firmware updates do not invalidate unattended boot. - VPS/Cloud Mode — Simplified single-partition + swap file setup, BIOS/UEFI auto-detection, serial console support (
ttyS0+ GRUB serial), no encryption overhead. - VPS Live Hardening — For providers that pre-install Arch Linux (Hostinger, Linode, etc.): hardens filesystem mounts (
/tmp,/dev/shm,/proc,/var/tmp), generates a rollback script, and runs software hardening. Optional/varpreparation formats selected destination storage and writes instructions for copying and switching/varoffline from rescue media. - Recovery Tool — Interactive menu to unmount/remount encrypted installations and resume interrupted installs.
- UEFI Secure Boot — Generates PK/KEK/db/dbx keys, enrolls them in firmware, and signs the boot chain. The UKI profile signs the Unified Kernel Images, systemd-boot, and fwupd's EFI capsule updater with
sbctl, then re-signs them after package and kernel updates. - NVIDIA, AMD, and Intel GPU Detection — Automatically detects GPU hardware and installs the correct driver packages plus VA-API userspace (bare-metal only). Intel iGPUs no longer fall through to
xf86-video-vesa. - Optional NVIDIA Tensor-Core Unlock (
Zagitta/gpu-unlock) — Opt-in duringarchinstall.sh(disabled by default) or post-install viautils/gpu-unlock.sh(awesome-gpu-unlock). Buildsgpu-unlock-firmwareandgpu-unlock-dkmsin an unprivileged ACL-clean workspace, loadsgpu_unlockin initramfs ahead ofnvidiato unlock full-rate FP16/BF16/TF32 tensor cores on supported GeForce RTX 20 / 30 / 40 GPUs, and updates/re-signs UKI, systemd-boot, or GRUB kernel command lines (gpu_unlock.targets=allor specific PCI BDFs). - Mainline kernel — Installs the standard
linuxkernel. We previously shippedlinux-hardenedalongside it, but its stricter module signing and syscall hardening break the NVIDIA proprietary driver (XWayland/DRI3 path stops bridging, gnome-shell loops onFailed to init X11 display) and several other proprietary kmods. Users who needlinux-hardenedfor non-NVIDIA hardening can install it manually withpacman -S linux-hardened linux-hardened-headers. - CPU Microcode — Auto-detects Intel/AMD and installs the appropriate microcode package.
- Firmware and mobile broadband — Installs fwupd with automatic metadata refresh and ModemManager for NetworkManager WWAN support. The UKI profile configures fwupd for the locally generated Secure Boot keys.
Encryption & Key Management (bare-metal)
- LUKS2 container with passphrase, boot key file, and recovery key (3 key slots)
- LUKS header backup with secure external storage prompt
- Secure cleanup:
shredof all key material after installation - Swap on the LUKS-encrypted LVM volume (no double-crypt wrapper — avoids the systemd-cryptsetup-generator + LVM activation race that triggered
dev-mapper-swap.devicedependency failures on first boot) - Optional per-user home encryption —
hardening/fscrypt/layers ext4 fscrypt on top of LUKS, so each user's home is unreadable to root and other users while they are logged out. Tied to the login password viapam_fscrypt. Opt-in via--setupand--encrypt-user <name>.
Firewall
- nftables — Default deny policy, per-source SSH rate limiting (4 new connections per minute for each client address, so scan noise cannot lock out legitimate logins), stateful connection tracking, drop invalid packets. Configured automatically during installation.
- FireHOL — Optional iptables-based alternative firewall with FireHOL blocklists, explicit inbound-service selection, fail-closed daily updates, and mandatory per-commit AUR recipe review. It refuses to stack on the installer-owned nftables ruleset.
- nftables rate limiting — SSH brute-force protection via the SSH hardening script (uses the
inet filtertable; automatic iptables fallback on VPS kernels withoutnf_tables). - Composable sysctl profiles — Compatible workstation hardening by default, with explicit strict, fq + BBR performance, and IPv6-disable overlays plus companion guidance for
irqbalance, THP, swap,systemd-oomd, and other non-sysctl tuning inhardening/sysctl/.
Mandatory Access Control (AppArmor)
- AppArmor profiles for up to 7 services: nginx, sshd, fail2ban, ClamAV (freshclam + clamd), chronyd, and — only if the Stubby binary is installed manually as an opt-in — Stubby DNS. All are enforced except sshd, which starts in complain (log-only) mode so that a profile gap cannot lock out remote logins; review the log after the reboot and run
apparmor.sh --enforce. - Each profile uses
abi <abi/3.0>, precise path rules, minimal network access, and least-privilege capabilities. - Kernel boot parameters are configured across UKI, systemd-boot, and GRUB when running
hardening/apparmor/apparmor.sh: it ensuresapparmor=1and thatapparmoris in the kernel'slsm=list (an existing list is kept and extended;lsm=landlock,lockdown,yama,integrity,apparmor,bpfis only the fallback when none is set). AppArmor is not active until this has run and the machine has rebooted; check withcat /sys/kernel/security/lsmandaa-status. - See
hardening/apparmor/README.mdfor profile details and customization.
VPN (WireGuard)
- WireGuard server — One-command VPN setup with automatic key generation, pre-shared keys (quantum resistance), and client config files.
- nftables integration — Managed rules are inserted into the installer-owned default-deny chains, with one persistent NAT table and no duplicate
PostUprules. - Client provisioning — QR codes generated for each client config (mobile-friendly via
qrencode). - Multi-client support — Generate any number of clients with unique IPs.
- IPv4-only tunnel — Client IPv6 traffic bypasses the VPN unless the client configs are generated with
--block-ipv6, which routes IPv6 into the tunnel where it is dropped. The script refuses a VPN subnet that overlaps an existing address or route. - See
hardening/wireguard/README.mdfor usage and client management.
Intrusion Detection (CrowdSec)
- CrowdSec IDS — Behavior-based intrusion detection with community-powered threat intelligence.
- AUR trust gate — CrowdSec packages and transitive AUR dependencies require review and exact commit confirmation before an unprivileged build; no AUR helper runs unattended.
- nftables bouncer — Automatic IP banning via nftables sets.
- nginx bouncer — Layer-7 blocking for web attacks (SQLi, XSS, path traversal).
- Collections — Pre-installed detection scenarios for Linux, SSH, and nginx.
- See
hardening/crowdsec/README.mdfor setup and console enrollment.
Web Server Hardening (nginx)
- nginx-mainline with Let's Encrypt (certbot) — One-command setup targeting SSL Labs A+ and securityheaders.com A+.
- TLS — TLS 1.2 + 1.3 only, ECDHE + AEAD ciphers, X25519/P-384 curves, ECDSA P-384 certificates, session tickets disabled (forward secrecy), HTTP/2.
- Security headers — All six securityheaders.com graded headers (HSTS with 2-year preload, CSP, Permissions-Policy, Referrer-Policy, X-Content-Type-Options, X-Frame-Options) plus OWASP Cross-Origin headers (COEP, COOP, CORP).
- Hardening — Buffer limits, Slowloris timeouts, gzip disabled (BREACH prevention), dotfile/sensitive-file blocking, server tokens hidden.
- Auto-renewal — systemd timer runs certbot twice daily with nginx reload hook.
- OCSP — Intentionally disabled (Let's Encrypt ended OCSP support in 2025; browsers use CRLs).
- See
hardening/nginx/README.mdfor full details.
Application Hardening (React & Node.js)
- React/SPA (
react.sh) — Production deployment hardening via nginx: SPA routing, React-tuned CSP (script-src 'self'withoutunsafe-eval), aggressive static asset caching (1yr immutable for hashed files, no-cache forindex.html), source map blocking, dotfile protection, file permissions (root:http 750/640),.env.production.exampletemplate with security guidelines. - Node.js/Express (
nodejs.sh) — Dedicated system user, hardened systemd service (ProtectSystem=strict, 14+ security directives, V8 JIT-aware), nginx reverse proxy with rate limiting, WebSocket support,X-Powered-Bystripping, AppArmor profile, automated weeklynpm auditvia systemd timer, log rotation, secure environment file. - See
hardening/react/README.mdandhardening/nodejs/README.mdfor security best practices.
PHP Production Hardening
- php.ini lockdown — 30+ hardened directives:
expose_php=Off,display_errors=Off,allow_url_include=Off,open_basedirrestriction, session hardening (strictmode,httponly,samesite=Strict),disable_functions(30+ dangerous functions blocked),upload_max_filesizelimited. - PHP-FPM pool — Dedicated pool per application with
chroot,chdir,pm.max_childrentuning,security.limit_extensions=.php, status page on localhost only. - nginx FastCGI — Snippet with
fastcgi_param PHP_VALUEoverrides,PATH_INFOstripping, buffer limits. - systemd hardening —
ProtectSystem=strict,NoNewPrivileges, private tmp/devices, restricted capabilities. - See
hardening/php/README.mdfor framework-specific configurations (Laravel, WordPress, Symfony).
Database Hardening (PostgreSQL & MariaDB)
- PostgreSQL (
postgresql.sh) —initdbwith--data-checksums --auth-host=scram-sha-256, locked-downpg_hba.conf(notrustanywhere),pg_stat_statements, and systemd sandboxing. Remote mode fails closed unless given real TLS material and an explicit client CIDR enforced by both PostgreSQL and nftables. - MariaDB (
mariadb.sh) — Automatedmysql_secure_installationequivalent (removes anonymous users, test database, remote root), random root password saved to/root/.mariadb-root-pass(600 permissions),local-infile=0,skip-name-resolve,secure-file-priv,STRICT_TRANS_TABLESSQL mode, self-signed SSL certificate generation, systemd hardening, logrotate. - See
hardening/postgresql/README.mdandhardening/mariadb/README.mdfor backup strategies and common security mistakes.
WordPress Hardening
- wp-config.php — 11 security constants (
DISALLOW_FILE_EDIT,DISALLOW_FILE_MODS,FORCE_SSL_ADMIN,WP_AUTO_UPDATE_CORE), fresh salts from WordPress API, randomized table prefix. - File permissions —
root:httpownership, directories 750, files 640,wp-content/uploadswritable byhttponly. - nginx server block —
xmlrpc.phpblocked, PHP execution denied inwp-content/uploads, hidden files blocked, rate limiting onwp-login.phpandwp-admin. - fail2ban jails —
wordpress-auth(login brute-force) andwordpress-xmlrpc(XML-RPC abuse). - wp-cron — Replaces WP's unreliable pseudo-cron with a systemd timer (every 15 minutes).
- Updates — The code stays read-only for PHP; a daily timer applies core, plugin and theme updates through
awesome-wordpress-update, which runs wp-cli as a separate locked account in a systemd sandbox and seals the code again. - See
hardening/wordpress/README.mdfor plugin security and update strategies.
Docker Runtime Security
- CIS Docker Benchmark (
--bench) — Automated audit against the CIS Docker Benchmark, checks daemon configuration, container runtime, images, and host security. - Trivy image scanning (
--scan) — Vulnerability scanning for container images with weekly systemd timer for automated re-scans. - Compose hardening (
--compose PATH) — Audits Docker Compose files for 11 security issues (privileged mode, host networking, writable root filesystem, missing resource limits, etc.). - Network hardening (
--network) — Creates a fixed internal subnet and installs persistent nftables rules that block container-to-host and external forwarding by subnet rather than an unstable bridge name. - Security profiles — Keeps Docker's maintained built-in
docker-defaultAppArmor and default seccomp profiles; the former static profiles were weaker than current Docker defaults. - See
hardening/docker/README.mdfor container security best practices.
AI Agent Hardening (OpenClaw/ClawdBot)
- Gateway lockdown — Bind to loopback only, cryptographic token authentication (
openssl rand -hex 32), TrustedProxies hardening, Control UI secured. Addresses the 923+ OpenClaw gateways found exposed on Shodan with zero auth and full shell access. - Channel & DM policy — All messaging channels (WhatsApp, Telegram, Discord, Slack, Signal, Matrix, Teams, iMessage) locked to
pairingmode with per-channel allowlists. Groups require@mentiongating. Sessions isolated per-channel-peer. - Tool policy — Minimal
messagingprofile, exec restricted to sandbox with allowlist-only binaries (jq, grep, cut, sort, etc.), browser automation disabled, cross-context messaging blocked, elevated mode disabled by default. - Docker sandbox (optional) — All tool execution in isolated containers:
network: none,readOnlyRoot: true,capDrop: ALL, PID/memory/CPU limits, non-root user. - Plugin & skill lockdown — Deny-by-default plugin policy, ClawHub auto-install disabled, hooks disabled to prevent prompt injection.
- Secure logging — 9 API key redaction patterns (Anthropic, OpenAI, bearer tokens, PEM keys), log rotation,
redactSensitive: tools. - systemd system service — Root-owned
openclaw-gateway-<user>.servicethat runs as the service account (the account cannot edit its own unit or sandbox), withProtectSystem=strict,NoNewPrivileges, syscall filtering,MemoryDenyWriteExecute=no(V8 JIT). Earlier user-level units are stopped and removed on the next run. - AppArmor confinement (optional) — Enforce mode profile denying mount/ptrace/raw, restricting file access to
~/.openclaw/only. - nftables firewall (optional) — Blocks every non-loopback packet to the gateway port and rate-limits denial logging. Outbound traffic remains governed by the host firewall and service sandbox.
- Secret scanning —
detect-secretswith baseline and pre-commit hook, workspace git init for rollback. - 27 hardening steps across 15 phases with weekly automated security audit via systemd timer.
- See
hardening/openclaw/README.mdfor the complete deep-dive security reference.
SSH Hardening
- Server (
ssh.sh -u <user> [-p <port>]) — Generates host keys (Ed25519 + RSA 4096) on the first run or when they are missing or weak (-rforces new ones; fingerprints are printed), writes a complete hardenedsshd_configwith post-quantum KEX (sntrup761x25519-sha512), AEAD-only ciphers (ChaCha20-Poly1305, AES-256-GCM, AES-128-GCM), ETM-only MACs, public-key-only authentication (passwords disabled), all forwarding disabled (DisableForwarding yes), strict session limits (MaxSessions 2, MaxAuthTries 3), client alive timeout (300s), VERBOSE logging, revoked keys file, and a legal warning banner. Validates config withsshd -tand automatically rolls back on failure. Rate limits via nftables (iptables fallback on legacy VPS kernels). - Client (
ssh_client.sh) — Generates Ed25519 key pair, configures SSH client with matching modern algorithms, hashesknown_hosts, assists with public key deployment to servers. - Key Rotation — Automated quarterly SSH key rotation via cron.
- See
hardening/ssh/README.mdfor algorithm details and testing commands.
Two-Factor Authentication (TOTP)
- SSH 2FA (
totp.sh) — Google Authenticator/TOTP for SSH withpam_google_authenticator. - Multi-factor enforcement — Configures
AuthenticationMethods publickey,keyboard-interactive(SSH key + TOTP required) in ansshd_config.ddrop-in when the main configuration includes that directory. The candidate configuration is validated withsshd -tbefore anything changes, and PAM and sshd files are restored if any step fails.ssh.shincludes that drop-in first, so re-running it keeps TOTP in force; it warns in the one case wheretotp.shhas to be run again. - Fail-closed by default — TOTP enrollment completes before PAM changes and
nullokis absent by default.--allow-missing-totpis the explicit staged-rollout escape hatch. An existing secret is kept on re-runs;--rotateissues a new one. - Emergency scratch codes — Backup codes generated for account recovery.
- See
hardening/totp/README.mdfor compatible apps and setup guide.
Hardware Security Keys (FIDO2 / U2F)
- Local login (
u2f.sh) — Enrolls YubiKey / any CTAP2 token withpamu2fcfgand wirespam_u2finto local login stacks. - SSH stays on OpenSSH native
ed25519-skkeys — the script refuses to stackpam_u2fon top of the existing publickey + TOTP path. - Fail-closed enrollment — PAM is not changed until a mapping exists, unless
--allow-missingis passed for a staged rollout. - See
hardening/u2f/README.mdfor lockout and origin gotchas.
Wi-Fi Privacy
- Scan-time MAC randomization is now explicit in the bare-metal NetworkManager drop-in (
wifi.scan-rand-mac-address=yes). Associated MACs staystableper SSID so home DHCP reservations keep working. - WPA3/SAE is per-network, never global.
hardening/wifi/wifi.sh --wpa3-connection NAMEflips one saved profile. - See
hardening/wifi/README.md.
Browser Hardening
- Enterprise policies for Firefox, Chromium/Chrome, and Brave (telemetry off, HTTPS-Only, site isolation, third-party cookies blocked, uBlock Origin Lite).
utils/brave.shalso installs a pacmanPostTransactionhook so/opt/brave-binpermissions, stripped POSIX ACLs, and the4755chrome-sandboxsurvive every AUR upgrade. - Optional Firejail wrappers (
--firejail) and optional arkenfox overlay (--arkenfox). A stale vendoreduser.jsis not shipped. - Custom AppArmor browser profiles are omitted; they rot against GPU, portals, and downloads. The sysctl
strictprofile'skernel.unprivileged_userns_clone=0degrades Chromium's sandbox — desktops should stay onworkstation. - See
hardening/browser/README.md.
Memory Encryption (opt-in)
- AMD SME / Intel TME probe and staged enable live in
hardening/memcrypt/.mem_encrypt=onis never injected by the installer. - Intel TME is firmware-controlled; the script reports the
tmeflag and stops.
Extended Intrusion Prevention (fail2ban)
- 7 jails — SSH (24h ban, 3 retries), SSH-aggressive (7d ban, 1 retry for invalid users), nginx-http-auth, nginx-botsearch (7d ban), nginx-limit-req, and recidive (4-week ban for repeat offenders).
- nftables integration — Uses
nftables-multiportandnftables-allportsban actions (no iptables dependency). - Custom filters — Aggressive SSH filter catches invalid users, unauthenticated disconnects, and bad protocol versions.
- See
hardening/fail2ban/README.mdfor jail descriptions and ban management.
Time Security (Chrony NTS)
- Network Time Security — Authenticated NTP via TLS 1.3 (RFC 8915), preventing MITM attacks on time synchronization.
- 6 NTS servers — Cloudflare, Netnod (Sweden), PTB (Germany), Netnod Stockholm.
- Client-only mode —
port 0disables NTP server functionality;cmdallowrestricted to localhost. - Hardened systemd service —
CAP_SYS_TIMEonly, strict filesystem protection, clock syscall filter. - See
hardening/chrony/README.mdfor NTS verification and troubleshooting.
Full Mail Server (Postfix)
- Inbound and outbound mail — Full MX with Postfix, Dovecot IMAP/LMTP, OpenDKIM, rspamd, Valkey, and ClamAV.
- Security — TLS 1.2+, DANE guidance, DKIM/SPF/DMARC/ARC, authenticated submission, TLS-only IMAP, and fail-closed milter availability.
- Optional relay — Supports an outbound SMTP provider; credentials are read from a private file rather than command-line arguments.
- See
hardening/postfix/README.mdfor DNS, mailbox, and relay setup.
Kernel Hardening (sysctl)
The installers offer three composable sysctl profiles:
workstation— the default, compatibility-oriented security and non-router network baselinestrict— adds compatibility-breaking restrictions for user namespaces, io_uring, BPF, kexec, debugging, SysRq, and panic behaviorperformance— adds only fq + BBR and MTU black-hole probing to the workstation baseline
IPv6 remains enabled and hardened by default so SLAAC works. The installer offers a separate, explicit IPv6-disable overlay for networks that forbid it. Managed settings are split into numbered /etc/sysctl.d/ layers so precedence and local overrides remain visible:
- Core — protected symlinks/hardlinks/FIFOs, restricted core dumps, ASLR, low-address protection, restricted
dmesg, BPF, pointers, tracing, and performance events. - Network — disabled forwarding and redirects, source-route rejection, loose reverse-path filtering for VPN compatibility, normal ping diagnostics, SYN cookies, IPv6 privacy addresses, and working router advertisements.
- Strict overlay — the one-way and compatibility-sensitive controls are opt-in and documented as such.
kernel.modules_disabled=1is not applied automatically; a separately confirmed late-lock helper is provided for fixed-purpose systems.
Kernel Boot Parameters
Passed via GRUB or embedded into signed systemd-boot UKIs (/etc/kernel/cmdline) for defense-in-depth: slab_nomerge, init_on_alloc=1, init_on_free=1, page_alloc.shuffle=1, pti=on, randomize_kstack_offset=on, vsyscall=none. AMD SME (mem_encrypt=on) is not in this baseline; enable it with hardening/memcrypt/memcrypt.sh after the firmware switch is on.
Workstation Performance (opt-in)
These are companion utilities, not silent installer defaults (except the I/O scheduler udev rule, which is low-risk and now written by chroot.sh):
- zram (
utils/zram.sh) —zram-generatorat 50% RAM / zstd / priority 100, disk swap kept as overflow. Built-in kernelzswapis disabled persistently viatmpfiles.d; stacking zswap + zram double-compresses pages. - CPU governor (
utils/cpufreq.sh) —cpupowerwithschedutil(orperformanceon request). Refuses to run alongside power-profiles-daemon, TLP, auto-cpufreq, or tuned. - I/O scheduler (
utils/iosched.sh) — BFQ for HDDs,mq-deadlinefor SATA/virtio SSD,nonefor NVMe. - NVMe dropout workaround (
utils/nvme-stability.sh) — Pure-Bash opt-in power-management diagnostic for existing signed UKI installs, with staged builds, signature verification, backups and rollback. See NVMe stability and offline recovery. - Motherboard thermal monitoring (
utils/board-health.sh) — Pure-Bash exact ASUS ROG Zenith II Extreme Alpha detection enables minute-by-minute CPU, chipset, VRM and NVMe monitoring on bare-metal installs. Sustained heat and missing sensors produce journal warnings; existing installs can use--install. See board support and tuning notes. - VA-API (
utils/vaapi.sh) — vendor-correct packages and a pinnedLIBVA_DRIVER_NAMEonly when the GPU is unambiguous. Hybrid Intel+NVIDIA laptops are left unpinned on purpose. - NVIDIA tensor-core unlock (
utils/gpu-unlock.sh/awesome-gpu-unlock) — OptionalZagitta/gpu-unlockinstaller and manager (--status,--install,--set-targets,--disable,--uninstall) for supported Turing (RTX 20), Ampere (RTX 30), and Ada Lovelace (RTX 40) GPUs across UKI + Secure Boot (sbctl), systemd-boot, and GRUB.
DNS Security
- DNS-over-TLS via
systemd-resolved's native DoT support (Cloudflare1.1.1.1/1.0.0.1primary, Quad99.9.9.9/149.112.112.112fallback). A single-daemon stack avoids the NetworkManager/resolved handoff drift that a separate forwarder introduces. - systemd-resolved configured with
DNSOverTLS=yes,DNSSEC=allow-downgrade,Cache=yes,Domains=~., and no multicast DNS / LLMNR./etc/resolv.confis symlinked to the resolved stub and NetworkManager usesdns=systemd-resolved. - DHCP DNS rejected — Network configuration ignores DNS from DHCP to prevent DNS hijacking.
- Stubby is no longer part of the default install path. Users who specifically want a separate DoT forwarder on a server/VPS can install and configure it manually (
pacman -S stubby) — the previous Stubby wiring was removed because the NetworkManager -> resolved -> Stubby handoff drifted out of sync on desktops and broke DNS.
Authentication Hardening
- PAM faillock — Account lockout after 5 failed attempts, 15-minute unlock time.
- Password quality (
pam_pwquality) — Minimum 12 characters, requires uppercase, lowercase, digit, and symbol. Enforced for root. - login.defs — YESCRYPT encryption (cost factor 7), HMAC SHA512, UMASK 027, fail delay 5s, login timeout 30s, max retries 3, password max age 730 days,
HOME_MODE 0700(new accounts get a private home).
Sudo Hardening
Custom /etc/sudoers with: secure path, env reset with curated keep list, umask=077, 30-minute timestamp timeout, 3 password attempts, full I/O logging to /var/log/sudo.log, no rootpw.
Systemd Service Hardening
Granular per-service hardening overrides applied via drop-in files in /etc/systemd/system/<service>.d/hardening.conf.
Directive Reference
Every directive below is a systemd [Service] option. Understanding what each one does — and what it breaks — is critical to avoiding service failures.
Filesystem Protection
| Directive | What it does | What it breaks if misused |
|---|---|---|
ProtectSystem=strict |
Makes the entire filesystem tree read-only. Only paths listed in ReadWritePaths= are writable. |
Service cannot write state, PID files, logs, or caches unless every writable path is listed. Most services need at minimum /run for PID/sockets. |
ProtectSystem=full |
Makes /usr and /boot read-only but leaves /etc and /var writable. Less restrictive than strict. |
Less dangerous than strict, but services that write to /usr (rare) will fail. |
ReadWritePaths= |
Whitelist of paths the service can write to when ProtectSystem=strict is active. Space-separated. |
Forgetting a path means silent write failures. Common misses: /run (PID files, sockets), /var/lib/<service> (state), /etc/<service> (dynamic config). |
ProtectHome=yes |
Makes /home, /root, and /run/user completely inaccessible (empty). |
ClamAV cannot scan user files. sshd cannot read authorized_keys (use read-only instead). Any service that reads user data breaks. |
ProtectHome=read-only |
Makes home directories visible but read-only. | Services that write to home directories fail. Appropriate for sshd (reads authorized_keys) and ClamAV (scans files). |
PrivateTmp=yes |
Gives the service its own /tmp and /var/tmp (isolated from other processes). |
Breaks services that communicate with other processes via temp files. Safe for most services. |
Privilege Escalation
| Directive | What it does | What it breaks if misused |
|---|---|---|
NoNewPrivileges=yes |
Prevents the service and ALL child processes from gaining privileges via setuid/setgid bits, file capabilities, or other mechanisms. Inherited by every spawned process. | sshd: breaks sudo for all SSH sessions (children inherit the flag). fail2ban: ban action scripts that call sudo or setuid binaries fail. Safe for leaf services that don't spawn user processes. |
NoNewPrivileges=no |
Explicitly allows privilege escalation. Required for services that spawn user sessions (sshd) or execute setuid binaries (fail2ban ban actions). | No security restriction — this is the default. |
RestrictSUIDSGID=yes |
Prevents creating or executing files with setuid/setgid bits. | Same impact as NoNewPrivileges for setuid — breaks sudo, su, passwd, ping in child processes. Must be no (or omitted) for sshd and fail2ban. |
RemoveIPC=yes |
Destroys all System V and POSIX IPC objects (shared memory, semaphores, message queues) when the last process of the service exits. | sshd: destroys shared memory used by databases (PostgreSQL, Redis) when the last SSH session closes. journald: corrupts memory-mapped journal files during restart. |
Kernel Protection
| Directive | What it does | What it breaks if misused |
|---|---|---|
ProtectKernelTunables=yes |
Makes /proc/sys, /sys, /proc/sysrq-trigger, and /proc/acpi read-only. |
NetworkManager: cannot write to /proc/sys/net/ (IP forwarding, rp_filter, IPv6 params). Chrony: cannot read kernel PLL status from /proc/sys/kernel/. auditd: cannot access /proc/sys/kernel/audit*. |
ProtectKernelModules=yes |
Blocks finit_module()/init_module() syscalls and makes /usr/lib/modules inaccessible. |
NetworkManager: cannot load VPN, bridge, VLAN, bonding, or WireGuard kernel modules on demand. Safe for services that never load modules. |
ProtectKernelLogs=yes |
Blocks access to /dev/kmsg and /proc/kmsg (kernel log buffer). |
journald: cannot capture kernel messages (dmesg). Safe for all other services. |
ProtectControlGroups=yes |
Makes /sys/fs/cgroup read-only. |
Safe for most services. Only breaks services that dynamically create or modify cgroups. |
ProtectClock=yes |
Blocks adjtimex(), clock_adjtime(), and write access to /dev/rtc. |
Chrony: cannot set system time (must be no). Safe for all non-NTP services. |
Device Access
| Directive | What it does | What it breaks if misused |
|---|---|---|
PrivateDevices=yes |
Creates a private /dev mount with only pseudo-devices (null, zero, full, random, urandom). Hardware devices and /dev/ptmx are NOT available. |
sshd: cannot allocate PTYs — interactive SSH sessions fail with "PTY allocation request failed". rngd: cannot access /dev/hwrng. Safe for network-only daemons (stubby, chrony, fail2ban). |
DevicePolicy=closed |
Only allows access to pseudo-devices (/dev/null, /dev/zero, /dev/random). More restrictive than auto. |
Similar to PrivateDevices=yes. Combined with it, doubly ensures no hardware access. |
DevicePolicy=auto |
Default policy — no device restrictions. | No restriction. Use when PrivateDevices=no is needed. |
Memory & Execution
| Directive | What it does | What it breaks if misused |
|---|---|---|
MemoryDenyWriteExecute=yes |
Blocks mmap() with PROT_WRITE|PROT_EXEC and mprotect() to add PROT_EXEC. Prevents JIT compilation and self-modifying code. |
fail2ban: Python's ctypes/libffi needs W^X trampolines — service crashes. ClamAV: bytecode JIT engine disabled, falls back to slow interpreter. NetworkManager/Bluetooth: GLib's libffi signal marshalling may crash. Node.js/V8: JIT broken. Safe for C daemons without JIT (stubby, chrony, sshd). |
LockPersonality=yes |
Prevents changing the execution personality (e.g., switching to 32-bit mode). | Safe for virtually all services. |
System Call Filtering
| Directive | What it does | What it breaks if misused |
|---|---|---|
SystemCallFilter= |
Whitelist of allowed syscall groups. Calls outside the list return EPERM (or SIGSYS). Common groups: @system-service (base), @network-io, @file-system, @privileged, @clock, @module, @raw-io. |
Replaces (not extends) any upstream filter. If the upstream unit already has a tuned filter, your drop-in will override it — this is why systemd-resolved should NOT get a custom drop-in. Too-restrictive filters cause silent failures or crashes. |
SystemCallErrorNumber=EPERM |
Blocked syscalls return EPERM instead of killing the process with SIGSYS. |
Safer than the default (SIGSYS) — service gets an error code it can handle instead of being killed. Always use this with SystemCallFilter. |
SystemCallArchitectures=native |
Only allows syscalls for the native architecture (blocks 32-bit compat). | Safe for most services. May break 32-bit binaries or multilib applications. |
Network Restrictions
| Directive | What it does | What it breaks if misused |
|---|---|---|
RestrictAddressFamilies= |
Whitelist of allowed socket address families. Common: AF_UNIX (local), AF_INET/AF_INET6 (network), AF_NETLINK (kernel comms), AF_BLUETOOTH. |
Missing AF_NETLINK breaks iptables/nftables, routing, and many system queries. Missing AF_INET6 breaks IPv6. Bluetooth needs AF_BLUETOOTH. auditd needs AF_NETLINK. |
IPAddressAllow= / IPAddressDeny= |
IP-level firewall within systemd. IPAddressDeny=any blocks all network traffic. |
Blocks ALL IP traffic including localhost. Use IPAddressAllow=any to override. |
Namespace & Misc Restrictions
| Directive | What it does | What it breaks if misused |
|---|---|---|
RestrictNamespaces=yes |
Prevents creating new namespaces (mount, UTS, IPC, PID, network, user, cgroup). Inherited by child processes. | sshd: user sessions cannot use podman, flatpak, unshare, systemd-run --user, or any containerization tool. Safe for leaf services. |
RestrictRealtime=yes |
Blocks realtime scheduling policies (SCHED_FIFO, SCHED_RR). |
Safe for most services. Only breaks services that explicitly need realtime scheduling (audio, some databases). |
RestrictSUIDSGID=yes |
Prevents creating files with setuid/setgid bits and executing them. | See NoNewPrivileges — same impact on sudo/su. |
CapabilityBoundingSet= |
Limits which Linux capabilities the service can hold. Empty value (=) drops ALL capabilities. |
Empty bounding set breaks any service that needs privileged operations. rngd needs CAP_SYS_ADMIN. Chrony needs CAP_SYS_TIME. NetworkManager needs CAP_NET_ADMIN. |
AmbientCapabilities= |
Grants capabilities to non-root processes. Used with User= to give specific powers without running as root. |
Must be paired with a matching CapabilityBoundingSet that includes the capability. |
Resource Limits
| Directive | What it does | What it breaks if misused |
|---|---|---|
TasksMax= |
Maximum number of threads/processes the service can create. | ClamAV with TasksMax=4 is starved — default MaxThreads is 12. journald with low limits drops log connections. Set to at least the service's expected thread count. |
LimitNOFILE= |
Maximum open file descriptors. | journald default is 524288; setting 1024 causes log loss. Set appropriately per service. |
Per-Service Hardening Applied
| Service | Key Settings | Notes |
|---|---|---|
| sshd | ProtectSystem=no, ProtectHome=no, NoNewPrivileges=no, PrivateDevices=no |
sshd spawns user shells — its children need normal filesystem access, sudo, PTYs, and privilege escalation. No syscall filter (too restrictive for user sessions). |
| NetworkManager | ProtectSystem=strict, ReadWritePaths=..., ProtectKernelTunables=no, ProtectKernelModules=no, NoNewPrivileges=no |
Needs to load modules, write tunables, manage devices. No MemoryDenyWriteExecute (GLib/libffi). |
| auditd | ProtectSystem=full, ReadWritePaths=/var/log/audit /run, AF_UNIX AF_NETLINK |
Manages kernel audit subsystem. Needs netlink for audit interface. Cannot use strict or ProtectKernelTunables. |
| ClamAV | ProtectSystem=strict, ProtectHome=read-only, TasksMax=16 |
Needs to read home dirs for scanning. No MemoryDenyWriteExecute (bytecode JIT). |
| fail2ban | ProtectSystem=strict, NoNewPrivileges=no, CAP_NET_ADMIN CAP_NET_RAW |
Python app — no MemoryDenyWriteExecute. Ban actions may need privilege escalation. |
| Stubby (opt-in only) | User=stubby, ProtectSystem=strict, PrivateDevices=yes, AF_UNIX AF_INET AF_INET6 |
Dedicated user, network I/O only. Safe for full isolation. Applies only if the user installs Stubby manually; the default install uses systemd-resolved native DoT. |
| Chrony | ProtectKernelTunables=no, ProtectClock=no, CAP_SYS_TIME, @clock syscalls |
Needs kernel tunable reads and clock adjustment. |
| Bluetooth | Upstream ProtectSystem=strict, ProtectHome=true, MemoryDenyWriteExecute=true, StateDirectory=bluetooth; local AF_UNIX AF_BLUETOOTH restriction |
Keeps BlueZ's packaged sandbox intact and narrows its socket families. Pairing data stays in the upstream-managed 0700 state directory. Bare-metal only. |
| systemd-resolved | No custom drop-in — upstream is already hardened | Custom drop-ins replace (not extend) upstream's tuned syscall filter, breaking resolved. |
| systemd-journald | No custom drop-in — upstream is already hardened | Needs /dev/kmsg, capabilities, full proc access. Generic templates break all logging. |
| rngd | No custom drop-in — needs /dev/hwrng and CAP_SYS_ADMIN |
Generic templates block device access and drop capabilities, making it useless. |
Validation and SHH
The installers run systemd-analyze verify against every managed unit after
the upstream unit and local drop-ins have been composed. A malformed unit stops
the installation before first boot. utils/audit-check.sh repeats that check on
the running host, reports failed units, and exercises the control interfaces for
sshd, NetworkManager, auditd, ClamAV, fail2ban, chronyd, and USBGuard. This
checks service function as well as unit syntax.
systemd-analyze security is useful for reviewing the remaining attack surface,
but its exposure score is not an acceptance target. For example, forcing sshd's
score down by hiding devices, homes, namespaces, or privilege transitions also
applies those restrictions to every interactive SSH session.
SHH can supplement this review by tracing a daemon and suggesting service-specific directives. Its output is tied to the exact kernel, systemd, libraries, distribution, configuration, and code paths observed during profiling, so generated fragments are never copied into the installer or applied automatically. Use standard mode on a disposable snapshot of the actual target, exercise representative startup, reload, failure, and upgrade paths, review the output manually, and repeat the functional probes and a reboot before keeping a change. Avoid generic profiles for session and host management services such as sshd, NetworkManager, auditd, and core systemd units; hardware daemons also require representative hot-plug coverage.
Anti-Malware & Intrusion Detection
- ClamAV — Full configuration with PUA detection, heuristic alerts, encrypted archive alerts, all file type scanning enabled. Auto-updating signatures via
clamav-freshclam.service. - rkhunter — Rootkit detection with daily automated checks via systemd timer.
- AIDE — File integrity monitoring with custom rules (NORMAL, DIR, PERMS, LOG, DATAONLY), monitors
/boot,/etc,/usr/bin,/usr/sbin, sensitive config files. Daily checks preserve AIDE's exit status so detected changes and scan errors are visible as failed systemd units. Seeutils/aide-config.sh. - auditd — MITRE ATT&CK-mapped audit rules (~500 rules covering initial access, execution, persistence, privilege escalation, defense evasion, credential access, discovery, lateral movement, collection, exfiltration, and C2).
- fail2ban — Jails covering SSH, nginx, and recidive (repeat offenders), plus
postfix-saslanddovecotwhen those packages are installed.fail2ban.sh -i ADDRESS(repeatable) adds addresses that are never banned. - CrowdSec — Behavior-based IDS with community threat intelligence and the nftables bouncer. The nginx bouncer is installed and registered; the script prints the steps for putting its API key into the bouncer configuration.
- arch-audit — Daily vulnerability scanning for installed packages via systemd timer.
- lynis — Security auditing framework for compliance checking.
- arpwatch — ARP spoofing detection and monitoring.
Encrypted Backups (borg)
- borg — Encrypted, deduplicated backups with
repokey-blake2encryption andzstdcompression. - Automatic backup — Daily at 2:00 AM via systemd timer with 30-minute random delay.
- Configurable retention — Default: 7 daily, 4 weekly, 6 monthly archives.
- Managed operations —
--init,--backup,--prune,--list,--restoremodes. - Includes:
/etc,/home,/root,/var/lib,/var/log,/var/spool/cron,/opt.
Monitoring (Prometheus & Grafana)
- node_exporter — Prometheus metrics exporter with systemd, filesystem, CPU, memory, network, disk, and process collectors. Listens on localhost only.
- Custom security textfile collector — Exports pending updates count, failed SSH logins, fail2ban bans, and failed systemd units (runs every 5 minutes).
- Prometheus server (optional) — 15-second scrape interval, 30-day retention, localhost-only.
- Grafana (optional) — Hardened configuration with security cookies, CSP headers, Prometheus auto-provisioned as datasource.
Container Hardening (Docker & Podman)
- Podman (default, recommended) — Rootless containers with
crunruntime,fuse-overlayfsstorage,short-name-mode=enforcing, journald logging, auto-update timer, subuid/subgid configuration. - Docker (optional) — Hardened
daemon.json(ICC disabled, no-new-privileges, userland-proxy off, json-file log rotation, overlay2, seccomp profile,DOCKER_CONTENT_TRUST=1), systemd service hardening. - Both modes include container-specific sysctl settings and a 10-point security best practices checklist.
Hardening Compliance Checker
- audit-check.sh — Validates that all AwesomeArchLinux hardening has been correctly applied.
- Profile-aware checks across 9 categories: kernel hardening (sysctl), filesystem security, authentication, SSH, network, services, boot security, disabled modules, and optional workstation modules (WARN if missing).
- Output modes — Color-coded terminal output (
[PASS]/[FAIL]/[WARN]),--verbosefor actual values,--jsonfor machine-readable output. - Scoring — Final pass/fail score with percentage.
Physical Security (bare-metal only)
- USBGuard — Default-block policy with a one-time allow policy generated for devices present at the first service start; root IPC access remains available to authorize later devices.
- Bluetooth — Hardened BlueZ profile (
ControllerMode=dualby default so A2DP audio and BLE peripherals both work;BLUETOOTH_CONTROLLER_MODE=leavailable for BLE-only) with Secure Connections required, a 16-byte minimum key for secured GATT characteristics, device privacy, a generic adapter name, and 90-second discoverable/pairable windows. BlueZ's upstream systemd sandbox is retained and its socket families are restricted toAF_UNIX AF_BLUETOOTH. - Disk health monitoring —
smartdscans all SATA and NVMe devices, schedules a short self-test daily and a long self-test weekly where supported (NVMe drives present at install time are monitored without scheduled self-tests, which have coincided with controller dropouts), and tracks drive temperature (advisory entries logged at 50 °C; the 70 °C critical threshold raises an alert). Alerts are written to the journal and the console rather than mailed, so they arrive without a configured MTA.nvme-cliis installed for post-incident investigation (nvme smart-log,nvme error-log).
File System Security
- Mount hardening — Bare-metal installs use a dedicated encrypted
/tmpLV (10 GiB, or 25 GiB on disks of at least 1 TB); VPS paths use a tmpfs ceiling with the same sizing policy./tmpand/dev/shmusenosuid,nodev,noexecwhere workload compatibility allows it, and/procuseshidepid=2. - TRIM deliberately disabled — discards are not passed through LUKS (no
--allow-discards, no LVMissue_discards, nofstrim.timer). Forwarding discards would leak filesystem usage patterns into the ciphertext. This costs SSD wear levelling and is an intentional trade, not an oversight. - Permissions —
/boot(700),/etc/shadow(600),/etc/gshadow(600),sshd_config(600),grub.cfg(no world access),sudoers(440),login.defs(644). /homeis traversable but not listable —chmod 0711 /homelets userscd ~butls /homereveals no usernames to non-root observers. Per-user dirs stay 700 viaHOME_MODE 0700in/etc/login.defsand explicitchmod 700at user creation.- UMASK 027 — Set globally in
/etc/profile,/etc/bash.bashrc, and/etc/login.defs. - Home directory ACLs — Default ACLs restrict group and other access.
- Compiler restrictions —
gcc,g++,clang,make,as,ldrestricted tocompilersgroup (750).
/tmp Capacity Policy
| Installation path | Backing storage | Disk below 1 TB | Disk at least 1 TB |
|---|---|---|---|
| Bare metal | Dedicated ext4 LV inside the encrypted LUKS/LVM container | 10 GiB | 25 GiB |
| VPS installer | tmpfs | 10 GiB ceiling | 25 GiB ceiling |
| VPS live hardening | tmpfs | 10 GiB ceiling | 25 GiB ceiling |
The bare-metal layout keeps temporary workloads off RAM and prevents /tmp
from consuming the root or home filesystem. On VPS systems, the tmpfs value is
a maximum rather than reserved memory; pages consume RAM and swap only as files
are written. /dev/shm remains independently capped at 2 GiB.
The compliance audit reports a failure when /tmp is smaller than 10 GiB. To
inspect a running system:
findmnt -b -o SOURCE,FSTYPE,SIZE,OPTIONS /tmp
This policy applies automatically to new installations and when rerunning the VPS live-hardening workflow. Existing bare-metal installations are not resized automatically because changing an established LVM layout requires a separate, recovery-aware migration.
Protocol Hardening
- Disabled kernel modules:
dccp,sctp,rds,tipc. - Core dumps disabled via
/etc/security/limits.conf. - Hardened compiler flags in
makepkg.conf:-fstack-protector-strong,-D_FORTIFY_SOURCE=2,-Wl,-z,relro,-z,now, PIE.
Monitoring & Maintenance
- Prometheus + Grafana — Full monitoring stack with security-focused textfile collector.
- sysstat — System performance accounting.
- logrotate — Daily rotation, 7-day retention, compressed.
- journald — Persistent storage, compression, 200MB max, and sealing keys initialized before the first boot's journal flush. Move the verification key from
/root/journal-sealing/to trusted off-machine storage, verify the copy, then remove its local copy; see the post-installation checklist. - Update notifications — Daily
checkupdatesrun against a temporary sync database via systemd timer (logs available updates to/var/log/pacman-updates.logwithout changing the live package database or auto-installing).
GRUB Security
- Password protection — PBKDF2-hashed GRUB password required to edit boot entries.
- Encrypted boot (bare-metal) — GRUB unlocks LUKS with embedded key file.
- Serial console (VPS) — GRUB configured for serial output for VPS provider console access.
Utilities
| Script | Description |
|---|---|
utils/aide-config.sh |
AIDE file integrity monitoring with custom rules and daily systemd timer |
utils/audit-check.sh |
Profile-aware hardening compliance checker (dynamic service validation, 9 categories, JSON output) |
utils/backup.sh |
Encrypted borg backups with configurable retention and systemd timer |
utils/docker.sh |
Docker/Podman hardening (rootless Podman default, hardened Docker option) |
utils/monitoring.sh |
Prometheus node_exporter + optional Prometheus server + Grafana |
utils/gnome.sh |
Minimal GNOME desktop installation (no games/bloat). Installer configures NVIDIA Wayland (kms-modifiers, egl-wayland, Qt Wayland plugins, GDM Wayland-block rule override), sets GSK_RENDERER=ngl on NVIDIA to avoid GTK segfaults, and wires the NM→systemd-resolved DNS handoff. Requires the user to be in the proc group (the base installer adds this automatically); without it, gnome-shell loses logind session tracking because of our /proc hidepid=2,gid=proc mount. |
utils/neovim.sh |
NeoVim with Treesitter syntax highlighting |
utils/vim.sh |
Vim with plugins and hardening |
utils/nano.sh |
Nano with backups, locking, and syntax highlighting |
utils/zsh.sh |
Zsh shell configuration and hardening |
utils/yay.sh |
yay AUR helper installation through the reviewed AUR builder (needs a terminal for the recipe review; safe under /tmp noexec and home default ACLs) |
utils/brave.sh |
Brave Browser installer (reviewed AUR build, needs a terminal), /opt/brave-bin permission/ACL/SUID fixer, pacman upgrade hook, and policy helper |
utils/vmware-workstation.sh |
VMware Workstation AUR installer (reviewed AUR build, needs a terminal; AUR_HELPER is ignored), group-restricted SUID/library permissions, and pacman upgrade hook |
utils/board-health.sh |
Pure-Bash ASUS ROG Zenith II Extreme Alpha EC/NVMe thermal monitor and systemd timer |
utils/nvme-stability.sh |
Pure-Bash reversible NVMe APST/ASPM workaround for signed UKI installations |
utils/zram.sh |
zram-generator compressed RAM swap with persistent zswap disablement |
utils/cpufreq.sh |
CPU scaling governor configuration via cpupower |
utils/iosched.sh |
Automatic udev I/O scheduler rules by block device type |
utils/vaapi.sh |
Hardware video acceleration (VA-API / VDPAU) setup |
utils/theme.sh |
WhiteSur GTK and GRUB theming (upstream installers pinned to a tag and verified commit; the GRUB theme is generated unprivileged) |
Installation
First, download the Arch Linux ISO here.
Bare-metal (Full Disk Encryption)
Boot the media on the target device.
pacman -Sy git
git clone https://github.com/schm1d/AwesomeArchLinux.git
cd AwesomeArchLinux/base
chmod +x *.sh
./archinstall.sh
The installer will prompt you for:
- Target disk and boot profile (
ukisigned systemd-boot UKIs orgrubencrypted/boot) - Swap, root, and optional
/varpartition sizes - Username, hostname, and optional SSH public key
- Timezone, locale, and console keymap (with common presets and live preview via
loadkeys) - LUKS encryption passphrase
- Optional TPM2 binding and PCR selection
- Sysctl profile and IPv6 policy
- GRUB password (
grubprofile only) - User and root passwords
VPS / Cloud Server
Boot the Arch Linux ISO on your VPS (most providers support custom ISOs).
pacman -Sy git
git clone https://github.com/schm1d/AwesomeArchLinux.git
cd AwesomeArchLinux/base
chmod +x *.sh
./vps-install.sh
The VPS installer will prompt you for:
- Target disk (typically
vdaorsda) - Swap size
- Username, hostname, SSH port, and SSH public key
- Timezone, locale, and console keymap (with common presets)
- Sysctl profile and IPv6 policy
- User and root passwords
VPS Live Hardening (pre-installed Arch Linux)
If your VPS provider already has Arch Linux installed and you cannot boot from a live ISO:
curl -fsSLO https://raw.githubusercontent.com/schm1d/AwesomeArchLinux/main/base/vps-harden.sh
chmod +x vps-harden.sh
sudo ./vps-harden.sh
Preview changes first with --dry-run, or run filesystem-only hardening with --skip-var --skip-sw. A rollback script is generated at /root/undo-vps-harden.sh. See base/README.md for full options.
Separating /var requires rescue downtime. Storage preparation writes
/root/MIGRATE_VAR_OFFLINE.txt; the live script leaves /var in place.
Use --skip-var if no rescue environment is available.
Offline Installation
Download the scripts on another machine and copy them to a removable media.
- Copy the full repository to the live system, preserving
base/,hardening/, andutils/; the installers stage shared helpers from these directories. - Enter
base/and make the scripts executable:chmod +x *.sh - Run the installer:
./archinstall.shor./vps-install.sh
Post-Installation
After rebooting:
Run the security packages script as root (from a terminal):
sudo /root/install-aur-packages.shPackages available in signed repositories are installed with pacman. Each AUR recipe requires review and confirmation of its exact commit; builds run as a disposable unprivileged user with compiler access. The script sets up process accounting and AIDE, preserving an existing AIDE baseline on reruns.
Enable optional MAC / security timers:
sudo ./hardening/apparmor/apparmor.sh # Configures LSM boot params, profiles & enables AppArmor sudo systemctl enable --now auditd sudo systemctl enable --now rkhunter-check.timer sudo systemctl enable --now arch-audit.timerSecure Boot enrollment (bare-metal, if desired):
systemd-boot + UKI profile — use the bundled helper, which is stage-aware and refuses to bind the TPM before Secure Boot is actually enforcing:
sudo awesome-secureboot status sudo awesome-secureboot enroll-keys --microsoft # requires firmware in Setup Mode (--microsoft preserves GPU Option ROMs) # enable Secure Boot in firmware, reboot, then: sudo awesome-secureboot bind-tpm # binds LUKS unlock to configured PCRs (default: 7)GRUB profile — GRUB unlocks an encrypted
/bootvia PBKDF2; modular GRUB cannot load unsigned external modules under UEFI Secure Boot without building a standalone signed GRUB image. Prefer the systemd-boot + UKI profile when UEFI Secure Boot + TPM2 unlock is desired.TPM2 enrollment (bare-metal GRUB profile, if TPM was selected):
sudo systemd-cryptenroll --tpm2-device=auto --tpm2-pcrs=7 /dev/<luks-partition>On the UKI profile this is done by
awesome-secureboot bind-tpmin step 3 instead.Add SSH authorized keys (VPS):
# From your local machine: ssh-copy-id -p <SSH_PORT> <username>@<server-ip>Review:
/root/POST_INSTALL_README.txt
Standalone Hardening Scripts
The scripts in hardening/ and utils/ can be used independently on any Arch Linux system:
# --- Mandatory Access Control ---
sudo ./hardening/apparmor/apparmor.sh # AppArmor profiles for 7 services
# --- Network ---
sudo ./hardening/ssh/ssh.sh -u myuser # Harden SSH server
sudo ./hardening/totp/totp.sh -u myuser # Add TOTP 2FA to SSH
sudo ./hardening/u2f/u2f.sh --enroll # FIDO2/U2F for local login
sudo ./hardening/wifi/wifi.sh # Wi-Fi scan MAC randomization
sudo ./hardening/browser/browser.sh # Firefox/Chromium enterprise policies
sudo ./hardening/memcrypt/memcrypt.sh # Probe AMD SME / Intel TME
sudo ./hardening/wireguard/wireguard.sh # WireGuard VPN server
sudo ./hardening/fail2ban/fail2ban.sh # Extended fail2ban jails
# --- Web ---
sudo ./hardening/nginx/nginx.sh -d example.com -e [email protected] # nginx + Let's Encrypt
sudo ./hardening/react/react.sh -a /var/www/myapp -d app.example.com # React SPA hardening
sudo ./hardening/nodejs/nodejs.sh -a /opt/api -n api-server # Node.js hardening
sudo ./hardening/php/php.sh -a /var/www/myapp # PHP production hardening
sudo ./hardening/wordpress/wordpress.sh -w /var/www/wordpress -d wp.example.com # WordPress hardening
# --- Per-user disk encryption (opt-in, complements LUKS FDE) ---
sudo ./hardening/fscrypt/fscrypt.sh --setup # System-wide PAM wiring + fscrypt config
sudo ./hardening/fscrypt/fscrypt.sh --encrypt-user myuser # Encrypt an existing user's home
sudo ./hardening/fscrypt/fscrypt.sh --status # Report PAM/encryption state
# --- AI Agent ---
sudo ./hardening/openclaw/openclaw.sh -u myuser --with-sandbox --with-firewall --with-apparmor # OpenClaw hardening
# --- Database ---
sudo ./hardening/postgresql/postgresql.sh # PostgreSQL hardening
sudo ./hardening/mariadb/mariadb.sh # MariaDB hardening
# --- Container Security ---
sudo ./hardening/docker/docker.sh --bench # CIS Docker Benchmark audit
sudo ./hardening/docker/docker.sh --scan # Scan all local images with Trivy
sudo ./hardening/docker/docker.sh --compose docker-compose.yml # Compose security audit
sudo ./hardening/docker/docker.sh --network # Container network hardening
# --- System ---
sudo ./hardening/sysctl/sysctl.sh workstation # Compatible kernel hardening baseline
sudo ./hardening/chrony/chrony.sh # Chrony NTS (authenticated NTP)
sudo ./hardening/postfix/postfix.sh -d example.com # Full mail server
# --- Detection ---
sudo ./hardening/crowdsec/crowdsec.sh --with-nginx --with-nftables # CrowdSec IDS
sudo ./hardening/firehol/firehol.sh -l 1 --allow-ssh 22 # FireHOL alternative with IP blocklists
# --- Utilities ---
sudo pacman -Syu borg # Install Borg during planned package maintenance
sudo ./utils/backup.sh --init # Initialize encrypted backups
sudo ./utils/backup.sh --backup --prune # Run backup with retention
sudo ./utils/aide-config.sh --init # Initialize AIDE file integrity DB
sudo ./utils/monitoring.sh --with-prometheus --with-grafana # Full monitoring stack
sudo ./utils/docker.sh --podman -u myuser # Rootless Podman containers
sudo ./utils/audit-check.sh # Check hardening compliance
sudo ./utils/audit-check.sh --json # Machine-readable compliance report
sudo ./utils/zram.sh # Compressed RAM swap (keeps disk swap)
sudo ./utils/cpufreq.sh # CPU governor (schedutil)
sudo ./utils/iosched.sh # I/O scheduler udev rules
sudo ./utils/vaapi.sh # Hardware video decode stack
./utils/brave.sh --policy # Install Brave, fix permissions/hook & apply policies
./utils/board-health.sh --status # ASUS Zenith II Extreme Alpha thermal status
./utils/nvme-stability.sh --status # Signed UKI NVMe power-management status
./tests/run-tests.sh # Run pure-Bash syntax & regression test suite
Customization
- Regional settings — Timezone, locale, and console keymap are selected interactively during installation. The X11 keyboard layout is derived automatically from the console keymap via
kbd-model-map. To change after installation, uselocalectl set-keymap <keymap>(updates both console and X11) or edit/etc/vconsole.confand/etc/X11/xorg.conf.d/00-keyboard.confdirectly. - Package selection — Adjust the
pacstrappackage list in the installer scripts. - Firewall rules — Edit
/etc/nftables.confto add application-specific ports. - DNS providers — Edit
/etc/systemd/resolved.conf.d/dns-over-tls.confto change upstream DoT resolvers (the default is Cloudflare primary, Quad9 fallback). If you have installed Stubby manually as an opt-in, edit/etc/stubby/stubby.ymlinstead. - CSP headers — Customize
Content-Security-Policyin nginx configs for your application needs. - Backup paths — Edit
backup.shinclude/exclude lists for your environment. - Backup maintenance — Install Borg separately before
backup.sh --init. Only--initconfigures the timer and log rotation; routine backup, prune, list, and restore operations never install packages or upgrade the system. The timer runs a root-owned copy at/usr/local/sbin/awesome-borg-backup, so re-runbackup.sh --initafter editing the script. - Monitoring — Add custom Prometheus textfile collectors in
/var/lib/node_exporter/textfile_collector/(root-owned). Grafana listens on loopback only and its random admin password is saved to/root/.grafana-admin-password.
Security References and Methodology
The settings in this repository are implementation choices, not a claim of formal compliance or universal suitability. Each hardening module documents its service-specific sources and compatibility tradeoffs in its own README. The shared baseline is grounded in:
- Arch Linux Installation Guide and Arch Linux Security guidance
- Linux kernel self-protection documentation and kernel sysctl documentation
- systemd service sandboxing
and
systemd-analyze security - OWASP Cheat Sheet Series for application-facing controls
- Arch User Repository security guidance for the explicit AUR review workflow
These sources explain the mechanisms; they do not replace testing on the actual hardware and workload. The project deliberately records known compatibility costs and avoids presenting a larger hardening score as proof that a service still works.
Contributing
Contributions are welcome! Feel free to submit issues or pull requests to improve the scripts, add new features, or enhance the documentation.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Note: Arch Linux is a rolling-release distribution suitable for users who want complete control over their system. These scripts automate the installation and hardening process, but reviewing and understanding the configurations is essential to ensure they meet your security requirements.
Explore projetos relacionados
Carregando…