greenpau / caddy-security

🔐 Authentication, Authorization, and Accounting (AAA) App and Plugin for Caddy v2. 💎 Implements Form-Based, Basic, Local, LDAP, OpenID Connect, OAuth 2.0 (Github, Google, Facebook, Okta, etc.), SAML Authentication. MFA/2FA with App Authenticators and Yubico. 💎 Authorization with JWT/PASETO tokens. 🔐
https://authcrunch.com/
Apache License 2.0
1.49k stars 73 forks source link

breakfix: Latest xcaddy and caddy can't build with the plugin #254

Closed brinycoolie closed 1 year ago

brinycoolie commented 1 year ago

Describe the issue Problem with new version of caddy, xcaddy and go

Latest version of caddy from the Ubuntu repos posted today; caddy version v2.7.2 h1:QqThyoyUFAv1B7A2NMeaWlz7xmgKqU49PXBX08A+6xg=

So, we need to get latest version of xcaddy to build-in the plugin; xcaddy version v0.3.4 h1:eQAZPEQqyLY7S9+rfdvx/Zs/a3VNwo+f5d2BR6UNvig=

maybe a good idea to update the version of Go from 1.18 to 1.20 since qtls error below explicitly requires version 1.20

Now we can build-in the plugin; brian@beetle-1:~$ sudo xcaddy build --with github.com/greenpau/caddy-security 2023/08/03 15:59:12 [INFO] Temporary folder: /tmp/buildenv_2023-08-03-1559.1198328339 2023/08/03 15:59:12 [INFO] Writing main module: /tmp/buildenv_2023-08-03-1559.1198328339/main.go package main

import ( caddycmd "github.com/caddyserver/caddy/v2/cmd"

// plug in Caddy modules here
_ "github.com/caddyserver/caddy/v2/modules/standard"
_ "github.com/greenpau/caddy-security"

)

func main() { caddycmd.Main() } 2023/08/03 15:59:12 [INFO] Initializing Go module 2023/08/03 15:59:12 [INFO] exec (timeout=-2562047h47m16.854775808s): /usr/bin/go mod init caddy go: creating new go.mod: module caddy go: to add module requirements and sums: go mod tidy 2023/08/03 15:59:12 [INFO] Pinning versions 2023/08/03 15:59:12 [INFO] exec (timeout=-2562047h47m16.854775808s): /usr/bin/go get -d -v github.com/caddyserver/caddy/v2 go: added github.com/beorn7/perks v1.0.1 go: added github.com/caddyserver/caddy/v2 v2.7.2 ... ... normal output omitted for brevity ... go: added github.com/russellhaering/goxmldsig v1.3.0 go: upgraded github.com/shopspring/decimal v1.2.0 => v1.3.1 go: added github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e go: upgraded github.com/spf13/cast v1.4.1 => v1.5.0 go: upgraded github.com/stoewer/go-strcase v1.2.0 => v1.2.1 go: upgraded golang.org/x/exp v0.0.0-20230310171629-522b1b587ee0 => v0.0.0-20230321023759-10a507213a29 2023/08/03 15:59:15 [INFO] exec (timeout=-2562047h47m16.854775808s): /usr/bin/go get -d -v
2023/08/03 15:59:17 [INFO] Build environment ready 2023/08/03 15:59:17 [INFO] Building Caddy 2023/08/03 15:59:17 [INFO] exec (timeout=-2562047h47m16.854775808s): /usr/bin/go mod tidy -e 2023/08/03 15:59:17 [INFO] exec (timeout=-2562047h47m16.854775808s): /usr/bin/go build -o /home/brian/caddy -ldflags -w -s -trimpath

github.com/quic-go/quic-go/internal/qtls

**/root/go/pkg/mod/github.com/quic-go/quic-go@v0.37.1/internal/qtls/go_oldversion.go:5:13: cannot use "The version of quic-go you're using can't be built using outdated Go versions. For more details, please see https://github.com/quic-go/quic-go/wiki/quic-go-and-Go-versions." (untyped string constant "The version of quic-go you're using can't be built using outdated Go...) as int value in variable declaration note: module requires Go 1.20

go.uber.org/multierr

/root/go/pkg/mod/go.uber.org/multierr@v1.11.0/error.go:209:20: undefined: atomic.Bool note: module requires Go 1.19

github.com/golang/glog

/root/go/pkg/mod/github.com/golang/glog@v1.1.1/glog_file_other.go:27:6: abortProcess redeclared in this block /root/go/pkg/mod/github.com/golang/glog@v1.1.1/glog_file_linux.go:33:6: other declaration of abortProcess note: module requires Go 1.19

go.opentelemetry.io/otel/sdk/trace

/root/go/pkg/mod/go.opentelemetry.io/otel/sdk@v1.16.0/trace/provider.go:78:24: undefined: atomic.Pointer /root/go/pkg/mod/go.opentelemetry.io/otel/sdk@v1.16.0/trace/provider.go:80:20: undefined: atomic.Bool note: module requires Go 1.19 2023/08/03 15:59:18 [INFO] Cleaning up temporary folder: /tmp/buildenv_2023-08-03-1559.1198328339 2023/08/03 15:59:18 [FATAL] exit status 2 brian@beetle-1:~$**

Expected behavior caddy executable with plugin incorporated as per usual

Additional context

might need to update the plugin

brinycoolie commented 1 year ago

Update: Aug 10th: Yesterday new updates caddy (2.7.3 was dropped) along with xcaddy (0.3.5) . Now the current pluging builds with these. All is right again.