140 lines
3.7 KiB
Markdown
140 lines
3.7 KiB
Markdown
# 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)
|
|
|
|
```bash
|
|
cd bashgen
|
|
docker-compose up -d
|
|
```
|
|
|
|
Access the web interface at `http://localhost:8083`
|
|
|
|
### Manual Setup
|
|
|
|
```bash
|
|
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
|
|
|
|
1. Open the web interface
|
|
2. Select the features you want to include
|
|
3. Configure parameters (hostname, timezone, ports, etc.)
|
|
4. Add system owner information
|
|
5. Paste SSH public keys (if creating admin user)
|
|
6. Download the generated `.sh` script
|
|
7. 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](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
|
|
|
|
1. **Fork the repository** on GitLab
|
|
2. **Create a feature branch** (`git checkout -b feature/amazing-feature`)
|
|
3. **Make your changes** and test thoroughly
|
|
4. **Commit your changes** (`git commit -m 'Add some amazing feature'`)
|
|
5. **Push to the branch** (`git push origin feature/amazing-feature`)
|
|
6. **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!** 🙏
|