Skip to content

Commit 25e6cca

Browse files
committed
update to jail naming
1 parent 3582142 commit 25e6cca

File tree

5 files changed

+74
-79
lines changed

5 files changed

+74
-79
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
*.dll
55
*.so
66
*.dylib
7-
boundary
8-
boundary.exe
7+
jail
8+
jail.exe
99

1010
# Test binary, built with `go test -c`
1111
*.test

README.md

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# boundary
1+
# jail
22

33
**Network isolation tool for monitoring and restricting HTTP/HTTPS requests from processes**
44

5-
boundary creates an isolated network environment for target processes, intercepting all HTTP/HTTPS traffic through a transparent proxy that enforces user-defined allow rules.
5+
jail creates an isolated network environment for target processes, intercepting all HTTP/HTTPS traffic through a transparent proxy that enforces user-defined allow rules.
66

77
## Features
88

@@ -18,24 +18,24 @@ boundary creates an isolated network environment for target processes, intercept
1818

1919
```bash
2020
# Build the tool
21-
go build -o boundary .
21+
go build -o jail .
2222

2323
# Allow only requests to github.com
24-
./boundary --allow "github.com" -- curl https://github.com
24+
./jail --allow "github.com" -- curl https://github.com
2525

2626
# Allow full access to GitHub issues API, but only GET/HEAD elsewhere on GitHub
27-
./boundary \
27+
./jail \
2828
--allow "github.com/api/issues/*" \
2929
--allow "GET,HEAD github.com" \
3030
-- npm install
3131

3232
# Default deny-all: everything is blocked unless explicitly allowed
33-
./boundary -- curl https://example.com
33+
./jail -- curl https://example.com
3434
```
3535

3636
## Allow Rules
3737

38-
boundary uses simple wildcard patterns for URL matching.
38+
jail uses simple wildcard patterns for URL matching.
3939

4040
### Rule Format
4141

@@ -52,14 +52,14 @@ boundary uses simple wildcard patterns for URL matching.
5252

5353
```bash
5454
# Basic patterns
55-
boundary --allow "github.com" -- git pull
55+
jail --allow "github.com" -- git pull
5656

5757
# Wildcard patterns
58-
boundary --allow "*.github.com" -- npm install # GitHub subdomains
59-
boundary --allow "api.*" -- ./app # Any API domain
58+
jail --allow "*.github.com" -- npm install # GitHub subdomains
59+
jail --allow "api.*" -- ./app # Any API domain
6060

6161
# Method-specific rules
62-
boundary --allow "GET,HEAD api.github.com" -- curl https://api.github.com
62+
jail --allow "GET,HEAD api.github.com" -- curl https://api.github.com
6363
```
6464

6565
**Default Policy:** All traffic is denied unless explicitly allowed.
@@ -68,13 +68,13 @@ boundary --allow "GET,HEAD api.github.com" -- curl https://api.github.com
6868

6969
```bash
7070
# Monitor all requests with info logging
71-
boundary --log-level info --allow "*" -- npm install
71+
jail --log-level info --allow "*" -- npm install
7272

7373
# Debug logging for troubleshooting
74-
boundary --log-level debug --allow "github.com" -- git pull
74+
jail --log-level debug --allow "github.com" -- git pull
7575

7676
# Error-only logging
77-
boundary --log-level error --allow "*" -- ./app
77+
jail --log-level error --allow "*" -- ./app
7878
```
7979

8080
**Log Levels:**
@@ -85,20 +85,20 @@ boundary --log-level error --allow "*" -- ./app
8585

8686
## Blocked Request Messages
8787

88-
When a request is blocked, boundary provides helpful guidance:
88+
When a request is blocked, jail provides helpful guidance:
8989

9090
```
91-
🚫 Request Blocked by Boundary
91+
🚫 Request Blocked by Jail
9292
9393
Request: GET /
9494
Host: google.com
9595
Reason: No matching allow rules (default deny-all policy)
9696
97-
To allow this request, restart boundary with:
97+
To allow this request, restart jail with:
9898
--allow "google.com" # Allow all methods to this host
9999
--allow "GET google.com" # Allow only GET requests to this host
100100
101-
For more help: https://github.com/coder/boundary
101+
For more help: https://github.com/coder/jail
102102
```
103103

104104
## Platform Support
@@ -128,30 +128,30 @@ For more help: https://github.com/coder/boundary
128128
### Build from Source
129129

130130
```bash
131-
git clone https://github.com/coder/boundary
132-
cd boundary
133-
go build -o boundary .
131+
git clone https://github.com/coder/jail
132+
cd jail
133+
go build -o jail .
134134
```
135135

136136
## TLS Interception
137137

138-
boundary automatically generates a Certificate Authority (CA) to intercept HTTPS traffic:
138+
jail automatically generates a Certificate Authority (CA) to intercept HTTPS traffic:
139139

