Skip to content

Commit 512af5f

Browse files
authored
Merge pull request #209 from HARSHVARANDANI/docs/ca-certification-docs
Add documentation for external CA certification flow
2 parents a329c4e + 4d4a03d commit 512af5f

3 files changed

Lines changed: 39 additions & 3 deletions

File tree

contrib/ldk-server-config.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ level = "Debug" # Log level (Error, Warn, Info, De
2020
[tls]
2121
#cert_path = "/path/to/tls.crt" # Path to TLS certificate, by default uses dir_path/tls.crt
2222
#key_path = "/path/to/tls.key" # Path to TLS private key, by default uses dir_path/tls.key
23+
# For CA-signed certs, point cert_path/key_path to your ACME output files.
2324
#hosts = ["example.com"] # Allowed hosts for TLS, will always include "localhost" and "127.0.0.1"
2425

2526
# Must set one of bitcoind, electrum, or esplora

docs/configuration.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ Alternative Names. If no certificate exists, the server auto-generates a self-si
7676
P-256 cert. `localhost` and `127.0.0.1` are always included in the SANs. Add your server's
7777
public hostname or IP to `hosts` if clients connect remotely.
7878

79-
To bring your own certificate (e.g., from Let's Encrypt), set `cert_path` and `key_path`.
79+
To bring your own certificate (for example, from a public CA), set `cert_path` and
80+
`key_path`. The server reads these files on startup, so renewals require a restart.
81+
See [Operations - TLS](operations.md#tls) for a recommended CA-signed flow.
8082

8183
### Bitcoin Backend
8284

docs/operations.md

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ setup):
4747
### What to Back Up
4848

4949
| File | Priority | Description |
50-
|----------------------------------------|--------------|----------------------------------------------------------------------------|
50+
| -------------------------------------- | ------------ | -------------------------------------------------------------------------- |
5151
| `<storage_dir>/keys_seed` | **Critical** | Node identity and master secret. Required to recover on-chain funds. |
5252
| `<network_dir>/ldk_node_data.sqlite` | **Critical** | Channel state and on-chain wallet data. Required to recover channel funds. |
5353
| `<network_dir>/ldk_server_data.sqlite` | Nice-to-have | Payment and forwarding history |
@@ -80,6 +80,39 @@ setup):
8080
- Certificate includes `localhost` and `127.0.0.1` in SANs by default
8181
- Add your server's hostname/IP to `[tls] hosts` for remote access
8282

83+
### CA-Signed Certificates (Let's Encrypt / ACME)
84+
85+
For production deployments, many operators prefer a publicly trusted certificate. The
86+
recommended approach is to provision the certificate outside of LDK Server (via an ACME
87+
client) and point `[tls] cert_path` and `key_path` to the resulting files.
88+
89+
High-level flow:
90+
91+
1. Choose a public hostname for the gRPC endpoint (e.g., `ldk.example.com`).
92+
2. Set `grpc_service_address` to bind on the public interface.
93+
3. Add the hostname to `[tls] hosts` so SANs match what clients connect to.
94+
4. Use an ACME client (certbot, lego, acme.sh) to obtain a certificate for the hostname.
95+
5. Configure `[tls] cert_path` and `key_path` to the ACME output files.
96+
6. Restart the server after renewals (LDK Server reads TLS files at startup).
97+
98+
Example (certbot with a pre-provisioned DNS or HTTP-01 flow):
99+
100+
```toml
101+
[node]
102+
grpc_service_address = "0.0.0.0:3536"
103+
104+
[tls]
105+
cert_path = "/etc/letsencrypt/live/ldk.example.com/fullchain.pem"
106+
key_path = "/etc/letsencrypt/live/ldk.example.com/privkey.pem"
107+
hosts = ["ldk.example.com"]
108+
```
109+
110+
Notes:
111+
112+
- Ensure the `ldk-server` process can read the cert and key files.
113+
- After a renewal, restart the service to pick up the new certificate.
114+
- If you want zero-downtime renewals, place a reverse proxy in front and terminate TLS there.
115+
83116
### Network Exposure
84117

85118
The gRPC service binds to `127.0.0.1:3536` by default. For remote access, either:
@@ -129,7 +162,7 @@ scrape_configs:
129162
username: prometheus
130163
password: secret
131164
static_configs:
132-
- targets: [ 'localhost:3536' ]
165+
- targets: ["localhost:3536"]
133166
```
134167
135168
### Available Metrics

0 commit comments

Comments
 (0)