2.4 KiB
2.4 KiB
Bash Script Generator
A web-based tool for generating comprehensive Linux server setup scripts. This FastAPI application allows administrators to configure and download a single bash script that automates common server baseline setup tasks.
Features
System Setup
- Initial system update & upgrade
- Automatic security updates (unattended-upgrades)
- Timezone configuration
- Hostname setup
- NTP time synchronization
- Swap file configuration
Security & Hardening
- SSH hardening (disable root login, strong ciphers, timeouts)
- Fail2ban intrusion prevention
- Pre-login and post-login banners
- SSH 2FA (Google Authenticator installation)
Docker & Services
- Docker + Docker Compose installation
- Docker admin user creation with restricted permissions
- Custom Docker data directory with ACL permissions
- UFW firewall configuration
- Network bonding/bridging (netplan)
User Management
- Admin user creation with sudo access
- SSH public key authentication setup
Monitoring & Utilities
- Monitoring tools (htop, iotop, net-tools, etc.)
- Build tools (build-essential, git, etc.)
Quick Start
Using Docker (Recommended)
cd bashgen
docker-compose up -d
Access the web interface at http://localhost:8083
Manual Setup
cd bashgen
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install -r requirements.txt
uvicorn app:app --host 0.0.0.0 --port 8080
Usage
- Open the web interface
- Select the features you want to include
- Configure parameters (hostname, timezone, ports, etc.)
- Add system owner information
- Paste SSH public keys (if creating admin user)
- Download the generated
.shscript - Run on your Ubuntu server:
sudo bash setup-server.sh
Project Structure
bashgen/
├── app.py # FastAPI backend
├── requirements.txt # Python dependencies
├── Dockerfile # Docker image definition
├── docker-compose.yml # Docker Compose configuration
├── templates/
│ ├── index.html # Web form frontend
│ └── script.sh.j2 # Bash script Jinja2 template
└── README.md # This file
Requirements
- Python 3.11+
- Docker & Docker Compose (for containerized deployment)
- Ubuntu Server (for generated scripts)
License
[Add your license here]
Contributing
[Add contribution guidelines here]