File tree Expand file tree Collapse file tree 3 files changed +11
-4
lines changed
Expand file tree Collapse file tree 3 files changed +11
-4
lines changed Original file line number Diff line number Diff line change 1- FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.23 as build
1+ FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.25 as build
22
33ARG TARGETPLATFORM
44ARG BUILDPLATFORM
Original file line number Diff line number Diff line change 11module slicer-ssh-agent
22
3- go 1.23.4
3+ go 1.25
44
55require (
66 github.com/creack/pty v1.1.24
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ Copyright (c) 2025 Alex Ellis, OpenFaaS Ltd
3232` , Version )
3333
3434 port := uint32 (514 )
35+
3536 l , err := vsock .Listen (port , nil )
3637 if err != nil {
3738 log .Fatal (err )
@@ -41,10 +42,11 @@ Copyright (c) 2025 Alex Ellis, OpenFaaS Ltd
4142 for {
4243 conn , err := l .Accept ()
4344 if err != nil {
44- log .Fatal (err )
45+ log .Printf ("Error accepting connection: %v" , err )
46+ continue
4547 }
4648
47- fmt .Printf ("Connection accepted from socket\n " )
49+ fmt .Printf ("Connection from socket. CID: %d \n " , conn . RemoteAddr ().( * vsock. Addr ). ContextID )
4850
4951 go handleConnection (conn )
5052 }
@@ -53,6 +55,11 @@ Copyright (c) 2025 Alex Ellis, OpenFaaS Ltd
5355func handleConnection (conn net.Conn ) {
5456 defer conn .Close ()
5557
58+ if conn .RemoteAddr ().(* vsock.Addr ).ContextID != vsock .Host {
59+ log .Printf ("Closing connection from CID: %d, not allowed." , conn .RemoteAddr ().(* vsock.Addr ).ContextID )
60+ return
61+ }
62+
5663 var err error
5764 // Try multiple shells in order of preference
5865 shells := []string {"/bin/bash" , "/bin/sh" , "/usr/bin/sh" }
You can’t perform that action at this time.
0 commit comments