Skip to content

Commit 9d8a9af

Browse files
classabbyampthe-maldridge
authored andcommitted
main: fix pubkey authentication support
Closes: #1 [via git-merge-pr]
1 parent 098a428 commit 9d8a9af

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

go.mod

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.17
44

55
require (
66
github.com/hashicorp/go-hclog v1.1.0
7-
github.com/netauth/netauth v0.6.0
7+
github.com/netauth/netauth v0.6.2-0.20221001032653-5eb74f06755e
88
github.com/spf13/pflag v1.0.5
99
github.com/spf13/viper v1.10.1
1010
google.golang.org/grpc v1.43.0
@@ -25,6 +25,7 @@ require (
2525
github.com/spf13/cast v1.4.1 // indirect
2626
github.com/spf13/jwalterweatherman v1.1.0 // indirect
2727
github.com/subosito/gotenv v1.2.0 // indirect
28+
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect
2829
golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d // indirect
2930
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect
3031
golang.org/x/text v0.3.7 // indirect

go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ github.com/mitchellh/mapstructure v1.4.3 h1:OVowDSCllw/YjdLkam3/sm7wEtOy59d8ndGg
7777
github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
7878
github.com/netauth/netauth v0.6.0 h1:1+IVOANpIfQoD680+WF1mIRMtgwtfUFNvrrf49xQKdk=
7979
github.com/netauth/netauth v0.6.0/go.mod h1:4PEbISVqRCQaXaDAt289w3nK9UhoF8/ZOLy31Hbv7ds=
80+
github.com/netauth/netauth v0.6.2-0.20221001032653-5eb74f06755e h1:4jzHpfk2I4s59jKujFS9vxDhMWGK2VjpyHq48D1QR0c=
81+
github.com/netauth/netauth v0.6.2-0.20221001032653-5eb74f06755e/go.mod h1:4PEbISVqRCQaXaDAt289w3nK9UhoF8/ZOLy31Hbv7ds=
8082
github.com/netauth/protocol v0.0.0-20210918062754-7fee492ffcbd h1:4yVpQ/+li28lQ/daYCWeDB08obRmjaoAw2qfFFaCQ40=
8183
github.com/netauth/protocol v0.0.0-20210918062754-7fee492ffcbd/go.mod h1:wpK5wqysOJU1w2OxgG65du8M7UqBkxzsNaJdjwiRqAs=
8284
github.com/pelletier/go-toml v1.9.4 h1:tjENF6MfZAg8e4ZmZTeWaWiT2vXtsoO6+iuOjFhECwM=
@@ -110,6 +112,8 @@ go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqe
110112
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
111113
golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
112114
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
115+
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 h1:HWj/xjIHfjYU5nVXpTM0s39J9CbLn7Cc5a7IC5rwsMQ=
116+
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
113117
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
114118
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
115119
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=

main.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"google.golang.org/grpc/status"
1515

1616
"github.com/netauth/netauth/pkg/netauth"
17+
"github.com/netauth/netauth/pkg/netauth/subtle"
1718
)
1819

1920
var (
@@ -86,14 +87,8 @@ func doAuth(c *netauth.Client) {
8687
dumpUser(minimalSFTPGoUser{})
8788
return
8889
}
89-
found := false
90-
for _, k := range keys["SSH"] {
91-
if k == publickey {
92-
found = true
93-
break
94-
}
95-
}
96-
if !found {
90+
err = subtle.CompareSSHKeys(keys["SSH"], publickey)
91+
if err != nil {
9792
dumpUser(minimalSFTPGoUser{})
9893
return
9994
}

0 commit comments

Comments
 (0)