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
This project is licensed under the MIT License - see the LICENSE file for details.
The MIT License is a permissive open-source license that allows you to:
- ✅ Use the code commercially
- ✅ Modify the code
- ✅ Distribute the code
- ✅ Use privately
- ✅ Include license and copyright notice
Creator
Created and maintained by Avni Ademi (@avni.ademi)
Contributing
Contributions are welcome and encouraged! This project thrives on community involvement.
How to Contribute
- Fork the repository on GitLab
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes and test thoroughly
- Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Merge Request on GitLab
Contribution Ideas
- 🐛 Bug fixes and improvements
- ✨ New features and enhancements
- 📝 Documentation improvements
- 🎨 UI/UX improvements
- 🔒 Security enhancements
- 🧪 Test coverage
- 🌐 Translations
- 📦 Additional server setup options
Code of Conduct
- Be respectful and inclusive
- Welcome newcomers and help them learn
- Focus on constructive feedback
- Celebrate diversity of ideas and backgrounds
Questions?
Feel free to open an issue on GitLab or reach out to the maintainer.
Thank you for contributing! 🙏
Description
Languages
Jinja
50.9%
HTML
23.6%
Python
22.3%
Dockerfile
3.2%