Uploaded image for project: 'Mender'
  1. Mender
  2. MEN-2750

If trying to create a user in a multitenant setup, and --tenant-id is not given, useradm crashes instead of giving a proper message

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Done
    • Priority: (None)
    • Resolution: Fixed
    • Affects Version/s: 2.2.0
    • Fix Version/s: 2.3.0
    • Labels:
    • Days in progress:
      0

      Description

      To reproduce:

      1. Start a production server, with multi-tenancy enabled (default at the time of writing)
      2. Try to create a user with the command from the Open Source instructions:
        ./run exec mender-useradm /usr/bin/useradm create-user --username=myusername@host.com --password=mysecretpassword
          

      This results in this crash and stack trace:

      $ ./run exec mender-useradm /usr/bin/useradm create-user --username=myusername@host.com --password=mysecretpassword
      INFO[2019-09-09T09:06:21Z] setting up tenant verification                file=commands.go func=main.commandCreateUser line=85
      panic: runtime error: invalid memory address or nil pointer dereference
      [signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x878b6a]
      
      goroutine 1 [running]:
      github.com/mendersoftware/useradm-enterprise/user.(*UserAdm).doCreateUser(0xc0001bb500, 0xa4d2e0, 0xc000090020, 0xc000232690, 0xc0002e0001, 0x3c, 0x3c)
      	/go/src/github.com/mendersoftware/useradm-enterprise/user/useradm.go:339 +0x52a
      github.com/mendersoftware/useradm-enterprise/user.(*UserAdm).CreateUser(0xc0001bb500, 0xa4d2e0, 0xc000090020, 0xc000232690, 0x0, 0x0)
      	/go/src/github.com/mendersoftware/useradm-enterprise/user/useradm.go:309 +0x107
      main.commandCreateUser(0xa50340, 0xc00010a2d0, 0x7ffd565e3f15, 0x13, 0x7ffd565e3f34, 0x10, 0x0, 0x0, 0x0, 0x0, ...)
      	/go/src/github.com/mendersoftware/useradm-enterprise/commands.go:95 +0x5be
      main.runCreateUser(0xc000173540, 0x100, 0xc000173540)
      	/go/src/github.com/mendersoftware/useradm-enterprise/main.go:189 +0x181
      github.com/mendersoftware/useradm-enterprise/vendor/github.com/urfave/cli.HandleAction(0x8fff40, 0x9d54e8, 0xc000173540, 0xc000095300, 0x0)
      	/go/src/github.com/mendersoftware/useradm-enterprise/vendor/github.com/urfave/cli/app.go:485 +0xc8
      github.com/mendersoftware/useradm-enterprise/vendor/github.com/urfave/cli.Command.Run(0x9b3afb, 0xb, 0x0, 0x0, 0x0, 0x0, 0x0, 0x9b37a1, 0xb, 0x0, ...)
      	/go/src/github.com/mendersoftware/useradm-enterprise/vendor/github.com/urfave/cli/command.go:207 +0x9a0
      github.com/mendersoftware/useradm-enterprise/vendor/github.com/urfave/cli.(*App).Run(0xc0000af6c0, 0xc000096000, 0x4, 0x4, 0x0, 0x0)
      	/go/src/github.com/mendersoftware/useradm-enterprise/vendor/github.com/urfave/cli/app.go:250 +0x6ea
      main.doMain(0xc000096000, 0x4, 0x4)
      	/go/src/github.com/mendersoftware/useradm-enterprise/main.go:141 +0xad6
      main.main()
      	/go/src/github.com/mendersoftware/useradm-enterprise/main.go:29 +0x45
      

      Not passing --tenant-id is indeed invalid for a multitenancy setup, but we should produce a better message than this.

        Attachments

          Activity

            People

            • Assignee:
              alfrunes Alf-Rune Siqveland
              Reporter:
              a10040 Kristian Amlie
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Zendesk Support

                  Summary Panel