nwesterhausen / domain-monitor

Self-hosted server to monitor WHOIS records for specified domains.
MIT License
84 stars 11 forks source link

Japan ccTLD Unsupported #88

Open xM8WVqaG opened 3 months ago

xM8WVqaG commented 3 months ago

Describe the bug If you attempt to monitor a .jp ccTLD it raises an exception and fails to track.

To Reproduce Steps to reproduce the behavior:

  1. Add jprs.co.jp (the .jp ccTLD homepage) and nhk.jp to Monitored Domains
  2. See errors below

Error message when adding the either domain:

dm_1  | 2024/07/21 12:42:37 🙅 WHOIS entry cache miss for jprs.co.jp
dm_1  | 2024/07/21 12:42:39 Error parsing whois for jprs.co.jp: whoisparser: domain whois data is invalid
dm_1  | 2024/07/21 12:42:39 💾 Flushed WHOIS data cache to whois-cache.yaml
dm_1  | echo: http: panic serving 172.18.0.1:52196: runtime error: invalid memory address or nil pointer dereference
dm_1  | goroutine 14 [running]:
dm_1  | net/http.(*conn).serve.func1()
dm_1  |     /usr/local/go/src/net/http/server.go:1898 +0xbe
dm_1  | panic({0x75e600?, 0xa77b50?})
dm_1  |     /usr/local/go/src/runtime/panic.go:770 +0x132
dm_1  | github.com/nwesterhausen/domain-monitor/handlers.(*WhoisHandler).GetCard.WhoisDetail.func2({0x857710?, 0xc000074870?}, {0x855460, 0xc000315ce0?})
dm_1  |     /src/views/domains/domain-dashboard_templ.go:217 +0x17f
dm_1  | github.com/a-h/templ.ComponentFunc.Render(0xa79070?, {0x857710?, 0xc000074870?}, {0x855460?, 0xc000315ce0?})
dm_1  |     /go/pkg/mod/github.com/a-h/templ@v0.2.648/runtime.go:41 +0x37
dm_1  | github.com/nwesterhausen/domain-monitor/handlers.View({0x85cd78, 0xc00017a0a0}, {0x854c60, 0xc000096400})
dm_1  |     /src/handlers/routes.go:87 +0x170
dm_1  | github.com/nwesterhausen/domain-monitor/handlers.(*WhoisHandler).GetCard(0xc00004a0b0, {0x85cd78, 0xc00017a0a0})
dm_1  |     /src/handlers/whois.handler.go:38 +0x212
dm_1  | github.com/labstack/echo/v4.(*Echo).add.func1({0x85cd78, 0xc00017a0a0})
dm_1  |     /go/pkg/mod/github.com/labstack/echo/v4@v4.11.4/echo.go:582 +0x4b
dm_1  | github.com/labstack/echo/v4/middleware.LoggerWithConfig.func2.1({0x85cd78, 0xc00017a0a0})
dm_1  |     /go/pkg/mod/github.com/labstack/echo/v4@v4.11.4/middleware/logger.go:126 +0xd8
dm_1  | github.com/labstack/echo/v4.(*Echo).ServeHTTP(0xc00013c248, {0x857048, 0xc000315ce0}, 0xc000206c60)
dm_1  |     /go/pkg/mod/github.com/labstack/echo/v4@v4.11.4/echo.go:669 +0x327
dm_1  | net/http.serverHandler.ServeHTTP({0x8561d0?}, {0x857048?, 0xc000315ce0?}, 0x6?)
dm_1  |     /usr/local/go/src/net/http/server.go:3137 +0x8e
dm_1  | net/http.(*conn).serve(0xc0001346c0, {0x8576d8, 0xc000179410})
dm_1  |     /usr/local/go/src/net/http/server.go:2039 +0x5e8
dm_1  | created by net/http.(*Server).Serve in goroutine 1
dm_1  |     /usr/local/go/src/net/http/server.go:3285 +0x4b4
dm_1  | echo: http: panic serving 172.18.0.1:52182: runtime error: invalid memory address or nil pointer dereference
dm_1  | goroutine 8 [running]:
dm_1  | net/http.(*conn).serve.func1()
dm_1  |     /usr/local/go/src/net/http/server.go:1898 +0xbe
dm_1  | panic({0x75e600?, 0xa77b50?})
dm_1  |     /usr/local/go/src/runtime/panic.go:770 +0x132
dm_1  | github.com/nwesterhausen/domain-monitor/handlers.(*WhoisHandler).GetCard.WhoisDetail.func2({0x857710?, 0xc0001480f0?}, {0x855460, 0xc00007fce0?})
dm_1  |     /src/views/domains/domain-dashboard_templ.go:217 +0x17f
dm_1  | github.com/a-h/templ.ComponentFunc.Render(0xa79070?, {0x857710?, 0xc0001480f0?}, {0x855460?, 0xc00007fce0?})
dm_1  |     /go/pkg/mod/github.com/a-h/templ@v0.2.648/runtime.go:41 +0x37
dm_1  | github.com/nwesterhausen/domain-monitor/handlers.View({0x85cd78, 0xc0001020a0}, {0x854c60, 0xc000097780})
dm_1  |     /src/handlers/routes.go:87 +0x170
dm_1  | github.com/nwesterhausen/domain-monitor/handlers.(*WhoisHandler).GetCard(0xc00004a0b0, {0x85cd78, 0xc0001020a0})
dm_1  |     /src/handlers/whois.handler.go:38 +0x212
dm_1  | github.com/labstack/echo/v4.(*Echo).add.func1({0x85cd78, 0xc0001020a0})
dm_1  |     /go/pkg/mod/github.com/labstack/echo/v4@v4.11.4/echo.go:582 +0x4b
dm_1  | github.com/labstack/echo/v4/middleware.LoggerWithConfig.func2.1({0x85cd78, 0xc0001020a0})
dm_1  |     /go/pkg/mod/github.com/labstack/echo/v4@v4.11.4/middleware/logger.go:126 +0xd8
dm_1  | github.com/labstack/echo/v4.(*Echo).ServeHTTP(0xc00013c248, {0x857048, 0xc00007fce0}, 0xc00013a120)
dm_1  |     /go/pkg/mod/github.com/labstack/echo/v4@v4.11.4/echo.go:669 +0x327
dm_1  | net/http.serverHandler.ServeHTTP({0x8561d0?}, {0x857048?, 0xc00007fce0?}, 0x6?)
dm_1  |     /usr/local/go/src/net/http/server.go:3137 +0x8e
dm_1  | net/http.(*conn).serve(0xc0001342d0, {0x8576d8, 0xc000179410})
dm_1  |     /usr/local/go/src/net/http/server.go:2039 +0x5e8
dm_1  | created by net/http.(*Server).Serve in goroutine 1
dm_1  |     /usr/local/go/src/net/http/server.go:3285 +0x4b4
dm_1  | echo: http: panic serving 172.18.0.1:58938: runtime error: invalid memory address or nil pointer dereference
dm_1  | goroutine 83 [running]:
dm_1  | net/http.(*conn).serve.func1()
dm_1  |     /usr/local/go/src/net/http/server.go:1898 +0xbe
dm_1  | panic({0x75e600?, 0xa77b50?})
dm_1  |     /usr/local/go/src/runtime/panic.go:770 +0x132
dm_1  | github.com/nwesterhausen/domain-monitor/handlers.(*WhoisHandler).GetCard.WhoisDetail.func2({0x857710?, 0xc0001481e0?}, {0x855460, 0xc00007fdc0?})
dm_1  |     /src/views/domains/domain-dashboard_templ.go:217 +0x17f
dm_1  | github.com/a-h/templ.ComponentFunc.Render(0xa79070?, {0x857710?, 0xc0001481e0?}, {0x855460?, 0xc00007fdc0?})
dm_1  |     /go/pkg/mod/github.com/a-h/templ@v0.2.648/runtime.go:41 +0x37
dm_1  | github.com/nwesterhausen/domain-monitor/handlers.View({0x85cd78, 0xc000102140}, {0x854c60, 0xc000097a00})
dm_1  |     /src/handlers/routes.go:87 +0x170
dm_1  | github.com/nwesterhausen/domain-monitor/handlers.(*WhoisHandler).GetCard(0xc00004a0b0, {0x85cd78, 0xc000102140})
dm_1  |     /src/handlers/whois.handler.go:38 +0x212
dm_1  | github.com/labstack/echo/v4.(*Echo).add.func1({0x85cd78, 0xc000102140})
dm_1  |     /go/pkg/mod/github.com/labstack/echo/v4@v4.11.4/echo.go:582 +0x4b
dm_1  | github.com/labstack/echo/v4/middleware.LoggerWithConfig.func2.1({0x85cd78, 0xc000102140})
dm_1  |     /go/pkg/mod/github.com/labstack/echo/v4@v4.11.4/middleware/logger.go:126 +0xd8
dm_1  | github.com/labstack/echo/v4.(*Echo).ServeHTTP(0xc00013c248, {0x857048, 0xc00007fdc0}, 0xc00013a240)
dm_1  |     /go/pkg/mod/github.com/labstack/echo/v4@v4.11.4/echo.go:669 +0x327
dm_1  | net/http.serverHandler.ServeHTTP({0x8561d0?}, {0x857048?, 0xc00007fdc0?}, 0x6?)
dm_1  |     /usr/local/go/src/net/http/server.go:3137 +0x8e
dm_1  | net/http.(*conn).serve(0xc000134510, {0x8576d8, 0xc000179410})
dm_1  |     /usr/local/go/src/net/http/server.go:2039 +0x5e8
dm_1  | created by net/http.(*Server).Serve in goroutine 1
dm_1  |     /usr/local/go/src/net/http/server.go:3285 +0x4b4

