# Security on Topics

**URL:** <https://community.hivemq.com/t/security-on-topics/2355>\
**Category:** Uncategorized\
**Created:** [September 11, 2023, 6:37am UTC](https://community.hivemq.com/t/security-on-topics/2355 "2023-09-11T06:37:54Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ViswanathDR](https://avatars.discourse-cdn.com/v4/letter/v/3be4f8/32.png) [@ViswanathDR](https://community.hivemq.com/u/ViswanathDR)\
**Post date:** [September 11, 2023, 6:37am UTC](https://community.hivemq.com/t/security-on-topics/2355/1 "2023-09-11T06:37:54Z")

</div>

Hi Team,  
We are evaluting a Hive MQ product for an IoT application.  
Can you provide the feasiblity of the following requirement :

Assume the application receives millions messages from two clients.  
Each client is having around 10 kinds of topics. For e.g:

- ‘clients/client1/itdepart’
- ‘clients/client1/hrdepart’
- …
- …
- ‘clients/client2/itdepart’
- ‘clients/client2/hrdepart’
- …
- …

Is there any feasibly or security, to provide the restriction for subscribing at topic level(client and department).

Even though, the user has subscribed for a department or client, which is not authorised, the messages should be deliver.

---

<div class="post-metadata">

**Author:** ![SShet](https://avatars.discourse-cdn.com/v4/letter/s/b3f665/32.png) [@SShet](https://community.hivemq.com/u/SShet)\
**Post date:** [September 11, 2023, 7:46am UTC](https://community.hivemq.com/t/security-on-topics/2355/2 "2023-09-11T07:46:22Z")

</div>

Hello @ViswanathDR

Thank you for contacting us. With the [HiveMQ Enterprise Security Extension (ESE](https://docs.hivemq.com/ese/4.19/enterprise-security-extension/ese-intro)), you can effectively implement security on topics. This extension empowers to publish and subscribe to authorized topics, depending on the roles or permissions assigned to the client. For a comprehensive understanding of this extension, kindly refer to our [documentation](https://docs.hivemq.com/ese/4.19/enterprise-security-extension/ese#authn-authz).

> Even though, the user has subscribed for a department or client, which is not authorised, the messages should be deliver.

Could you please provide an example to clarify what you mean?

Kind regards,  
Sheetal from HiveMQ Team

---

<div class="post-metadata">

**Author:** ![ViswanathDR](https://avatars.discourse-cdn.com/v4/letter/v/3be4f8/32.png) [@ViswanathDR](https://community.hivemq.com/u/ViswanathDR)\
**Post date:** [September 12, 2023, 6:07am UTC](https://community.hivemq.com/t/security-on-topics/2355/3 "2023-09-12T06:07:33Z")

</div>

Hi Sheetal,  
Thanks for the response.

The above sentence is wrongly formatted.

The question/problem is as follows:

I am having topics as below :  
clients/client1/dept1  
clients/client1/dept2  
clients/client1/dept3  
clients/client1/dept4

Is there any way to subscribe only for the topics “clients/client1/dept1” and “clients/client1/dept2” with only one user set crendtials??

Regards,  
Viswanath

---

<div class="post-metadata">

**Author:** ![SShet](https://avatars.discourse-cdn.com/v4/letter/s/b3f665/32.png) [@SShet](https://community.hivemq.com/u/SShet)\
**Post date:** [September 12, 2023, 8:33am UTC](https://community.hivemq.com/t/security-on-topics/2355/4 "2023-09-12T08:33:36Z")

</div>

Hello @ViswanathDR,

We appreciate you providing the requested details. It is indeed possible to implement the functionality you described using both the File RBAC extension and the Enterprise Security extension. Below is an example using the RBAC extension:

```auto
<role>
    <id>role1</id>
    <permissions>
        <!-- PUBLISH and SUBSCRIBE to all topics listed below -->
        <topic>clients/${{clientid}}/dept1</topic>
        <topic>clients/${{clientid}}/dept2</topic>
    </permissions>
</role>

```

You can download the Opensource File RBAC extension [here](https://www.hivemq.com/extension/file-rbac-extension/). For more comprehensive information, please refer to the [documentation](https://github.com/hivemq/hivemq-file-rbac-extension/blob/master/README.adoc).

Using Enterprise security extension as well you have the option to set up permissions using the File realm and as well as SQL realm. In case you would like to use the **SQL realm** then you can access information about the database structure [here](https://docs.hivemq.com/ese/4.19/enterprise-security-extension/ese.html#sql-db-structure). For **File Realm** , please check [here](https://docs.hivemq.com/ese/4.19/enterprise-security-extension/ese.html#file-authz) for more details.

We hope this helps. Please don’t hesitate to contact us if you have any further questions.

Regards,  
Sheetal from HiveMQ team

---

<div class="post-metadata">

**Author:** ![ViswanathDR](https://avatars.discourse-cdn.com/v4/letter/v/3be4f8/32.png) [@ViswanathDR](https://community.hivemq.com/u/ViswanathDR)\
**Post date:** [September 12, 2023, 9:41am UTC](https://community.hivemq.com/t/security-on-topics/2355/5 "2023-09-12T09:41:29Z")

</div>

Hi Sheetal,  
Thanks for the response.

Currently, I am using cloud managed Serverless(Free) license to evaluate HIVEMQ. Is the File RBAC option is avaliable in this free license??. If yes, can you suggest me where I have to configure this.

Also I am using [https://console.hivemq.cloud/](https://console.hivemq.cloud/) to configure the topics, permissions and access credentails.

I am having thousands of users,permissions and topics. Is there any api or builk import to manage them, instead of entering each one of them through UI??

Regards,  
Viswanath

---

<div class="post-metadata">

**Author:** ![SShet](https://avatars.discourse-cdn.com/v4/letter/s/b3f665/32.png) [@SShet](https://community.hivemq.com/u/SShet)\
**Post date:** [September 12, 2023, 11:38am UTC](https://community.hivemq.com/t/security-on-topics/2355/6 "2023-09-12T11:38:38Z")

</div>

Hello @ViswanathDR

Thank you for confirming that you are using the HiveMQ Cloud Free edition. Please be aware that with HiveMQ Cloud Free and Starter editions, certain features are not supported, such as using placeholders for client IDs in topics and assigning multiple permissions to a client. Also In order to use extensions(RBAC/ESE), you will need to migrate to the Cloud Enterprise editions.

If you would like to explore the benefits of our Cloud Enterprise edition in more detail, we encourage you to reach out to our experts at [sales@hivemq.com](mailto:sales@hivemq.com). They will provide guidance to help you find the most suitable solution for your specific use case.

Regards,  
Sheetal from HiveMQ Team

---

<div class="post-metadata">

**Author:** ![ViswanathDR](https://avatars.discourse-cdn.com/v4/letter/v/3be4f8/32.png) [@ViswanathDR](https://community.hivemq.com/u/ViswanathDR)\
**Post date:** [September 12, 2023, 11:55am UTC](https://community.hivemq.com/t/security-on-topics/2355/7 "2023-09-12T11:55:40Z")

</div>

Thanks Sheetal for the details.
