Skip to content

Commit ff71df0

Browse files
vrothbergopenshift-cherrypick-robot
authored andcommitted
system service: unset listen fds on tcp
Disable leaking the LISTEN_* variables into containers which are observed to be passed by systemd even without being socket activated as described in https://access.redhat.com/solutions/6512011. [NO NEW TESTS NEEDED] - Ultimately, the solution 6512011 should be updated. Fixes: bugzilla.redhat.com/show_bug.cgi?id=2180483 Signed-off-by: Valentin Rothberg <[email protected]>
1 parent c27903d commit ff71df0

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

cmd/podman/system/service_abi.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,18 @@ func restService(flags *pflag.FlagSet, cfg *entities.PodmanConfig, opts entities
9696
libpodRuntime.SetRemoteURI(uri.String())
9797
}
9898

99+
// bugzilla.redhat.com/show_bug.cgi?id=2180483:
100+
//
101+
// Disable leaking the LISTEN_* into containers which
102+
// are observed to be passed by systemd even without
103+
// being socket activated as described in
104+
// https://access.redhat.com/solutions/6512011.
105+
for _, val := range []string{"LISTEN_FDS", "LISTEN_PID", "LISTEN_FDNAMES"} {
106+
if err := os.Unsetenv(val); err != nil {
107+
return fmt.Errorf("unsetting %s: %v", val, err)
108+
}
109+
}
110+
99111
// Set stdin to /dev/null, so shortnames will not prompt
100112
devNullfile, err := os.Open(os.DevNull)
101113
if err != nil {

0 commit comments

Comments
 (0)