Data in whois-cache.yaml:

    - fqdn: jprs.co.jp
      whoisInfo:
        domain: null
        registrar: null
        registrant: null
        administrative: null
        technical: null
        billing: null
      lastUpdated: 0001-01-01T00:00:00Z
      sent2MonthAlert: false
      sent1MonthAlert: false
      sent2WeekAlert: false
      sent1WeekAlert: false
      sent3DayAlert: false
      lastAlertSent: 0001-01-01T00:00:00Z
    - fqdn: nhk.jp
      whoisInfo:
        domain:
            id: ""
            domain: nhk.jp
            punycode: nhk.jp
            name: nhk
            extension: jp
            whoisserver: ""
            status: []
            nameservers:
                - ns012-h56n53352g8r0rhn.h.d-53.info
                - ns012-h56n53352g8r0rhn.h.d-53.jp
                - ns012-h56n53352g8r0rhn.h.d-53.net
            dnssec: false
            createddate: ""
            createddateintime: null
            updateddate: ""
            updateddateintime: null
            expirationdate: ""
            expirationdateintime: null
        registrar: null
        registrant:
            id: ""
            name: Japan Broadcasting Corporation
            organization: ""
            street: ""
            city: ""
            province: ""
            postalcode: ""
            country: ""
            phone: ""
            phoneext: ""
            fax: ""
            faxext: ""
            email: ""
            referralurl: ""
        administrative:
            id: ""
            name: Japan Broadcasting Corporation
            organization: ""
            street: Tokyo, Shibuya-ku, 2-2-1 Jinnan
            city: ""
            province: ""
            postalcode: ""
            country: ""
            phone: ""
            phoneext: ""
            fax: ""
            faxext: ""
            email: m06304-tech@li.nhk.or.jp
            referralurl: ""
        technical: null
        billing: null
      lastUpdated: 2024-07-21T12:51:41.84623478Z
      sent2MonthAlert: false
      sent1MonthAlert: false
      sent2WeekAlert: false
      sent1WeekAlert: false
      sent3DayAlert: false
      lastAlertSent: 0001-01-01T00:00:00Z

