You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactor jail architecture with integrated services (#15)
* start
* Refactor jail to use integrated services architecture
- Updated namespace implementations to include environment setup in Command method
- Migrated Execute function logic from namespaces into Command method with proper env, credentials, and I/O setup
- Enhanced jail.Jail to integrate proxy server, certificate manager, rule engine, and auditor
- Simplified CLI to use unified jail.Jail instead of managing separate components
- Maintained all existing functionality while improving code organization
- All tests pass and binary builds successfully
Co-authored-by: f0ssel <[email protected]>
* Move environment setup to Open method in namespace implementations
- Move environment preparation from Command() to Open() method in both Linux and macOS namespaces
- Add preparedEnv field to store the prepared environment once during setup
- Simplify Command() methods to just inject the prepared environment
- Improves performance by avoiding repeated environment setup on each command
- Maintains all existing functionality while improving efficiency
Co-authored-by: f0ssel <[email protected]>
* Move sudo credential setup to Open method in namespace implementations
- Move sudo credential preparation from Command() to Open() method in both Linux and macOS namespaces
- Add procAttr field to store prepared syscall.SysProcAttr with credentials
- Simplify Command() methods to just use the prepared process attributes
- Eliminates repeated sudo environment checks and credential parsing on each command
- Further improves performance and code organization
- All credential handling now happens once during setup phase
Co-authored-by: f0ssel <[email protected]>
* Move construction logic from jail.New to CLI caller
- Simplify jail.Config to only contain dependencies (Commander, ProxyServer, etc)
- Move all component construction logic from jail.New into CLI
- jail.New now only accepts pre-constructed dependencies and assembles them
- CLI handles rule parsing, certificate manager creation, proxy server setup
- Better separation of concerns: jail package focuses on orchestration, CLI handles construction
- Eliminates error handling in jail.New since dependencies are pre-validated
- Makes jail package more testable with dependency injection
Co-authored-by: f0ssel <[email protected]>
* Remove unneeded dependencies from jail.Config
- Remove RuleEngine, Auditor, and CertManager from jail.Config
- These dependencies are only needed by ProxyServer, not by Jail directly
- Simplify jail.Config to only contain CommandExecutor, ProxyServer, and Logger
- Remove GetCACertPEM method since CertManager is no longer available in Jail
- Clean up unused imports (audit, rules, tls packages)
- CA certificate handling remains in CLI where CertManager is constructed
- Further simplifies the Jail orchestration layer
Co-authored-by: f0ssel <[email protected]>
* remove no cleanup
* setenv
* Convert preparedEnv to map and implement SetEnv methods
- Convert preparedEnv from []string to map[string]string for better environment management
- Implement SetEnv methods in both Linux and macOS namespace implementations
- Add CommandExecutor accessor method to Jail for SetEnv access
- Update CLI to use SetEnv method for CA certificate environment variables
- Remove Env field from namespace.Config since SetEnv is used instead
- Environment variables now properly managed through SetEnv interface
- Allows dynamic environment variable setting after initialization
- Better encapsulation and control over environment variables
Co-authored-by: f0ssel <[email protected]>
* fix
* fix
* fix
* fix
* Move TLS setup logic to CertificateManager method
- Add SetupTLSAndWriteCACert method to CertificateManager
- Combines getting TLS config, CA cert PEM, and writing CA cert to file
- Returns TLS config, CA cert path, and CA cert PEM in one call
- Update CLI to use the new method instead of separate calls
- Reduces complexity in CLI Run function
- Better encapsulation of TLS-related setup logic
- Remove unused filepath import from CLI
- Clean separation between TLS setup and CLI orchestration
Co-authored-by: f0ssel <[email protected]>
* Move GetConfigDir call into CertificateManager and remove unused return value
- Update SetupTLSAndWriteCACert to call tls.GetConfigDir() internally
- Return config directory as part of the method's return values
- Remove unused []byte (CA cert PEM) from return values since it's never used
- Update CLI to handle new return signature with configDir
- Remove separate GetConfigDir call from CLI
- Pass empty string to NewCertificateManager since configDir is determined internally
- Further simplifies CLI by removing another external dependency call
- Better encapsulation of config directory management within TLS package
Co-authored-by: f0ssel <[email protected]>
* fix
---------
Co-authored-by: blink-so[bot] <211532188+blink-so[bot]@users.noreply.github.com>
Co-authored-by: f0ssel <[email protected]>
0 commit comments