bashgen/templates/index.html

165 lines
7.5 KiB
HTML

<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Bash Script Generator</title>
<style>
body { font-family: Arial, sans-serif; max-width: 980px; margin: 40px auto; padding: 0 16px; }
fieldset { margin: 18px 0; padding: 14px; }
label { display: block; margin: 8px 0; }
input[type="text"], input[type="number"], textarea { width: 100%; padding: 8px; }
textarea { height: 120px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.btn { padding: 10px 14px; cursor: pointer; }
.note { color: #555; font-size: 0.95em; line-height: 1.5; }
code { background: #f4f4f4; padding: 2px 4px; font-family: 'Courier New', monospace; }
.note code { background: #e8e8e8; padding: 2px 6px; border-radius: 3px; }
</style>
</head>
<body>
<h1>Server Setup Script Generator</h1>
<p class="note">Select options, then download a single <code>.sh</code> script.</p>
<form action="/generate" method="post">
<fieldset>
<legend>System Setup</legend>
<label><input type="checkbox" name="system_update" checked /> Initial system update & upgrade</label>
<label><input type="checkbox" name="auto_security_updates" checked /> Enable automatic security updates</label>
<label><input type="checkbox" name="setup_timezone" /> Configure timezone</label>
<label><input type="checkbox" name="setup_hostname" /> Set hostname</label>
<label><input type="checkbox" name="setup_ntp" checked /> Configure NTP time sync</label>
<label><input type="checkbox" name="setup_swap" /> Configure swap file</label>
</fieldset>
<fieldset>
<legend>Security & Hardening</legend>
<label><input type="checkbox" name="ssh_harden" checked /> SSH hardening (disable root, key-only option)</label>
<label><input type="checkbox" name="install_fail2ban" checked /> Install Fail2ban (intrusion prevention)</label>
<label><input type="checkbox" name="prelogin_banner" /> Pre-login banner (SSH)</label>
<div style="margin-left: 24px; margin-top: 4px; margin-bottom: 8px;">
<label><input type="radio" name="banner_type" value="default" checked /> Default banner</label>
<label style="margin-left: 16px;"><input type="radio" name="banner_type" value="dod_cmmc" /> DOD CMMC Approved banner</label>
</div>
<label><input type="checkbox" name="postlogin_banner" /> Post-login banner (MOTD)</label>
<label><input type="checkbox" name="ssh_2fa" /> SSH 2FA (Google Authenticator PAM)</label>
</fieldset>
<fieldset>
<legend>Docker & Services</legend>
<label><input type="checkbox" name="install_docker" checked /> Install Docker + Docker Compose</label>
<label><input type="checkbox" name="docker_admin_user" checked /> Create admin user for docker operations (non-login)</label>
<label><input type="checkbox" name="open_ports" checked /> Allow ports (UFW)</label>
<label><input type="checkbox" name="combine_lan" /> Combine LAN ports (netplan bond + bridge, static IP)</label>
</fieldset>
<fieldset>
<legend>User Management</legend>
<label><input type="checkbox" name="create_admin_user" /> Create admin user with sudo access</label>
</fieldset>
<fieldset>
<legend>Monitoring & Utilities</legend>
<label><input type="checkbox" name="install_monitoring_tools" checked /> Install monitoring tools (htop, iotop, netstat, etc.)</label>
<label><input type="checkbox" name="install_build_tools" /> Install build tools (build-essential, git, etc.)</label>
</fieldset>
<fieldset>
<legend>General Configuration</legend>
<div class="row">
<label>
Docker admin username
<input type="text" name="admin_username" value="datamng" />
</label>
<label>
SSH port
<input type="number" name="ssh_port" value="22" min="1" max="65535" />
</label>
</div>
<div class="row">
<label>
Hostname
<input type="text" name="hostname" value="" placeholder="Leave empty to skip" />
</label>
<label>
Timezone
<input type="text" name="timezone" value="UTC" placeholder="e.g. America/New_York" />
</label>
</div>
<div class="row">
<label>
Admin username (for new user)
<input type="text" name="new_admin_username" value="admin" />
</label>
<label>
Swap size (GB)
<input type="number" name="swap_size_gb" value="2" min="1" max="32" />
<span class="note">Swap is virtual memory - used when RAM is full. Prevents out-of-memory crashes.</span>
</label>
</div>
<div class="row">
<label>
Docker data directory path
<input type="text" name="docker_data_dir" value="/opt/docker" placeholder="/opt/docker" />
</label>
</div>
<label>
Firewall ports (CSV)
<input type="text" name="ports_csv" value="22,80,81,443" />
</label>
<label>
SSH public key (for admin user, one per line)
<textarea name="ssh_public_keys" placeholder="ssh-rsa AAAAB3NzaC1yc2E... user@host&#10;ssh-ed25519 AAAAC3NzaC1lZDI1... user@host" rows="4"></textarea>
<div class="note" style="margin-top: 8px;">
<strong>How to generate SSH keys:</strong><br>
1. On your local computer, run: <code>ssh-keygen -t ed25519 -C "your_email@example.com"</code><br>
2. Press Enter to accept default location (~/.ssh/id_ed25519)<br>
3. Copy your PUBLIC key: <code>cat ~/.ssh/id_ed25519.pub</code> (or <code>id_rsa.pub</code> for RSA)<br>
4. Paste the PUBLIC key here (starts with ssh-rsa or ssh-ed25519)<br>
<strong>Note:</strong> You generate keys on YOUR computer, then paste the PUBLIC key here. The server will use it to authenticate you.
</div>
</label>
</fieldset>
<fieldset>
<legend>LAN bonding/bridging (only if enabled)</legend>
<label>LAN interfaces (CSV, e.g. eth0,eth1)
<input type="text" name="lan_interfaces_csv" value="eth0,eth1" />
</label>
<div class="row">
<label>Static IP (CIDR)
<input type="text" name="static_ip_cidr" value="192.168.1.9/24" />
</label>
<label>Gateway
<input type="text" name="gateway_ip" value="192.168.1.1" />
</label>
</div>
<label>DNS (CSV)
<input type="text" name="dns_csv" value="1.1.1.1,8.8.8.8" />
</label>
<p class="note">This will write a netplan file and apply it. Test carefully (risk of remote lockout).</p>
</fieldset>
<fieldset>
<legend>System Owner Information</legend>
<div class="row">
<label>
Owner Name
<input type="text" name="owner_name" value="Scardus" />
</label>
<label>
Owner Website
<input type="text" name="owner_website" value="https://scardustech.com" />
</label>
</div>
<label>
Owner Email
<input type="text" name="owner_email" value="info@scardustech.com" />
</label>
<p class="note">Banners will use templates from loginbanner.md and postloginbanner.md</p>
</fieldset>
<button class="btn" type="submit">Download .sh</button>
</form>
</body>
</html>