CE Docker image: Set credentials using environment variables

Hello everybody,

I am currently using the CE Docker Image 2020.2 in my Docker file.

FROM hivemq/hivemq-ce:2020.2

Is there a way to create credentials using environment variables?
If not, what is the easiest way to force clients to authenticate when they connect?

Thanks in advance!

Best regards

Hi @Illaz,

welcome to the HiveMQ Community Forum.

As authentication/authorization is usually highly environment specific HiveMQ does not come with any mechanism for this out of the box. For auth purposes extensions to the HiveMQ system are necessary.

You can either implement your own, with the HiveMQ extension SDK: https://www.hivemq.com/docs/hivemq/4.3/extensions/introduction.html

Or use one of the pre-made open source extensions provided by the HiveMQ team:

For your use case, the best solution is probably the HiveMQ File RBAC extension.
Marketplace: https://www.hivemq.com/extension/file-rbac-extension/
Github: https://github.com/hivemq/hivemq-file-rbac-extension

As you already have a custom Docker file, you just need to drop it in during your docker build. I would suggest mapping the credentials file to a volume.

All the best

Edit: I would suggest removing the HiveMQ Allow All Extension from your container as well. While this is not mandatory for the RBAC extension to work, it is a good precaution and and a cleaner setup this way.


Hi Georg,

the HiveMQ File RBAC extension works like a charm. Thank you very much!
I also removed the HiveMQ Allow All Extension.

Best regards

1 Like