@@ -17,7 +17,6 @@ import (
17
17
// LinuxJail implements Jailer using Linux network namespaces
18
18
type LinuxJail struct {
19
19
logger * slog.Logger
20
- namespace string
21
20
vethHostName string // Host-side veth interface name for iptables rules
22
21
vethJailName string // Jail-side veth interface name for iptables rules
23
22
commandEnv []string
@@ -33,7 +32,6 @@ type LinuxJail struct {
33
32
func NewLinuxJail (config Config ) (* LinuxJail , error ) {
34
33
return & LinuxJail {
35
34
logger : config .Logger ,
36
- namespace : newNamespaceName (),
37
35
httpProxyPort : config .HttpProxyPort ,
38
36
configDir : config .ConfigDir ,
39
37
caCertPath : config .CACertPath ,
@@ -63,7 +61,7 @@ func (l *LinuxJail) ConfigureBeforeCommandExecution() error {
63
61
64
62
// Command returns an exec.Cmd configured to run within the network namespace.
65
63
func (l * LinuxJail ) Command (command []string ) * exec.Cmd {
66
- l .logger .Debug ("Creating command with namespace" , "namespace" , l . namespace )
64
+ l .logger .Debug ("Creating command with namespace" )
67
65
68
66
cmd := exec .Command (command [0 ], command [1 :]... )
69
67
cmd .Env = l .commandEnv
@@ -114,30 +112,6 @@ func (l *LinuxJail) Close() error {
114
112
// Continue with other cleanup even if this fails
115
113
}
116
114
117
- // Clean up namespace-specific DNS config directory
118
- netnsEtc := fmt .Sprintf ("/etc/netns/%s" , l .namespace )
119
- err = os .RemoveAll (netnsEtc )
120
- if err != nil {
121
- l .logger .Warn ("Failed to remove namespace DNS config" , "dir" , netnsEtc , "error" , err )
122
- // Continue with other cleanup
123
- }
124
-
125
- // Remove network namespace
126
- err = l .removeNamespace ()
127
- if err != nil {
128
- return fmt .Errorf ("failed to remove namespace: %v" , err )
129
- }
130
-
131
- return nil
132
- }
133
-
134
- // removeNamespace removes the network namespace
135
- func (l * LinuxJail ) removeNamespace () error {
136
- cmd := exec .Command ("ip" , "netns" , "del" , l .namespace )
137
- err := cmd .Run ()
138
- if err != nil {
139
- return fmt .Errorf ("failed to remove namespace: %v" , err )
140
- }
141
115
return nil
142
116
}
143
117
0 commit comments