labstack / armor

Uncomplicated, modern HTTP server
https://armor.labstack.com
MIT License
1.66k stars 64 forks source link

Error while registering letsencrypt #13

Closed didasy closed 8 years ago

didasy commented 8 years ago

Got these errors while opening my site for the first time:

016/10/31 20:50:54 [INFO] acme: Registering account for
2016/10/31 20:50:58 [INFO][snro.worksinmagic.com] acme: Obtaining bundled SAN certificate
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0xc8 pc=0x6b8f43]

goroutine 37 [running]:
panic(0x75b740, 0xc42000e0e0)
        /home/dida/go/src/runtime/panic.go:500 +0x1a1
github.com/labstack/armor/vendor/github.com/rsc/letsencrypt/vendor/github.com/xenolf/lego/acme.(*Client).getChallenges.func1(0xc4204b0bd0, 0xc4204b5560, 0xc4204b5500, 0xc4200d1960, 0x15)
        /home/dida/lib/src/github.com/labstack/armor/vendor/github.com/rsc/letsencrypt/vendor/github.com/xenolf/lego/acme/client.go:406 +0x193
created by github.com/labstack/armor/vendor/github.com/rsc/letsencrypt/vendor/github.com/xenolf/lego/acme.(*Client).getChallenges
        /home/dida/lib/src/github.com/labstack/armor/vendor/github.com/rsc/letsencrypt/vendor/github.com/xenolf/lego/acme/client.go:419 +0x113
vishr commented 8 years ago

Can you try it with the new release?

didasy commented 8 years ago

Well, it worked now. But gzip plugin throw me these error:

2016/11/01 05:42:11 http2: panic serving 120.188.3.36:8927: interface conversion: middleware.gzipResponseWriter is not http.CloseNotifier: missing method CloseNotify
goroutine 22 [running]:
net/http.(*http2serverConn).runHandler.func1(0xc4200222d8, 0xc420045f6f, 0xc42007cfc0)
    /home/dida/go/src/net/http/h2_bundle.go:4304 +0xd1
panic(0x75bc20, 0xc420450200)
    /home/dida/go/src/runtime/panic.go:458 +0x243
github.com/labstack/armor/vendor/github.com/labstack/echo.(*Response).CloseNotify(0xc42043c6c0, 0x94c100)
    /home/dida/lib/src/github.com/labstack/armor/vendor/github.com/labstack/echo/response.go:91 +0x5f
github.com/labstack/armor/vendor/github.com/labstack/echo.(*Response).CloseNotify(0xc42043c750, 0x7f2a00)
    /home/dida/lib/src/github.com/labstack/armor/vendor/github.com/labstack/echo/response.go:91 +0x73
net/http/httputil.(*ReverseProxy).ServeHTTP(0xc4204501c0, 0x94c100, 0xc42043c750, 0xc420367d10)
    /home/dida/go/src/net/http/httputil/reverseproxy.go:158 +0xac4
github.com/labstack/armor/plugin.(*Proxy).Process.func1(0x952180, 0xc420434b00, 0x3, 0x7bf35d)
    /home/dida/lib/src/github.com/labstack/armor/plugin/proxy.go:96 +0x11d
github.com/labstack/armor/vendor/github.com/labstack/echo.(*Echo).ServeHTTP.func1(0x952180, 0xc420434b00, 0xc420434b00, 0x20)
    /home/dida/lib/src/github.com/labstack/armor/vendor/github.com/labstack/echo/echo.go:504 +0x106
github.com/labstack/armor/vendor/github.com/labstack/echo.(*Echo).ServeHTTP(0xc4200e8180, 0x94c100, 0xc42043c6c0, 0xc420367d10)
    /home/dida/lib/src/github.com/labstack/armor/vendor/github.com/labstack/echo/echo.go:513 +0x1af
github.com/labstack/armor/http.Start.func2(0x952180, 0xc420434a80, 0x794e20, 0xc42043ae40)
    /home/dida/lib/src/github.com/labstack/armor/http/http.go:96 +0xde