140-
- CA stored in `~/.config/boundary/` (or `$XDG_CONFIG_HOME/boundary/`)
141-
- CA certificate provided via `BOUNDARY_CA_CERT` environment variable
140+
- CA stored in `~/.config/jail/` (or `$XDG_CONFIG_HOME/jail/`)
141+
- CA certificate provided via `JAIL_CA_CERT` environment variable
142142
- Certificates generated on-demand for intercepted domains
143143
- CA expires after 1 year
144144

145145
### Disable TLS Interception
146146

147147
```bash
148-
boundary --no-tls-intercept --allow "*" -- ./app
148+
jail --no-tls-intercept --allow "*" -- ./app
149149
```
150150

151151
## Command-Line Options
152152

153153
```text
154-
boundary [flags] -- command [args...]
154+
jail [flags] -- command [args...]
155155
156156
OPTIONS:
157157
--allow <SPEC> Allow rule (repeatable)
@@ -165,14 +165,14 @@ OPTIONS:
165165

166166
```bash
167167
# Build
168-
go build -o boundary .
168+
go build -o jail .
169169

170170
# Test
171171
go test ./...
172172

173173
# Cross-compile
174-
GOOS=linux GOARCH=amd64 go build -o boundary-linux .
175-
GOOS=darwin GOARCH=amd64 go build -o boundary-macos .
174+
GOOS=linux GOARCH=amd64 go build -o jail-linux .
175+
GOOS=darwin GOARCH=amd64 go build -o jail-macos .
176176
```
177177

178178
## License

go.mod

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
1-
module boundary
1+
module github.com/coder/jail
22

3-
go 1.21.4
3+
go 1.25
44

5-
toolchain go1.23.8
5+
require github.com/coder/serpent v0.10.0
66

77
require (
88
cdr.dev/slog v1.6.2-0.20240126064726-20367d4aede6 // indirect
9-
github.com/coder/serpent v0.10.0
10-
gopkg.in/yaml.v3 v3.0.1 // indirect
11-
)
12-
13-
require (
149
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
1510
github.com/coder/pretty v0.0.0-20230908205945-e89ba86370e0 // indirect
1611
github.com/hashicorp/errwrap v1.1.0 // indirect
@@ -32,4 +27,5 @@ require (
3227
golang.org/x/sys v0.17.0 // indirect
3328
golang.org/x/term v0.17.0 // indirect
3429
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
30+
gopkg.in/yaml.v3 v3.0.1 // indirect
3531
)

main.go

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package main
22

33
import (
44
"context"
5+
cryptotls "crypto/tls"
56
"fmt"
67
"log/slog"
78
"os"
@@ -10,72 +11,70 @@ import (
1011
"strings"
1112
"syscall"
1213
"time"
13-
cryptotls "crypto/tls"
14-
15-
"boundary/netjail"
16-
"boundary/proxy"
17-
"boundary/rules"
18-
"boundary/tls"
1914

15+
"github.com/coder/jail/netjail"
16+
"github.com/coder/jail/proxy"
17+
"github.com/coder/jail/rules"
18+
"github.com/coder/jail/tls"
2019
"github.com/coder/serpent"
2120
)
2221

2322
var (
24-
allowStrings []string
25-
noTLSIntercept bool
26-
logLevel string
27-
noJailCleanup bool
23+
allowStrings []string
24+
noTLSIntercept bool
25+
logLevel string
26+
noJailCleanup bool
2827
)
2928

3029
func main() {
3130
cmd := &serpent.Command{
32-
Use: "boundary [flags] -- command [args...]",
31+
Use: "jail [flags] -- command [args...]",
3332
Short: "Monitor and restrict HTTP/HTTPS requests from processes",
34-
Long: `boundary creates an isolated network environment for the target process,
33+
Long: `jail creates an isolated network environment for the target process,
3534
intercepting all HTTP/HTTPS traffic through a transparent proxy that enforces
3635
user-defined rules.
3736
3837
Examples:
3938
# Allow only requests to github.com
40-
boundary --allow "github.com" -- curl https://github.com
39+
jail --allow "github.com" -- curl https://github.com
4140
4241
# Monitor all requests to specific domains (allow only those)
43-
boundary --allow "github.com/api/issues/*" --allow "GET,HEAD github.com" -- npm install
42+
jail --allow "github.com/api/issues/*" --allow "GET,HEAD github.com" -- npm install
4443
4544
# Block everything by default (implicit)`,
4645
Options: serpent.OptionSet{
4746
{
4847
Name: "allow",
4948
Flag: "allow",
50-
Env: "BOUNDARY_ALLOW",
49+
Env: "JAIL_ALLOW",
5150
Description: "Allow rule (can be specified multiple times). Format: 'pattern' or 'METHOD[,METHOD] pattern'.",
5251
Value: serpent.StringArrayOf(&allowStrings),
5352
},
5453
{
5554
Name: "no-tls-intercept",
5655
Flag: "no-tls-intercept",
57-
Env: "BOUNDARY_NO_TLS_INTERCEPT",
56+
Env: "JAIL_NO_TLS_INTERCEPT",
5857
Description: "Disable HTTPS interception.",
5958
Value: serpent.BoolOf(&noTLSIntercept),
6059
},
6160
{
6261
Name: "log-level",
6362
Flag: "log-level",
64-
Env: "BOUNDARY_LOG_LEVEL",
63+
Env: "JAIL_LOG_LEVEL",
6564
Description: "Set log level (error, warn, info, debug).",
6665
Default: "warn",
6766
Value: serpent.StringOf(&logLevel),
6867
},
6968
{
7069
Name: "no-jail-cleanup",
7170
Flag: "no-jail-cleanup",
72-
Env: "BOUNDARY_NO_JAIL_CLEANUP",
71+
Env: "JAIL_NO_JAIL_CLEANUP",
7372
Description: "Skip jail cleanup (hidden flag for testing).",
7473
Value: serpent.BoolOf(&noJailCleanup),
7574
Hidden: true,
7675
},
7776
},
78-
Handler: runBoundary,
77+
Handler: runJail,
7978
}
8079

