Phantom v2: dual-mode architecture, security hardening, deployment management

- Dual-mode operation: standalone + c2itall integrated (env var detection)
- SSH keys moved to ~/.ssh/c2deploy_ph-{id} with per-deployment known_hosts
- Ansible output streaming with filtered console + full log capture
- Deployment management menu: discover, SSH, teardown existing deployments
- Cert setup script (setup-cert.sh) deployed to servers for post-DNS LE certs
- Matrix hardening: unique secrets, SSRF protection, rate limits, nginx security headers
- Base hardening: fail2ban systemd backend (Debian 12), SSH limits, nginx jails
- Add-matrix-user helper script deployed to all Matrix servers
- .env support for standalone credential storage
- Config key rename: deploy_id → deployment_id (with backward compat)
- Provider cleanup playbooks for teardown
- Test suite with 50 tests

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
n0mad1k
2026-03-09 15:45:24 -04:00
parent 973cede31f
commit 7484a0e034
44 changed files with 3167 additions and 381 deletions
@@ -0,0 +1,45 @@
---
# Mail-in-a-Box non-interactive installation
- name: Generate admin password
command: openssl rand -base64 16
register: miab_admin_password
args:
creates: /root/.miab_admin_password
- name: Save admin password
copy:
content: "{{ miab_admin_password.stdout }}"
dest: /root/.miab_admin_password
mode: "0600"
when: miab_admin_password.changed
- name: Read saved admin password
slurp:
src: /root/.miab_admin_password
register: miab_password_file
- name: Clone Mail-in-a-Box repository
git:
repo: https://github.com/mail-in-a-box/mailinabox.git
dest: /opt/mailinabox
version: main
depth: 1
- name: Run Mail-in-a-Box installer (non-interactive)
command: bash /opt/mailinabox/setup/start.sh
args:
creates: /etc/mailinabox.conf
environment:
NONINTERACTIVE: "1"
PRIMARY_HOSTNAME: "{{ miab_domain }}"
EMAIL_ADDR: "{{ miab_first_user }}"
EMAIL_PW: "{{ (miab_password_file.content | b64decode).strip() }}"
timeout: 600
- name: Display admin credentials
debug:
msg: >
Mail-in-a-Box installed. Admin: {{ miab_first_user }}
Password saved to /root/.miab_admin_password
Web admin: https://{{ miab_domain }}/admin