Update pam to v2.0.0

This commit is contained in:
Conrad Hoffmann 2024-04-19 17:37:55 +02:00
parent adb2a8bdfb
commit 832c91beba
3 changed files with 10 additions and 4 deletions

View File

@ -6,7 +6,7 @@ import (
"fmt"
"net/http"
"github.com/msteinert/pam"
"github.com/msteinert/pam/v2"
"github.com/rs/zerolog/log"
)
@ -48,6 +48,12 @@ func pamAuth(next http.Handler, w http.ResponseWriter, r *http.Request) {
http.Error(w, "Temporary authentication error, try again later", http.StatusServiceUnavailable)
return
}
defer func() {
err := t.End()
if err != nil {
log.Warn().Err(err).Msg("failed to end PAM transaction")
}
}()
if err := t.Authenticate(0); err != nil {
log.Debug().Str("user", user).Err(err).Msg("auth error")

2
go.mod
View File

@ -9,7 +9,7 @@ require (
github.com/emersion/go-vcard v0.0.0-20230815062825-8fda7d206ec9
github.com/emersion/go-webdav v0.5.1-0.20240419143909-21f251fa1de2
github.com/go-chi/chi/v5 v5.0.10
github.com/msteinert/pam v1.2.0
github.com/msteinert/pam/v2 v2.0.0
github.com/rs/zerolog v1.31.0
golang.org/x/crypto v0.18.0
)

4
go.sum
View File

@ -22,8 +22,8 @@ github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/msteinert/pam v1.2.0 h1:mYfjlvN2KYs2Pb9G6nb/1f/nPfAttT/Jee5Sq9r3bGE=
github.com/msteinert/pam v1.2.0/go.mod h1:d2n0DCUK8rGecChV3JzvmsDjOY4R7AYbsNxAT+ftQl0=
github.com/msteinert/pam/v2 v2.0.0 h1:jnObb8MT6jvMbmrUQO5J/puTUjxy7Av+55zVJRJsCyE=
github.com/msteinert/pam/v2 v2.0.0/go.mod h1:KT28NNIcDFf3PcBmNI2mIGO4zZJ+9RSs/At2PB3IDVc=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/rs/zerolog v1.31.0 h1:FcTR3NnLWW+NnTwwhFWiJSZr4ECLpqCm6QsEnyvbV4A=