Skip to content

Commit c607b50

Browse files
authored
Added instructions for importing certificates into different OS #2
2 parents 312964e + 67a20d4 commit c607b50

3 files changed

Lines changed: 61 additions & 5 deletions

File tree

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keyc
3737
## Configuration
3838

3939
Environment variables (set in `.env`):
40+
4041
- `DOMAIN` - Domain name for SSL cert (default: `localhost`)
4142
- `UPSTREAM_URL` - URL for your local app (default: `http://host.docker.internal:3000`)
4243

README.md

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,47 @@ A Dockerized Caddy reverse proxy with automatic SSL certificate generation for l
3434

3535
4. Install the CA certificate (one-time):
3636

37+
Replace `local.example.com` with your configured domain.
38+
39+
**macOS:**
40+
3741
```bash
3842
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ./certs/local.example.com.rootCA.pem
3943
```
4044

45+
**Linux (Debian/Ubuntu):**
46+
47+
```bash
48+
sudo cp ./certs/local.example.com.rootCA.pem /usr/local/share/ca-certificates/local.example.com.crt
49+
sudo update-ca-certificates
50+
```
51+
52+
**Linux (Fedora/RHEL):**
53+
54+
```bash
55+
sudo cp ./certs/local.example.com.rootCA.pem /etc/pki/ca-trust/source/anchors/local.example.com.pem
56+
sudo update-ca-trust
57+
```
58+
59+
**Linux (Arch):**
60+
61+
```bash
62+
sudo trust anchor ./certs/local.example.com.rootCA.pem
63+
```
64+
65+
**Windows (PowerShell as Administrator):**
66+
67+
```powershell
68+
Import-Certificate -FilePath .\certs\local.example.com.rootCA.pem -CertStoreLocation Cert:\LocalMachine\Root
69+
```
70+
71+
If `.pem` import fails, convert to `.cer` first:
72+
73+
```powershell
74+
openssl x509 -in .\certs\local.example.com.rootCA.pem -out .\certs\local.example.com.rootCA.cer
75+
Import-Certificate -FilePath .\certs\local.example.com.rootCA.cer -CertStoreLocation Cert:\LocalMachine\Root
76+
```
77+
4178
5. Start the proxy:
4279

4380
```bash
@@ -50,10 +87,10 @@ Note (Linux): Requires Docker Engine 20.10+ for `host-gateway` support.
5087

5188
## Configuration
5289

53-
| Variable | Default | Description |
54-
| --------------- | ----------- | ---------------------- |
55-
| `DOMAIN` | `localhost` | Domain for SSL cert |
56-
| `UPSTREAM_URL` | `http://host.docker.internal:3000` | URL for your local app |
90+
| Variable | Default | Description |
91+
| -------------- | ---------------------------------- | ---------------------- |
92+
| `DOMAIN` | `localhost` | Domain for SSL cert |
93+
| `UPSTREAM_URL` | `http://host.docker.internal:3000` | URL for your local app |
5794

5895
## Ports
5996

scripts/mkcert/entrypoint.sh

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,23 @@ else
1818
echo "Certificate already exists for ${DOMAIN}, skipping generation."
1919
fi
2020

21-
echo "Install CA on macOS:"
21+
echo ""
22+
echo "=== Install CA certificate ==="
23+
echo ""
24+
echo "macOS:"
2225
echo " sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ./certs/${DOMAIN}.rootCA.pem"
26+
echo ""
27+
echo "Linux (Debian/Ubuntu):"
28+
echo " sudo cp ./certs/${DOMAIN}.rootCA.pem /usr/local/share/ca-certificates/${DOMAIN}.crt && sudo update-ca-certificates"
29+
echo ""
30+
echo "Linux (Fedora/RHEL):"
31+
echo " sudo cp ./certs/${DOMAIN}.rootCA.pem /etc/pki/ca-trust/source/anchors/${DOMAIN}.pem && sudo update-ca-trust"
32+
echo ""
33+
echo "Linux (Arch):"
34+
echo " sudo trust anchor ./certs/${DOMAIN}.rootCA.pem"
35+
echo ""
36+
echo "Windows (PowerShell as Admin):"
37+
echo " Import-Certificate -FilePath .\\certs\\${DOMAIN}.rootCA.pem -CertStoreLocation Cert:\\LocalMachine\\Root"
38+
echo " If .pem import fails, convert to .cer first:"
39+
echo " openssl x509 -in .\\certs\\${DOMAIN}.rootCA.pem -out .\\certs\\${DOMAIN}.rootCA.cer"
40+
echo " Import-Certificate -FilePath .\\certs\\${DOMAIN}.rootCA.cer -CertStoreLocation Cert:\\LocalMachine\\Root"

0 commit comments

Comments
 (0)