|
1 | | -Sliver supports running in "daemon mode," which automatically starts a client listener (but not an interactive console). In order to connect to a server running in daemon mode you'll need to use [multiplayer mode](/docs?name=Multi-player+Mode). |
| 1 | +Sliver supports running in daemon mode, which automatically starts the multiplayer client listener (but not an interactive console). To connect to a daemonized server, use [multiplayer mode](/docs?name=Multi-player+Mode) operator configs. |
2 | 2 |
|
3 | | -There are two ways to start the server in daemon mode: |
| 3 | +There are two ways to run in daemon mode: |
4 | 4 |
|
5 | | -1. Using the command line interface: `sliver-server daemon` |
6 | | -2. Set `daemon_mode` to `true` in the `configs/server.json` located in `SLIVER_ROOT_DIR` (by default: `~/.sliver/configs/server.json`). The listener can be configured via the `daemon` object. The process will respond gracefully to `SIGTERM` on Unix-like operating systems. |
| 5 | +1. Start daemon directly from CLI: `sliver-server daemon` |
| 6 | +2. Set `daemon_mode: true` in `~/.sliver/configs/server.yaml`, then start normally with `sliver-server` |
7 | 7 |
|
8 | | -#### Example Config |
| 8 | +If `server.yaml` does not exist, Sliver generates it. If a legacy `server.json` exists, Sliver migrates it to YAML. |
9 | 9 |
|
| 10 | +### CLI Behavior |
| 11 | + |
| 12 | +- `sliver-server daemon` supports: |
| 13 | + - `-l, --lhost` multiplayer listener host |
| 14 | + - `-p, --lport` multiplayer listener port |
| 15 | + - `-t, --tailscale` enable Tailscale listener |
| 16 | + - `-f, --force` force unpack static assets |
| 17 | +- For `sliver-server daemon`, `--lhost` and `--lport` override config values. If omitted, Sliver uses `daemon.host` and `daemon.port` from `server.yaml`. |
| 18 | +- For normal startup (`sliver-server`) with `daemon_mode: true`, Sliver uses `daemon.tailscale` from `server.yaml`. |
| 19 | + |
| 20 | +### Example Config |
| 21 | + |
| 22 | +```yaml |
| 23 | +daemon_mode: true |
| 24 | +daemon: |
| 25 | + host: "" |
| 26 | + port: 31337 |
| 27 | + tailscale: false |
| 28 | +logs: |
| 29 | + level: 4 |
| 30 | + grpc_unary_payloads: false |
| 31 | + grpc_stream_payloads: false |
| 32 | + tls_key_logger: false |
| 33 | +grpc: |
| 34 | + keepalive: |
| 35 | + min_time_seconds: 30 |
| 36 | + permit_without_stream: true |
10 | 37 | ``` |
11 | | -$ cat ~/.sliver/configs/server.json |
12 | | -{ |
13 | | - "daemon_mode": true, |
14 | | - "daemon": { |
15 | | - "host": "", |
16 | | - "port": 31337 |
17 | | - }, |
18 | | - "logs": { |
19 | | - "level": 5, |
20 | | - "grpc_unary_payloads": false, |
21 | | - "grpc_stream_payloads": false |
22 | | - }, |
23 | | - "grpc": { |
24 | | - "keepalive": { |
25 | | - "min_time_seconds": 30, |
26 | | - "permit_without_stream": true |
27 | | - } |
28 | | - } |
29 | | -} |
| 38 | +
|
| 39 | +### Generating Operator Configs Without Console |
| 40 | +
|
| 41 | +Since daemon mode does not provide an interactive server console, generate operator configs using the server CLI: |
| 42 | +
|
| 43 | +```bash |
| 44 | +./sliver-server operator --name zer0cool --lhost 1.2.3.4 --permissions all --save zer0cool.cfg |
30 | 45 | ``` |
31 | 46 |
|
32 | | -#### systemd |
| 47 | +### Shutdown Behavior |
| 48 | + |
| 49 | +On Unix-like systems, daemon mode handles `SIGTERM` and exits cleanly. |
| 50 | + |
| 51 | +### systemd |
33 | 52 |
|
34 | | -With this config you can easily set up a [systemd service](https://www.linode.com/docs/quick-answers/linux/start-service-at-boot/) or init script. See the [Linux install script](/docs?name=Linux+Install+Script) for an example. |
| 53 | +With daemon mode enabled in `server.yaml`, you can run Sliver under [systemd](https://www.linode.com/docs/quick-answers/linux/start-service-at-boot/) or another init system. See the [Linux install script](/docs?name=Linux+Install+Script) for an example. |
0 commit comments