internal: remove unix sockets on shutdown (#21081)

This commit is contained in:
Marc 'risson' Schmitt
2026-03-23 13:42:33 +00:00
committed by GitHub
parent 36ef00f548
commit bc0cbdf4b6
2 changed files with 3 additions and 0 deletions
+2
View File
@@ -52,6 +52,7 @@ func RunMetricsServer(listen string, router *mux.Router) {
func RunMetricsUnix(router *mux.Router) {
socketPath := path.Join(os.TempDir(), MetricsSocketName)
l := log.WithField("logger", "authentik.outpost.metrics").WithField("listen", socketPath)
_ = os.Remove(socketPath)
ln, err := unix.Listen(socketPath)
if err != nil {
l.WithError(err).Warning("failed to listen")
@@ -59,6 +60,7 @@ func RunMetricsUnix(router *mux.Router) {
}
defer func() {
err := ln.Close()
_ = os.Remove(socketPath)
if err != nil {
l.WithError(err).Warning("failed to close listener")
}
+1
View File
@@ -247,6 +247,7 @@ func (ws *WebServer) listenUnix(listen string) {
}
defer func() {
err := ln.Close()
_ = os.Remove(listen)
if err != nil {
ws.log.WithField("listen", listen).WithError(err).Warning("failed to close listener")
}