Skip to content

Commit e0885e5

Browse files
authored
Merge pull request #1 from VectoDE/codex/initialize-enterprise-level-project-setup
feat: harden enterprise server setup
2 parents d77bd66 + 2694286 commit e0885e5

File tree

2 files changed

+471
-143
lines changed

2 files changed

+471
-143
lines changed

README.md

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Automated Linux Server Setup
22

3-
This project provides a fully automated Bash script to set up a production-ready Linux server or Docker stack on **Debian**, **Ubuntu**, **CentOS**, or **RHEL**. The script installs and configures all essential components for web hosting and applications.
3+
This project provides a fully automated Bash script to set up an enterprise-ready Linux server or Docker stack on **Debian**, **Ubuntu**, **CentOS**, or **RHEL**. The script installs, configures, and hardens all essential components for web hosting and applications while maintaining detailed audit logs.
44

55
## Features
66

77
- **Operating Systems**: Debian 12+, Ubuntu 20.04+, CentOS 7+, RHEL 7+
8-
- **Installed Components**:
8+
- **Installed & Configured Components**:
99

1010
- Nginx (web server)
1111
- PHP-FPM (configurable version, e.g., 8.2)
@@ -15,16 +15,21 @@ This project provides a fully automated Bash script to set up a production-ready
1515
- Fail2Ban (brute-force protection)
1616
- Firewall (UFW on Debian/Ubuntu, firewalld on CentOS/RHEL)
1717
- SSL certificates via Certbot (Let's Encrypt)
18+
- Automated MariaDB backups with daily cron job
19+
- Optional SSH hardening (disable password auth, restrict root login)
20+
- Automatic OS security updates (configurable)
1821

1922
- **Modes**:
2023

2124
- `native`: installation directly on the host server
2225
- `docker`: Docker Compose stack with DB, Nginx, PHP-FPM, phpMyAdmin
2326

24-
- **Multi-Domain Support**: single or multiple domains can be configured simultaneously
25-
- **Automatic Nginx vhosts** for each domain
26-
- **Non-interactive MariaDB setup** with root password
27-
- **Docker support** for instant containerized deployment
27+
- **Enterprise Enhancements**
28+
- Central execution log at `/var/log/enterprise-server-setup.log`
29+
- Multi-domain support with per-virtual-host isolation (`example.com,www.example.com;api.example.com`)
30+
- Automatic Nginx vhosts and HTTPS provisioning for every domain group
31+
- Non-interactive MariaDB setup with secure root credential storage in `/root/.my.cnf`
32+
- Docker support for instant containerized deployment
2833

2934
## Requirements
3035

@@ -44,8 +49,10 @@ chmod +x automated-linux-server-setup.sh
4449

4550
### 2. Native Installation (without Docker)
4651

52+
Multiple domain groups are separated by semicolons (`;`). Domains within a group share the same virtual host and should be comma-separated (`example.com,www.example.com`).
53+
4754
```bash
48-
sudo DOMAINS="example.com,www.example.com" \
55+
sudo DOMAINS="example.com,www.example.com;api.example.com" \
4956
EMAIL="admin@example.com" \
5057
MODE=native \
5158
DB_ROOT_PASS="securepassword" \
@@ -63,37 +70,45 @@ sudo DOMAINS="example.com" \
6370

6471
After execution, the Docker Compose stack is located under `/opt/<domain>`.
6572

73+
Logs for every run are appended to `/var/log/enterprise-server-setup.log`. A lightweight state file is written to `/var/local/enterprise-server-setup/last-run` to help with auditing.
74+
6675
## Configuration
6776

6877
- **Web root**: `/var/www/<domain_group>/html` (native) or `/opt/<domain>/www` (docker)
69-
- **MariaDB**: Root password is set automatically, default user `root`
70-
- **phpMyAdmin**: Access via `/phpmyadmin` or port 8080 for Docker
71-
- **Nginx vhosts**: automatically generated for each domain group
78+
- **MariaDB**: Root password is stored in `/root/.my.cnf` for safe automation access
79+
- **phpMyAdmin**: Access via `/phpmyadmin` (native) or port 8080 for Docker
80+
- **Nginx vhosts**: automatically generated for each domain group with HTTPS enforcement
7281
- **PHP-FPM Socket**: `/var/run/php/php<version>-fpm.sock` (native)
82+
- **Backups**: Daily cron at 02:00 writes dumps to `/var/backups/mariadb`
7383

7484
## Options
7585

76-
- `--domains` - comma-separated domains
86+
- `--domains` - semicolon-delimited domain groups; commas separate aliases within a group
7787
- `--mode` - `native` or `docker` (default: native)
7888
- `--email` - administrator email for SSL
7989
- `--db-root-pass` - MariaDB root password
8090
- `--php` - PHP version (default: 8.2)
8191
- `--force` - overwrite existing configurations
92+
- Environment toggles:
93+
- `ENABLE_AUTO_UPDATES=false` to skip unattended upgrades
94+
- `ENABLE_SSH_HARDENING=true` to enforce key-based SSH authentication
8295

8396
## Security Measures
8497

85-
- Fail2Ban to protect against brute-force attacks
86-
- Firewall configuration (UFW/firewalld) on standard ports
87-
- SSL certificates via Let's Encrypt
88-
- Non-interactive MariaDB setup removes insecure defaults
98+
- Fail2Ban to protect against brute-force attacks (with hardened jail profiles)
99+
- Firewall configuration (UFW/firewalld) on standard ports plus phpMyAdmin (8080)
100+
- SSL certificates via Let's Encrypt with automatic HTTP→HTTPS redirect
101+
- Non-interactive MariaDB setup removes insecure defaults and stores credentials securely
102+
- Automated daily database dumps with retention policy (14 days)
103+
- Optional SSH hardening and unattended OS updates
89104

90105
## Next Steps
91106

92-
1. Place your website files in the web root: `/var/www/<domain>/html` or `/opt/<domain>/www`
93-
2. Check Nginx configuration: `nginx -t`
94-
3. Check PHP-FPM: `systemctl status php<version>-fpm`
95-
4. Access MariaDB: `mysql -u root -p`
96-
5. Access phpMyAdmin: `http://<domain>/phpmyadmin` (native) or `http://<server_ip>:8080` (Docker)
107+
1. Review `/var/log/enterprise-server-setup.log` for the full execution transcript.
108+
2. Place your website files in the web root: `/var/www/<domain>/html` or `/opt/<domain>/www`.
109+
3. Validate services: `nginx -t`, `systemctl status php<version>-fpm`, and `systemctl status mariadb` (native).
110+
4. Access MariaDB using the stored credentials: `mysql --defaults-file=/root/.my.cnf`.
111+
5. Access phpMyAdmin: `https://<domain>/phpmyadmin` (native) or `http://<server_ip>:8080` (Docker).
97112

98113
## Support & Issues
99114

0 commit comments

Comments
 (0)