Skip to content

Commit e11ed2d

Browse files
fix: remove allowed host (#541)
- Use official installation script for boundary instead of compiling from source. - Use boundary-run wrapper.
1 parent 8add161 commit e11ed2d

File tree

3 files changed

+36
-14
lines changed

3 files changed

+36
-14
lines changed

registry/coder/modules/claude-code/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Run the [Claude Code](https://docs.anthropic.com/en/docs/agents-and-tools/claude
1313
```tf
1414
module "claude-code" {
1515
source = "registry.coder.com/coder/claude-code/coder"
16-
version = "4.0.1"
16+
version = "4.1.0"
1717
agent_id = coder_agent.example.id
1818
workdir = "/home/coder/project"
1919
claude_api_key = "xxxx-xxxxx-xxxx"
@@ -70,7 +70,7 @@ data "coder_parameter" "ai_prompt" {
7070
7171
module "claude-code" {
7272
source = "registry.coder.com/coder/claude-code/coder"
73-
version = "4.0.1"
73+
version = "4.1.0"
7474
agent_id = coder_agent.example.id
7575
workdir = "/home/coder/project"
7676
@@ -106,7 +106,7 @@ Run and configure Claude Code as a standalone CLI in your workspace.
106106
```tf
107107
module "claude-code" {
108108
source = "registry.coder.com/coder/claude-code/coder"
109-
version = "4.0.1"
109+
version = "4.1.0"
110110
agent_id = coder_agent.example.id
111111
workdir = "/home/coder"
112112
install_claude_code = true
@@ -129,7 +129,7 @@ variable "claude_code_oauth_token" {
129129
130130
module "claude-code" {
131131
source = "registry.coder.com/coder/claude-code/coder"
132-
version = "4.0.1"
132+
version = "4.1.0"
133133
agent_id = coder_agent.example.id
134134
workdir = "/home/coder/project"
135135
claude_code_oauth_token = var.claude_code_oauth_token
@@ -202,7 +202,7 @@ resource "coder_env" "bedrock_api_key" {
202202
203203
module "claude-code" {
204204
source = "registry.coder.com/coder/claude-code/coder"
205-
version = "4.0.1"
205+
version = "4.1.0"
206206
agent_id = coder_agent.example.id
207207
workdir = "/home/coder/project"
208208
model = "global.anthropic.claude-sonnet-4-5-20250929-v1:0"
@@ -259,7 +259,7 @@ resource "coder_env" "google_application_credentials" {
259259
260260
module "claude-code" {
261261
source = "registry.coder.com/coder/claude-code/coder"
262-
version = "4.0.1"
262+
version = "4.1.0"
263263
agent_id = coder_agent.example.id
264264
workdir = "/home/coder/project"
265265
model = "claude-sonnet-4@20250514"

registry/coder/modules/claude-code/main.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,12 @@ variable "boundary_pprof_port" {
240240
default = "6067"
241241
}
242242

243+
variable "compile_boundary_from_source" {
244+
type = bool
245+
description = "Whether to compile boundary from source instead of using the official install script"
246+
default = false
247+
}
248+
243249
resource "coder_env" "claude_code_md_path" {
244250
count = var.claude_md_path == "" ? 0 : 1
245251

@@ -357,6 +363,7 @@ module "agentapi" {
357363
ARG_BOUNDARY_PROXY_PORT='${var.boundary_proxy_port}' \
358364
ARG_ENABLE_BOUNDARY_PPROF='${var.enable_boundary_pprof}' \
359365
ARG_BOUNDARY_PPROF_PORT='${var.boundary_pprof_port}' \
366+
ARG_COMPILE_FROM_SOURCE='${var.compile_boundary_from_source}' \
360367
ARG_CODER_HOST='${local.coder_host}' \
361368
/tmp/start.sh
362369
EOT

registry/coder/modules/claude-code/scripts/start.sh

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ ARG_BOUNDARY_LOG_LEVEL=${ARG_BOUNDARY_LOG_LEVEL:-"WARN"}
2828
ARG_BOUNDARY_PROXY_PORT=${ARG_BOUNDARY_PROXY_PORT:-"8087"}
2929
ARG_ENABLE_BOUNDARY_PPROF=${ARG_ENABLE_BOUNDARY_PPROF:-false}
3030
ARG_BOUNDARY_PPROF_PORT=${ARG_BOUNDARY_PPROF_PORT:-"6067"}
31+
ARG_COMPILE_FROM_SOURCE=${ARG_COMPILE_FROM_SOURCE:-false}
3132
ARG_CODER_HOST=${ARG_CODER_HOST:-}
3233

3334
echo "--------------------------------"
@@ -45,6 +46,7 @@ printf "ARG_BOUNDARY_VERSION: %s\n" "$ARG_BOUNDARY_VERSION"
4546
printf "ARG_BOUNDARY_LOG_DIR: %s\n" "$ARG_BOUNDARY_LOG_DIR"
4647
printf "ARG_BOUNDARY_LOG_LEVEL: %s\n" "$ARG_BOUNDARY_LOG_LEVEL"
4748
printf "ARG_BOUNDARY_PROXY_PORT: %s\n" "$ARG_BOUNDARY_PROXY_PORT"
49+
printf "ARG_COMPILE_FROM_SOURCE: %s\n" "$ARG_COMPILE_FROM_SOURCE"
4850
printf "ARG_CODER_HOST: %s\n" "$ARG_CODER_HOST"
4951

5052
echo "--------------------------------"
@@ -63,11 +65,25 @@ case $session_cleanup_exit_code in
6365
esac
6466

6567
function install_boundary() {
66-
# Install boundary from public github repo
67-
git clone https://github.com/coder/boundary
68-
cd boundary
69-
git checkout $ARG_BOUNDARY_VERSION
70-
go install ./cmd/...
68+
if [ "${ARG_COMPILE_FROM_SOURCE:-false}" = "true" ]; then
69+
# Install boundary by compiling from source
70+
echo "Compiling boundary from source (version: $ARG_BOUNDARY_VERSION)"
71+
git clone https://github.com/coder/boundary.git
72+
cd boundary
73+
git checkout "$ARG_BOUNDARY_VERSION"
74+
75+
# Build the binary
76+
make build
77+
78+
# Install binary and wrapper script (optional)
79+
sudo cp boundary /usr/local/bin/
80+
sudo cp scripts/boundary-wrapper.sh /usr/local/bin/boundary-run
81+
sudo chmod +x /usr/local/bin/boundary-run
82+
else
83+
# Install boundary using official install script
84+
echo "Installing boundary using official install script (version: $ARG_BOUNDARY_VERSION)"
85+
curl -fsSL https://raw.githubusercontent.com/coder/boundary/main/install.sh | bash -s -- --version "$ARG_BOUNDARY_VERSION"
86+
fi
7187
}
7288

7389
function validate_claude_installation() {
@@ -209,9 +225,8 @@ function start_agentapi() {
209225
BOUNDARY_ARGS+=(--pprof-port ${ARG_BOUNDARY_PPROF_PORT})
210226
fi
211227

212-
agentapi server --allowed-hosts="*" --type claude --term-width 67 --term-height 1190 -- \
213-
sudo -E env PATH=$PATH setpriv --reuid=$(id -u) --regid=$(id -g) --clear-groups \
214-
--inh-caps=+net_admin --ambient-caps=+net_admin --bounding-set=+net_admin boundary "${BOUNDARY_ARGS[@]}" -- \
228+
agentapi server --type claude --term-width 67 --term-height 1190 -- \
229+
boundary-run "${BOUNDARY_ARGS[@]}" -- \
215230
claude "${ARGS[@]}"
216231
else
217232
agentapi server --type claude --term-width 67 --term-height 1190 -- claude "${ARGS[@]}"

0 commit comments

Comments
 (0)