40 lines
1.8 KiB
Markdown
40 lines
1.8 KiB
Markdown
|
|
1. **Initial Setup**:
|
|
- The script first checks if it's running as root (administrator), which is required for system changes
|
|
- It defines important variables like ports and file paths that will be used
|
|
|
|
2. **ZeroTier Installation**:
|
|
- Installs ZeroTier One client using their official installer
|
|
- Joins your ZeroTier network (you'll need to put in ssh with your actual network ID)
|
|
|
|
3. **Network Configuration**:
|
|
- Waits for the ZeroTier network connection to establish
|
|
- Gets your ZeroTier IP address (the address assigned to your server on the ZeroTier network)
|
|
|
|
4. **Backup Creation**:
|
|
- Creates backup copies of your nginx configuration and database
|
|
- This is a safety measure in case you need to revert changes
|
|
|
|
5. **Service Configuration**:
|
|
- Modifies the nginx configuration to only listen on your ZeroTier IP address
|
|
- Updates the firewall rules in the SQLite database to:
|
|
- Remove existing rules for SSH and CloudPanel ports
|
|
- Add new rules that only allow access from your ZeroTier IP
|
|
|
|
6. **Service Restart**:
|
|
- Restarts nginx and SSH services to apply the changes
|
|
- Verifies ZeroTier connection status
|
|
|
|
To use this script:
|
|
|
|
1. Save it to a file (e.g., `setup-zerotier.sh`)
|
|
2. Replace `YOUR_NETWORK_ID_HERE` with your actual ZeroTier network ID
|
|
3. Make it executable: `chmod +x setup-zerotier.sh`
|
|
4. Run it as root: `sudo ./setup-zerotier.sh`
|
|
|
|
Important Notes:
|
|
- Keep your backup files safe in case you need to restore
|
|
- After running this script, you'll only be able to access SSH and CloudPanel through ZeroTier
|
|
- Double-check your ZeroTier network ID before running
|
|
- Make sure you have access to your server through ZeroTier before running this script
|
|
- Test the connection through ZeroTier before logging out of your current session
|