8180
err := cmd.Invoke().WithOS().Run()
@@ -108,7 +107,7 @@ func setupLogging(logLevel string) *slog.Logger {
108107
return slog.New(handler)
109108
}
110109

111-
func runBoundary(inv *serpent.Invocation) error {
110+
func runJail(inv *serpent.Invocation) error {
112111
logger := setupLogging(logLevel)
113112

114113
// Get command arguments
@@ -172,21 +171,21 @@ func runBoundary(inv *serpent.Invocation) error {
172171

173172
// Set standard CA certificate environment variables for common tools
174173
// This makes tools like curl, git, etc. trust our dynamically generated CA
175-
extraEnv["SSL_CERT_FILE"] = caCertPath // OpenSSL/LibreSSL-based tools
176-
extraEnv["SSL_CERT_DIR"] = configDir // OpenSSL certificate directory
177-
extraEnv["CURL_CA_BUNDLE"] = caCertPath // curl
178-
extraEnv["GIT_SSL_CAINFO"] = caCertPath // Git
179-
extraEnv["REQUESTS_CA_BUNDLE"] = caCertPath // Python requests
180-
extraEnv["NODE_EXTRA_CA_CERTS"] = caCertPath // Node.js
181-
extraEnv["BOUNDARY_CA_CERT"] = string(caCertPEM) // Keep for backward compatibility
174+
extraEnv["SSL_CERT_FILE"] = caCertPath // OpenSSL/LibreSSL-based tools
175+
extraEnv["SSL_CERT_DIR"] = configDir // OpenSSL certificate directory
176+
extraEnv["CURL_CA_BUNDLE"] = caCertPath // curl
177+
extraEnv["GIT_SSL_CAINFO"] = caCertPath // Git
178+
extraEnv["REQUESTS_CA_BUNDLE"] = caCertPath // Python requests
179+
extraEnv["NODE_EXTRA_CA_CERTS"] = caCertPath // Node.js
180+
extraEnv["JAIL_CA_CERT"] = string(caCertPEM) // Keep for backward compatibility
182181
}
183182

184183
// Create network jail configuration
185184
netjailConfig := netjail.Config{
186-
HTTPPort: 8040,
187-
HTTPSPort: 8043,
188-
NetJailName: "boundary",
189-
SkipCleanup: noJailCleanup,
185+
HTTPPort: 8040,
186+
HTTPSPort: 8043,
187+
NetJailName: "jail",
188+
SkipCleanup: noJailCleanup,
190189
}
191190

192191
// Create network jail
@@ -274,4 +273,4 @@ func runBoundary(inv *serpent.Invocation) error {
274273
}
275274

276275
return nil
277-
}
276+
}

proxy/proxy.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"net/url"
1111
"time"
1212

13-
"boundary/rules"
13+
"github.com/coder/jail/rules"
1414
)
1515

1616
// ProxyServer handles HTTP and HTTPS requests with rule-based filtering
@@ -249,24 +249,24 @@ func (p *ProxyServer) forwardHTTPSRequest(w http.ResponseWriter, r *http.Request
249249
func (p *ProxyServer) writeBlockedResponse(w http.ResponseWriter, r *http.Request) {
250250
w.Header().Set("Content-Type", "text/plain")
251251
w.WriteHeader(http.StatusForbidden)
252-
252+
253253
// Extract host from URL for cleaner display
254254
host := r.URL.Host
255255
if host == "" {
256256
host = r.Host
257257
}
258-
259-
fmt.Fprintf(w, `🚫 Request Blocked by Boundary
258+
259+
fmt.Fprintf(w, `🚫 Request Blocked by Jail
260260
261261
Request: %s %s
262262
Host: %s
263263
Reason: No matching allow rules (default deny-all policy)
264264
265-
To allow this request, restart boundary with:
265+
To allow this request, restart jail with:
266266
--allow "%s" # Allow all methods to this host
267267
--allow "%s %s" # Allow only %s requests to this host
268268
269-
For more help: https://github.com/coder/boundary
270-
`,
269+
For more help: https://github.com/coder/jail
270+
`,
271271
r.Method, r.URL.Path, host, host, r.Method, host, r.Method)
272-
}
272+
}

0 commit comments

Comments
 (0)