@@ -21,7 +21,7 @@ use std::str::FromStr;
2121/// Default SSH port inside sandbox containers.
2222pub const DEFAULT_SSH_PORT : u16 = 2222 ;
2323
24- /// Default server / SSH gateway port.
24+ /// Default gateway server port.
2525pub const DEFAULT_SERVER_PORT : u16 = 8080 ;
2626
2727/// Default container stop timeout in seconds (SIGTERM → SIGKILL).
@@ -216,75 +216,10 @@ pub struct Config {
216216 #[ serde( default ) ]
217217 pub compute_drivers : Vec < ComputeDriverKind > ,
218218
219- /// Kubernetes namespace for sandboxes.
220- #[ serde( default = "default_sandbox_namespace" ) ]
221- pub sandbox_namespace : String ,
222-
223- /// Default container image for sandboxes.
224- #[ serde( default = "default_sandbox_image" ) ]
225- pub sandbox_image : String ,
226-
227- /// Kubernetes `imagePullPolicy` for sandbox pods (e.g. `Always`,
228- /// `IfNotPresent`, `Never`). Defaults to empty, which lets Kubernetes
229- /// apply its own default (`:latest` → `Always`, anything else →
230- /// `IfNotPresent`).
231- #[ serde( default ) ]
232- pub sandbox_image_pull_policy : String ,
233-
234- /// gRPC endpoint for sandboxes to connect back to `OpenShell`.
235- /// Used by sandbox pods to fetch their policy at startup.
236- #[ serde( default ) ]
237- pub grpc_endpoint : String ,
238-
239- /// Public gateway host for SSH proxy connections.
240- #[ serde( default = "default_ssh_gateway_host" ) ]
241- pub ssh_gateway_host : String ,
242-
243- /// Public gateway port for SSH proxy connections.
244- #[ serde( default = "default_ssh_gateway_port" ) ]
245- pub ssh_gateway_port : u16 ,
246-
247- /// SSH listen port inside sandbox containers that expose a TCP endpoint.
248- #[ serde( default = "default_sandbox_ssh_port" ) ]
249- pub sandbox_ssh_port : u16 ,
250-
251- /// Filesystem path where the sandbox supervisor binds its SSH Unix
252- /// socket. The supervisor is passed this path via
253- /// `OPENSHELL_SSH_SOCKET_PATH` / `--ssh-socket-path` and connects its
254- /// relay bridge to the same path.
255- ///
256- /// When the gateway orchestrates sandboxes that each live in their own
257- /// filesystem (K8s pod, libkrun VM, etc.), the default is safe. For
258- /// local dev where multiple supervisors share `/run`, override this to
259- /// something unique per sandbox.
260- #[ serde( default = "default_sandbox_ssh_socket_path" ) ]
261- pub sandbox_ssh_socket_path : String ,
262-
263219 /// TTL for SSH session tokens, in seconds. 0 disables expiry.
264220 #[ serde( default = "default_ssh_session_ttl_secs" ) ]
265221 pub ssh_session_ttl_secs : u64 ,
266222
267- /// Kubernetes secret name containing client TLS materials for sandbox pods.
268- /// When set, sandbox pods get this secret mounted so they can connect to
269- /// the server over mTLS.
270- #[ serde( default ) ]
271- pub client_tls_secret_name : String ,
272-
273- /// Host gateway IP for sandbox pod hostAliases.
274- /// When set, sandbox pods get hostAliases entries mapping
275- /// `host.docker.internal` and `host.openshell.internal` to this IP,
276- /// allowing them to reach services running on the Docker host.
277- #[ serde( default ) ]
278- pub host_gateway_ip : String ,
279-
280- /// Enable Kubernetes user namespace isolation (`hostUsers: false`) for
281- /// sandbox pods. When enabled, container UID 0 maps to an unprivileged
282- /// host UID and capabilities become namespaced. Requires Kubernetes 1.33+
283- /// with user namespace support available (beta through 1.35, GA in 1.36+),
284- /// plus a supporting container runtime and Linux 5.12+.
285- #[ serde( default ) ]
286- pub enable_user_namespaces : bool ,
287-
288223 /// Browser-facing sandbox service routing configuration.
289224 #[ serde( default ) ]
290225 pub service_routing : ServiceRoutingConfig ,
@@ -407,18 +342,7 @@ impl Config {
407342 oidc : None ,
408343 database_url : String :: new ( ) ,
409344 compute_drivers : vec ! [ ] ,
410- sandbox_namespace : default_sandbox_namespace ( ) ,
411- sandbox_image : default_sandbox_image ( ) ,
412- sandbox_image_pull_policy : String :: new ( ) ,
413- grpc_endpoint : String :: new ( ) ,
414- ssh_gateway_host : default_ssh_gateway_host ( ) ,
415- ssh_gateway_port : default_ssh_gateway_port ( ) ,
416- sandbox_ssh_port : default_sandbox_ssh_port ( ) ,
417- sandbox_ssh_socket_path : default_sandbox_ssh_socket_path ( ) ,
418345 ssh_session_ttl_secs : default_ssh_session_ttl_secs ( ) ,
419- client_tls_secret_name : String :: new ( ) ,
420- host_gateway_ip : String :: new ( ) ,
421- enable_user_namespaces : false ,
422346 service_routing : ServiceRoutingConfig :: default ( ) ,
423347 }
424348 }
@@ -479,76 +403,13 @@ impl Config {
479403 self
480404 }
481405
482- /// Create a new configuration with a sandbox namespace.
483- #[ must_use]
484- pub fn with_sandbox_namespace ( mut self , namespace : impl Into < String > ) -> Self {
485- self . sandbox_namespace = namespace. into ( ) ;
486- self
487- }
488-
489- /// Create a new configuration with a default sandbox image.
490- #[ must_use]
491- pub fn with_sandbox_image ( mut self , image : impl Into < String > ) -> Self {
492- self . sandbox_image = image. into ( ) ;
493- self
494- }
495-
496- /// Create a new configuration with a sandbox image pull policy.
497- #[ must_use]
498- pub fn with_sandbox_image_pull_policy ( mut self , policy : impl Into < String > ) -> Self {
499- self . sandbox_image_pull_policy = policy. into ( ) ;
500- self
501- }
502-
503- /// Create a new configuration with a gRPC endpoint for sandbox callback.
504- #[ must_use]
505- pub fn with_grpc_endpoint ( mut self , endpoint : impl Into < String > ) -> Self {
506- self . grpc_endpoint = endpoint. into ( ) ;
507- self
508- }
509-
510- /// Create a new configuration with the SSH gateway host.
511- #[ must_use]
512- pub fn with_ssh_gateway_host ( mut self , host : impl Into < String > ) -> Self {
513- self . ssh_gateway_host = host. into ( ) ;
514- self
515- }
516-
517- /// Create a new configuration with the SSH gateway port.
518- #[ must_use]
519- pub const fn with_ssh_gateway_port ( mut self , port : u16 ) -> Self {
520- self . ssh_gateway_port = port;
521- self
522- }
523-
524- /// Create a new configuration with the sandbox SSH port.
525- #[ must_use]
526- pub const fn with_sandbox_ssh_port ( mut self , port : u16 ) -> Self {
527- self . sandbox_ssh_port = port;
528- self
529- }
530-
531406 /// Create a new configuration with the SSH session TTL.
532407 #[ must_use]
533408 pub const fn with_ssh_session_ttl_secs ( mut self , secs : u64 ) -> Self {
534409 self . ssh_session_ttl_secs = secs;
535410 self
536411 }
537412
538- /// Set the Kubernetes secret name for sandbox client TLS materials.
539- #[ must_use]
540- pub fn with_client_tls_secret_name ( mut self , name : impl Into < String > ) -> Self {
541- self . client_tls_secret_name = name. into ( ) ;
542- self
543- }
544-
545- /// Set the host gateway IP for sandbox pod hostAliases.
546- #[ must_use]
547- pub fn with_host_gateway_ip ( mut self , ip : impl Into < String > ) -> Self {
548- self . host_gateway_ip = ip. into ( ) ;
549- self
550- }
551-
552413 /// Set the OIDC configuration for JWT-based authentication.
553414 #[ must_use]
554415 pub fn with_oidc ( mut self , oidc : OidcConfig ) -> Self {
@@ -653,30 +514,6 @@ fn default_log_level() -> String {
653514 "info" . to_string ( )
654515}
655516
656- fn default_sandbox_namespace ( ) -> String {
657- "default" . to_string ( )
658- }
659-
660- fn default_sandbox_image ( ) -> String {
661- format ! ( "{}/base:latest" , crate :: image:: DEFAULT_COMMUNITY_REGISTRY )
662- }
663-
664- fn default_ssh_gateway_host ( ) -> String {
665- "127.0.0.1" . to_string ( )
666- }
667-
668- const fn default_ssh_gateway_port ( ) -> u16 {
669- DEFAULT_SERVER_PORT
670- }
671-
672- fn default_sandbox_ssh_socket_path ( ) -> String {
673- "/run/openshell/ssh.sock" . to_string ( )
674- }
675-
676- const fn default_sandbox_ssh_port ( ) -> u16 {
677- DEFAULT_SSH_PORT
678- }
679-
680517const fn default_ssh_session_ttl_secs ( ) -> u64 {
681518 86400 // 24 hours
682519}
0 commit comments