@@ -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 ,
@@ -401,18 +336,7 @@ impl Config {
401336 oidc : None ,
402337 database_url : String :: new ( ) ,
403338 compute_drivers : vec ! [ ] ,
404- sandbox_namespace : default_sandbox_namespace ( ) ,
405- sandbox_image : default_sandbox_image ( ) ,
406- sandbox_image_pull_policy : String :: new ( ) ,
407- grpc_endpoint : String :: new ( ) ,
408- ssh_gateway_host : default_ssh_gateway_host ( ) ,
409- ssh_gateway_port : default_ssh_gateway_port ( ) ,
410- sandbox_ssh_port : default_sandbox_ssh_port ( ) ,
411- sandbox_ssh_socket_path : default_sandbox_ssh_socket_path ( ) ,
412339 ssh_session_ttl_secs : default_ssh_session_ttl_secs ( ) ,
413- client_tls_secret_name : String :: new ( ) ,
414- host_gateway_ip : String :: new ( ) ,
415- enable_user_namespaces : false ,
416340 service_routing : ServiceRoutingConfig :: default ( ) ,
417341 }
418342 }
@@ -473,76 +397,13 @@ impl Config {
473397 self
474398 }
475399
476- /// Create a new configuration with a sandbox namespace.
477- #[ must_use]
478- pub fn with_sandbox_namespace ( mut self , namespace : impl Into < String > ) -> Self {
479- self . sandbox_namespace = namespace. into ( ) ;
480- self
481- }
482-
483- /// Create a new configuration with a default sandbox image.
484- #[ must_use]
485- pub fn with_sandbox_image ( mut self , image : impl Into < String > ) -> Self {
486- self . sandbox_image = image. into ( ) ;
487- self
488- }
489-
490- /// Create a new configuration with a sandbox image pull policy.
491- #[ must_use]
492- pub fn with_sandbox_image_pull_policy ( mut self , policy : impl Into < String > ) -> Self {
493- self . sandbox_image_pull_policy = policy. into ( ) ;
494- self
495- }
496-
497- /// Create a new configuration with a gRPC endpoint for sandbox callback.
498- #[ must_use]
499- pub fn with_grpc_endpoint ( mut self , endpoint : impl Into < String > ) -> Self {
500- self . grpc_endpoint = endpoint. into ( ) ;
501- self
502- }
503-
504- /// Create a new configuration with the SSH gateway host.
505- #[ must_use]
506- pub fn with_ssh_gateway_host ( mut self , host : impl Into < String > ) -> Self {
507- self . ssh_gateway_host = host. into ( ) ;
508- self
509- }
510-
511- /// Create a new configuration with the SSH gateway port.
512- #[ must_use]
513- pub const fn with_ssh_gateway_port ( mut self , port : u16 ) -> Self {
514- self . ssh_gateway_port = port;
515- self
516- }
517-
518- /// Create a new configuration with the sandbox SSH port.
519- #[ must_use]
520- pub const fn with_sandbox_ssh_port ( mut self , port : u16 ) -> Self {
521- self . sandbox_ssh_port = port;
522- self
523- }
524-
525400 /// Create a new configuration with the SSH session TTL.
526401 #[ must_use]
527402 pub const fn with_ssh_session_ttl_secs ( mut self , secs : u64 ) -> Self {
528403 self . ssh_session_ttl_secs = secs;
529404 self
530405 }
531406
532- /// Set the Kubernetes secret name for sandbox client TLS materials.
533- #[ must_use]
534- pub fn with_client_tls_secret_name ( mut self , name : impl Into < String > ) -> Self {
535- self . client_tls_secret_name = name. into ( ) ;
536- self
537- }
538-
539- /// Set the host gateway IP for sandbox pod hostAliases.
540- #[ must_use]
541- pub fn with_host_gateway_ip ( mut self , ip : impl Into < String > ) -> Self {
542- self . host_gateway_ip = ip. into ( ) ;
543- self
544- }
545-
546407 /// Set the OIDC configuration for JWT-based authentication.
547408 #[ must_use]
548409 pub fn with_oidc ( mut self , oidc : OidcConfig ) -> Self {
@@ -647,30 +508,6 @@ fn default_log_level() -> String {
647508 "info" . to_string ( )
648509}
649510
650- fn default_sandbox_namespace ( ) -> String {
651- "default" . to_string ( )
652- }
653-
654- fn default_sandbox_image ( ) -> String {
655- format ! ( "{}/base:latest" , crate :: image:: DEFAULT_COMMUNITY_REGISTRY )
656- }
657-
658- fn default_ssh_gateway_host ( ) -> String {
659- "127.0.0.1" . to_string ( )
660- }
661-
662- const fn default_ssh_gateway_port ( ) -> u16 {
663- DEFAULT_SERVER_PORT
664- }
665-
666- fn default_sandbox_ssh_socket_path ( ) -> String {
667- "/run/openshell/ssh.sock" . to_string ( )
668- }
669-
670- const fn default_sandbox_ssh_port ( ) -> u16 {
671- DEFAULT_SSH_PORT
672- }
673-
674511const fn default_ssh_session_ttl_secs ( ) -> u64 {
675512 86400 // 24 hours
676513}
0 commit comments