Upstream WHOIS data:

$ whois jprs.co.jp
[ JPRS database provides information on network administration. Its use is    ]
[ restricted to network administration purposes. For further information,     ]
[ use 'whois -h whois.jprs.jp help'. To suppress Japanese output, add'/e'     ]
[ at the end of command, e.g. 'whois -h whois.jprs.jp xxx/e'.                 ]
Domain Information:
a. [Domain Name]                JPRS.CO.JP
g. [Organization]               Japan Registry Services Co.,Ltd.
l. [Organization Type]          Company
m. [Administrative Contact]     SO42861JP
n. [Technical Contact]          SA30573JP
n. [Technical Contact]          TM8767JP
n. [Technical Contact]          YA14981JP
p. [Name Server]                ns1.jprs.co.jp
p. [Name Server]                ns2.jprs.co.jp
p. [Name Server]                ns3.jprs.co.jp
p. [Name Server]                ns4.jprs.co.jp
s. [Signing Key]                17797 8 2 (
                                2820BED710B7D2574CEA8EDC08F2A4FF
                                55474BEFBCD540102E42768873EFCCA6 )
[State]                         Connected (2025/01/31)
[Registered Date]               2001/01/22
[Connected Date]                2001/01/24
[Last Update]                   2024/04/23 09:41:23 (JST)
$ whois nhk.jp    
[ JPRS database provides information on network administration. Its use is    ]
[ restricted to network administration purposes. For further information,     ]
[ use 'whois -h whois.jprs.jp help'. To suppress Japanese output, add'/e'     ]
[ at the end of command, e.g. 'whois -h whois.jprs.jp xxx/e'.                 ]
Domain Information:
[Domain Name]                   NHK.JP

[Registrant]                    Japan Broadcasting Corporation

[Name Server]                   ns012-h56n53352g8r0rhn.h.d-53.info
[Name Server]                   ns012-h56n53352g8r0rhn.h.d-53.jp
[Name Server]                   ns012-h56n53352g8r0rhn.h.d-53.net
[Signing Key]                   15959 13 2 (
                                999B5385245C3E979CD148561D797DC0
                                129399ECFB5AD181E8DBAD9EFC9ABB32 )

[Created on]                    2001/03/26
[Expires on]                    2025/03/31
[Status]                        Active
[Last Updated]                  2024/04/01 01:05:04 (JST)

Contact Information:
[Name]                          Japan Broadcasting Corporation
[Email]                         m06304-tech@li.nhk.or.jp
[Web Page]                      https://www.nhk.or.jp/
[Postal code]                   150-8001
[Postal Address]                Tokyo
                                Shibuya-ku
                                2-2-1 Jinnan
[Phone]                         03-5455-3257
[Fax]                           03-3465-1987

Expected behavior

Either it should monitor the domain or it should error fast and report that the Japanese ccTLD is supported.

Version

$ docker image list --digests ghcr.io/nwesterhausen/domain-monitor
REPOSITORY                             TAG       DIGEST                                                                    IMAGE ID       CREATED        SIZE
ghcr.io/nwesterhausen/domain-monitor   1         sha256:0f9de73ee4ff87d23bbaadfcf577fb03751ee98ae2d4d5e8e46652d2edc0d923   20297239a7b5   3 months ago   17.7MB