|
|
@@ -38,37 +38,34 @@ all:
|
|
|
ansible_host: "5.6.7.8"
|
|
|
```
|
|
|
|
|
|
-### 2. Configure secrets
|
|
|
-
|
|
|
-```bash
|
|
|
-cp group_vars/vault.yml.example group_vars/vault.yml
|
|
|
-# Edit vault.yml with your passwords
|
|
|
-ansible-vault encrypt group_vars/vault.yml
|
|
|
-```
|
|
|
-
|
|
|
-### 3. Configure variables
|
|
|
-
|
|
|
-Edit `group_vars/relay.yml`:
|
|
|
-- `ss_port`: Shadowsocks listen port (default: 8388)
|
|
|
-- `ss_cipher`: Encryption method (default: aes-256-gcm)
|
|
|
+### 2. Configure variables
|
|
|
|
|
|
Edit `group_vars/landing.yml`:
|
|
|
- `trojan_domain`: Your domain name
|
|
|
- `certbot_email`: Email for Let's Encrypt notifications
|
|
|
|
|
|
-### 4. Run the playbook
|
|
|
+Ports and passwords are **auto-generated** on first run and persisted in `credentials/`. No manual password setup needed.
|
|
|
|
|
|
+To override auto-generated values:
|
|
|
```bash
|
|
|
-ansible-playbook site.yml --ask-vault-pass
|
|
|
+ansible-playbook site.yml --extra-vars "ss_password=my-custom-pass ss_port=12345"
|
|
|
```
|
|
|
|
|
|
-## Client Configuration
|
|
|
+### 3. Run the playbook
|
|
|
|
|
|
-See `docs/surge-client.conf` for a reference Surge client configuration with:
|
|
|
-- Proxy definitions (Relay-SS, Landing-Trojan, Landing-Chain)
|
|
|
-- Routing rules using [Sukka's rulesets](https://github.com/SukkaW/Surge)
|
|
|
-- AI and streaming traffic → chained through landing server
|
|
|
-- Default traffic → relay server
|
|
|
+```bash
|
|
|
+ansible-playbook site.yml
|
|
|
+```
|
|
|
+
|
|
|
+After deployment, the Surge client config is generated at `output/surge-client.conf` with all connection parameters filled in. Import this file into Surge directly.
|
|
|
+
|
|
|
+### 4. Backup credentials
|
|
|
+
|
|
|
+The `credentials/` directory contains auto-generated passwords and ports. Back it up — if lost, new credentials will be generated and servers must be re-provisioned.
|
|
|
+
|
|
|
+```bash
|
|
|
+cp -r credentials/ /path/to/backup/
|
|
|
+```
|
|
|
|
|
|
## Project Structure
|
|
|
|
|
|
@@ -79,14 +76,16 @@ See `docs/surge-client.conf` for a reference Surge client configuration with:
|
|
|
├── group_vars/
|
|
|
│ ├── all.yml
|
|
|
│ ├── relay.yml
|
|
|
-│ ├── landing.yml
|
|
|
-│ └── vault.yml.example
|
|
|
+│ └── landing.yml
|
|
|
├── roles/
|
|
|
│ ├── base/ # SSH hardening, UFW, fail2ban
|
|
|
+│ ├── geoblock/ # Block outbound to China IPs
|
|
|
│ ├── shadowsocks/ # shadowsocks-rust (relay)
|
|
|
│ └── trojan/ # trojan-go + certbot (landing)
|
|
|
-├── docs/
|
|
|
-│ └── surge-client.conf
|
|
|
+├── templates/
|
|
|
+│ └── surge-client.conf.j2
|
|
|
+├── credentials/ # Auto-generated (gitignored)
|
|
|
+├── output/ # Generated Surge config (gitignored)
|
|
|
└── site.yml
|
|
|
```
|
|
|
|
|
|
@@ -94,11 +93,13 @@ See `docs/surge-client.conf` for a reference Surge client configuration with:
|
|
|
|
|
|
| Variable | Default | Description |
|
|
|
|---|---|---|
|
|
|
-| `ss_port` | 8388 | Shadowsocks listen port |
|
|
|
+| `ss_port` | auto-generated (10000–49999) | Shadowsocks listen port |
|
|
|
| `ss_cipher` | aes-256-gcm | Shadowsocks encryption method |
|
|
|
+| `ss_password` | auto-generated (32 chars) | Shadowsocks password |
|
|
|
| `ss_version` | 1.21.2 | shadowsocks-rust release version |
|
|
|
-| `trojan_port` | 443 | Trojan listen port |
|
|
|
+| `trojan_port` | 443 (fixed) | Trojan listen port |
|
|
|
| `trojan_domain` | — | Domain name for TLS certificate |
|
|
|
+| `trojan_password` | auto-generated (32 chars) | Trojan password |
|
|
|
| `trojan_fallback_port` | 8080 | Fallback port for non-Trojan traffic |
|
|
|
| `trojan_version` | 0.10.6 | trojan-go release version |
|
|
|
| `certbot_email` | — | Email for Let's Encrypt |
|