Runtime Panic starting kwmserverd when --iss not specified



  • I am attempting to set up the mattermost plugin and am at the point of installing kwmserverd

    Reproduction

    Following the docker setup instructions from the readme I have run:

    sudo openssl rand -out /etc/kopano/kwm-admin-tokens.key 32
    
    docker pull kopano/kwmserverd
    
    docker run --rm=true --name=kwmserverd --read-only --volume /etc/kopano/kwm-admin-tokens.key:/run/secrets/kwmserverd_admin_tokens_key:ro --publish 127.0.0.1:8778:8778  kopano/kwmserverd
    

    Error

    I see the following stack trace:

    time="2019-11-09T06:36:24Z" level=info msg="serve start"
    panic: runtime error: invalid memory address or nil pointer dereference
    [signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x90efdb]
    
    goroutine 1 [running]:
    net/url.(*URL).Hostname(...)
            net/url/url.go:1059
    main.serve(0xc0000d5680, 0xf409b8, 0x0, 0x0, 0x4, 0xa4812e)
            stash.kopano.io/kwm/kwmserver/cmd/kwmserverd/serve.go:385 +0x12ab
    main.commandServe.func1(0xc0000d5680, 0xf409b8, 0x0, 0x0)
            stash.kopano.io/kwm/kwmserver/cmd/kwmserverd/serve.go:55 +0x53
    stash.kopano.io/kwm/kwmserver/vendor/github.com/spf13/cobra.(*Command).execute(0xc0000d5680, 0xf409b8, 0x0, 0x0, 0xc0000d5680, 0xf409b8)
            stash.kopano.io/kwm/kwmserver/vendor/github.com/spf13/cobra/command.go:830 +0x2aa
    stash.kopano.io/kwm/kwmserver/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xf1a780, 0xc00004bf38, 0x1, 0x1)
            stash.kopano.io/kwm/kwmserver/vendor/github.com/spf13/cobra/command.go:914 +0x2fb
    stash.kopano.io/kwm/kwmserver/vendor/github.com/spf13/cobra.(*Command).Execute(...)
            stash.kopano.io/kwm/kwmserver/vendor/github.com/spf13/cobra/command.go:864
    main.main()
            stash.kopano.io/kwm/kwmserver/cmd/kwmserverd/main.go:31 +0xb7
    

    (in actuality I am running kwmserverd through Portainer with some other configuration options but this is a minimum reproduction and follows the exact readme steps)

    Environment

    uname -a
    Linux xxxxxxx 4.15.0-54-generic #58-Ubuntu SMP Mon Jun 24 10:55:24 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
    
    docker --version
    Docker version 18.09.7, build 2d0083d
    
    docker inspect --format='{{index .RepoDigests 0}}' kopano/kwmserverd
    kopano/kwmserverd@sha256:30bb66c4645c74f0cd7788238ce9cf1478ae2fcde26a1ead7f509ab31785b7ac # 1.0.0
    

    Investigation

    Checking server.go:285 I see that config.Iss is being accessed, and that its assignment is conditional on the flag --iss being specified.

    Other references to config.Iss include scripts/kopano-kwmserverd.binscript which initializes the --iss flag to https://localhost

    Resolution

    docker run --rm=true --name=kwmserverd --read-only --volume /etc/kopano/kwm-admin-tokens.key:/run/secrets/kwmserverd_admin_tokens_key:ro --publish 127.0.0.1:8778:8778  kopano/kwmserverd \
           serve --iss=https://localhost
    

    Hope this helps someone else!


  • Kopano


Log in to reply