Skip to content

Commit 52dca9b

Browse files
committed
Bind shim, runner, and job ports to localhost only
1 parent 740b2cc commit 52dca9b

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

runner/cmd/runner/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func start(tempDir string, homeDir string, httpPort int, sshPort int, logLevel i
3838
log.DefaultEntry.Logger.SetOutput(io.MultiWriter(os.Stdout, defaultLogFile))
3939
log.DefaultEntry.Logger.SetLevel(logrus.Level(logLevel))
4040

41-
server, err := api.NewServer(tempDir, homeDir, fmt.Sprintf(":%d", httpPort), sshPort, version)
41+
server, err := api.NewServer(tempDir, homeDir, fmt.Sprintf("localhost:%d", httpPort), sshPort, version)
4242
if err != nil {
4343
return tracerr.Errorf("Failed to create server: %w", err)
4444
}

runner/cmd/shim/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ func start(ctx context.Context, args shim.CLIArgs, serviceMode bool) (err error)
240240
}
241241
}
242242

243-
address := fmt.Sprintf(":%d", args.Shim.HTTPPort)
243+
address := fmt.Sprintf("localhost:%d", args.Shim.HTTPPort)
244244
shimServer := api.NewShimServer(ctx, address, Version, dockerRunner, dcgmExporter, dcgmWrapper)
245245

246246
defer func() {

runner/internal/shim/docker.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,7 @@ func bindPorts(ports []int) nat.PortMap {
982982
for _, port := range ports {
983983
portMap[nat.Port(fmt.Sprintf("%d/tcp", port))] = []nat.PortBinding{
984984
{
985-
HostIP: "0.0.0.0",
985+
HostIP: "127.0.0.1",
986986
HostPort: "", // use ephemeral port from ip_local_port_range
987987
},
988988
}

0 commit comments

Comments
 (0)