github.com/labstack/armor/vendor/github.com/labstack/echo.(*Echo).add.func1(0x952180, 0xc420434a80, 0xc42043ae40, 0x94c600)
    /home/dida/lib/src/github.com/labstack/armor/vendor/github.com/labstack/echo/echo.go:422 +0x96
github.com/labstack/armor/vendor/github.com/labstack/echo/middleware.GzipWithConfig.func1.1(0x952180, 0xc420434a80, 0x0, 0x0)
    /home/dida/lib/src/github.com/labstack/armor/vendor/github.com/labstack/echo/middleware/compress.go:92 +0x3cc
github.com/labstack/armor/vendor/github.com/labstack/echo.(*Echo).ServeHTTP.func1(0x952180, 0xc420434a80, 0xc42002ec00, 0xc420436580)
    /home/dida/lib/src/github.com/labstack/armor/vendor/github.com/labstack/echo/echo.go:504 +0x106
github.com/labstack/armor/vendor/github.com/labstack/echo/middleware.HTTPSRedirectWithConfig.func1.1(0x952180, 0xc420434a80, 0x6, 0x7c1f92)
    /home/dida/lib/src/github.com/labstack/armor/vendor/github.com/labstack/echo/middleware/redirect.go:64 +0x155
github.com/labstack/armor/http.Start.func1.1(0x952180, 0xc420434a80, 0xc420434a80, 0x9)
    /home/dida/lib/src/github.com/labstack/armor/http/http.go:31 +0xa4
github.com/labstack/armor/vendor/github.com/labstack/echo.(*Echo).ServeHTTP(0xc4200e8000, 0x94c3c0, 0xc4200222d8, 0xc420367d10)
    /home/dida/lib/src/github.com/labstack/armor/vendor/github.com/labstack/echo/echo.go:513 +0x1af
net/http.serverHandler.ServeHTTP(0xc420074580, 0x94c3c0, 0xc4200222d8, 0xc420367d10)
    /home/dida/go/src/net/http/server.go:2202 +0x7d
net/http.initNPNRequest.ServeHTTP(0xc4200fe700, 0xc420074580, 0x94c3c0, 0xc4200222d8, 0xc420367d10)
    /home/dida/go/src/net/http/server.go:2670 +0x93
net/http.(*initNPNRequest).ServeHTTP(0xc420436440, 0x94c3c0, 0xc4200222d8, 0xc420367d10)
    <autogenerated>:288 +0x79
net/http.(Handler).ServeHTTP-fm(0x94c3c0, 0xc4200222d8, 0xc420367d10)
    /home/dida/go/src/net/http/h2_bundle.go:4084 +0x4d
net/http.(*http2serverConn).runHandler(0xc42007cfc0, 0xc4200222d8, 0xc420367d10, 0xc42043ade0)
    /home/dida/go/src/net/http/h2_bundle.go:4314 +0x89
created by net/http.(*http2serverConn).processHeaders
    /home/dida/go/src/net/http/h2_bundle.go:4092 +0x6e2

And this is part of my config:

{
  "tls": {
    "auto": true,
    "cache_file": "/home/dida/letsencrypt-cache/snro.cache"
  },
  "plugins": [
    { "name": "https-redirect" },
    { "name": "gzip", "level": 6 }
  ],
vishr commented 8 years ago

Does it work without gzip plugin?

didasy commented 8 years ago

Yes, it works without the gzip plugin.

vishr commented 8 years ago

I am not able to reproduce it with the latest binary. How are you running it? Any steps to reproduce?

didasy commented 8 years ago

I run it with sudo /path/to/armor -c /path/to/config.json and that's it.

I am using armor v0.2.0 and has go 1.7.3 when go get-ing.

vishr commented 8 years ago

Have you built the binary yourself?

didasy commented 8 years ago

No, I was using go get -u github.com/labstack/armor/cmd/armor

Should I just get it from release?

vishr commented 8 years ago

go get should work too. For debugging, can you download latest binary and try?

didasy commented 8 years ago

Nope, got the same error. Very strange indeed.

vishr commented 8 years ago

Please do go get -u and verify the fix.

didasy commented 8 years ago

It works now, thank you very much!