Skip to content

Commit ac4491c

Browse files
author
Avinash Dongre
committed
changes
1 parent ab32163 commit ac4491c

2 files changed

Lines changed: 57 additions & 74 deletions

File tree

modules/securing-amq-broker-on-openshift/pages/enabling-rbac-role-based-access-control.adoc

Lines changed: 47 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ metadata:
3232
spec:
3333
# ... other broker configurations ...
3434
brokerProperties:
35-
- 'securityRoles.group2.send=#' // <1>
36-
- 'securityRoles.group1.consume=#' // <2>
37-
- 'securityRoles.group1.createAddress=#'
38-
- 'securityRoles.group1.createNonDurableQueue=#'
39-
- 'securityRoles.group1.browse=#'
35+
- 'securityRoles.#.group1.send=true' // <1>
36+
- 'securityRoles.#.group2.consume=true' // <2>
37+
- 'securityRoles.#.group2.createAddress=true'
38+
- 'securityRoles.#.group2.createNonDurableQueue=true'
39+
- 'securityRoles.#.group2.browse=true'
4040
# ...
4141
----
42-
<1> The `group2` role is granted `send` permissions to all addresses (`#`).
43-
<2> The `group1` role is granted `consume`, `createAddress`, `createNonDurableQueue`, and `browse` permissions to all addresses (`#`).
42+
<1> The `group1` role is granted `send` permissions to all addresses (`#`).
43+
<2> The `group2` role is granted `consume`, `createAddress`, `createNonDurableQueue`, and `browse` permissions to all addresses (`#`).
4444

4545
[NOTE]
4646
In a Java properties file (which `brokerProperties` effectively translates into), a colon (`:`) is a reserved character used to separate a key and a value. If you need to grant permissions to a Fully Qualified Queue Name (FQQN) that contains a colon, ensure it is properly escaped or handled according to the broker's configuration parsing rules.
@@ -89,13 +89,13 @@ metadata:
8989
spec:
9090
# ... existing configurations ...
9191
brokerProperties:
92-
- 'securityRoles.order-producers.send=orders.queue' // <1>
93-
- 'securityRoles.order-consumers.consume=orders.queue' // <2>
94-
- 'securityRoles.system-admin.createAddress=#' // <3>
95-
- 'securityRoles.system-admin.createNonDurableQueue=#'
96-
- 'securityRoles.system-admin.send=#'
97-
- 'securityRoles.system-admin.consume=#'
98-
- 'securityRoles.system-admin.browse=#'
92+
- 'securityRoles."orders\.queue".order-producers.send=true' // <1>
93+
- 'securityRoles."orders\.queue".order-consumers.consume=true' // <2>
94+
- 'securityRoles.#.system-admin.createAddress=true' // <3>
95+
- 'securityRoles.#.system-admin.createNonDurableQueue=true'
96+
- 'securityRoles.#.system-admin.send=true'
97+
- 'securityRoles.#.system-admin.consume=true'
98+
- 'securityRoles.#.system-admin.browse=true'
9999
# ...
100100
----
101101
<1> The `order-producers` role is allowed to send messages only to `orders.queue`.
@@ -157,14 +157,19 @@ spec:
157157
deploymentPlan:
158158
size: 1 # Example size, adjust as needed
159159
image: placeholder # Ensure this matches your broker image version
160-
resourceTemplates:
161-
initContainers:
162-
- name: remove-default-rbac-config
163-
image: busybox:latest # Use a lightweight image like busybox for init containers
164-
command: ["sh", "-c", "rm -f /amq/init/config/amq-broker/etc/management.xml"]
165-
volumeMounts:
166-
- name: my-broker-instance-instance-volume # <1>
167-
mountPath: /amq/init/config/amq-broker/etc/
160+
resourceTemplates:
161+
- patch:
162+
kind: StatefulSet
163+
spec:
164+
template:
165+
spec:
166+
initContainers:
167+
- args:
168+
- '-c'
169+
- '/opt/amq/bin/launch.sh && /opt/amq-broker/script/default.sh; echo "Empty management.xml";echo "<management-context xmlns=\"http://activemq.apache.org/schema\" />" > /amq/init/config/amq-broker/etc/management.xml'
170+
name: my-broker-instance-container-init
171+
selector:
172+
kind: StatefulSet
168173
# ...
169174
----
170175
<1> Replace `my-broker-instance-instance-volume` with the actual volume name used by your broker deployment. This name typically follows the pattern `<BROKER_NAME>-instance-volume`. You can verify the exact volume name by inspecting an existing broker pod's YAML (`oc get pod <broker_pod_name> -o yaml`) and looking under `spec.volumes`.
@@ -210,24 +215,25 @@ spec:
210215
- name: JAVA_ARGS_APPEND
211216
value: "-Dhawtio.roles=* -Djavax.management.builder.initial=org.apache.activemq.artemis.core.server.management.ArtemisRbacMBeanServerBuilder"
212217
resourceTemplates:
213-
- selector:
214-
kind: "StatefulSet"
215-
patch:
216-
kind: "StatefulSet"
217-
spec:
218-
template:
219-
spec:
220-
initContainers:
221-
- name: "<BROKER_NAME>-container-init"
222-
args:
223-
- '-c'
224-
- '/opt/amq/bin/launch.sh && /opt/amq-broker/script/default.sh; echo "Empty management.xml";echo "<management-context xmlns=\"http://activemq.apache.org/schema\" />" > /amq/init/config/amq-broker/etc/management.xml'
218+
- patch:
219+
kind: StatefulSet
220+
spec:
221+
template:
222+
spec:
223+
initContainers:
224+
- args:
225+
- '-c'
226+
- '/opt/amq/bin/launch.sh && /opt/amq-broker/script/default.sh; echo "Empty management.xml";echo "<management-context xmlns=\"http://activemq.apache.org/schema\" />" > /amq/init/config/amq-broker/etc/management.xml'
227+
name: my-broker-instance-container-init
228+
selector:
229+
kind: StatefulSet
225230
226231
# ... existing configurations ...
227232
brokerProperties:
228233
# ... existing messaging RBAC if any ...
229-
- securityRoles."mops.address.activemq.management.*".manager.view=true
230-
- securityRoles."mops.address.activemq.management.*".manager.edit=true
234+
- securityRoles."mops.#".amq.view=true
235+
- securityRoles."mops.#".amq.edit=true
236+
- securityRoles."mops.#".admin.manage=true
231237
deploymentPlan:
232238
size: 1
233239
image: placeholder
@@ -265,17 +271,13 @@ kind: ActiveMQArtemis
265271
metadata:
266272
name: my-broker-instance
267273
spec:
268-
# ... other broker configurations ...
269-
extraMounts:
270-
- name: custom-jaas-config // <1>
271-
mountPath: /home/amq/broker/etc/custom-jaas-config/ // <2>
272-
secrets:
273-
- custom-jaas-config // <3>
274+
deploymentPlan:
275+
extraMounts:
276+
secrets:
277+
- simple-jaas-config <1>
274278
# ...
275279
----
276-
<1> `name`: A unique name for the mount, referencing the secret.
277-
<2> `mountPath`: The path inside the broker container where the secret's contents will be available.
278-
<3> `secrets`: A list of OpenShift Secrets to be mounted, by name. This Secret (`custom-jaas-config`) would contain your `login.config` file.
280+
<1> `secrets`: A list of OpenShift Secrets to be mounted, by name. This Secret (`custom-jaas-config`) would contain your `login.config` file.
279281

280282
In this configuration:
281283

modules/securing-amq-broker-on-openshift/pages/enabling-secure-listeners.adoc

Lines changed: 10 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -138,49 +138,29 @@ spec:
138138
deploymentPlan:
139139
size: 1
140140
image: placeholder
141-
journalStorage:
142-
size: 2Gi
143-
brokerProperties:
144-
- "security.enabled=true" # Ensure security is enabled if you plan to configure users later
141+
requireLogin: true
145142
acceptors:
146143
- name: amqp-secure
147144
port: 5671
148-
protocols: [AMQP]
145+
protocols: AMQP
149146
sslEnabled: true
150147
sslSecret: amq-broker-tls-secret # Name of the Secret created in Step 2
151-
# The keyStorePath refers to the file name *inside* the secret
152-
keyStorePath: broker.ks
153-
# The keyStorePassword refers to the literal key name *inside* the secret
154-
keyStorePassword: keyStorePassword
155-
enabledProtocols: [TLSv1.2, TLSv1.3]
156-
# Uncomment and configure if you need mutual TLS
157-
# trustStorePath: client.ts
158-
# trustStorePassword: trustStorePassword
148+
enabledProtocols: TLSv1.2,TLSv1.3
159149
- name: core-secure
160150
port: 61617
161-
protocols: [CORE]
151+
protocols: CORE
162152
sslEnabled: true
163153
sslSecret: amq-broker-tls-secret
164-
keyStorePath: broker.ks
165-
keyStorePassword: keyStorePassword
166-
enabledProtocols: [TLSv1.2, TLSv1.3]
154+
enabledProtocols: TLSv1.2,TLSv1.3
167155
# Expose the secure AMQP port via an OpenShift Route
168156
console:
169157
expose: true
170-
addressSettings:
171-
- name: "#"
172-
redeliveryDelay: 1000
173-
maxDeliveryAttempts: 3
174-
# Example for external exposure - use a Route for secure external access
175-
# routes:
176-
# - name: amqp-secure-external
177-
# host: amqp-broker-secure.apps.<cluster-hostname>
178-
# servicePort: 5671
179-
# termination: passthrough # Important for TLS termination at the broker
158+
brokerProperties:
159+
- addressSettings."#".redeliveryDelay=1000
160+
- addressSettings."#".maxDeliveryAttempts=3
180161
----
181162
* We've defined two acceptors (`amqp-secure` and `core-secure`) with `sslEnabled: true`.
182163
* `sslSecret` points to `amq-broker-tls-secret`, the secret we created.
183-
* `keyStorePath` and `keyStorePassword` reference the file and literal key within that secret.
184164
* `enabledProtocols` explicitly sets `TLSv1.2` and `TLSv1.3` for stronger security.
185165

186166
.Apply the Custom Resource to deploy the broker:
@@ -207,7 +187,8 @@ Once the broker pod is running, check its logs to confirm that the secure listen
207187
oc logs $(oc get pod -l activemq-artemis-name=amq-broker-secure-example -o jsonpath='{.items[0].metadata.name}') -n $(oc project -q) | grep "acceptor"
208188
----
209189
You should see log entries indicating that the secure acceptors are starting up on the specified ports (e.g., 5671 and 61617) with SSL enabled. Look for messages similar to:
210-
`INFO [org.apache.activemq.artemis.core.server] AMQ221007: Server will be started. AMQP Acceptor 'amqp-secure' is listening on nio://0.0.0.0:5671 for protocols [AMQP] with SSL.`
190+
`INFO [org.apache.activemq.artemis.core.server] AMQ221020: Started EPOLL Acceptor at amq-broker-secure-example-ss-0.amq-broker-secure-example-hdls-svc.broker.svc.cluster.local:5671 for protocols [AMQP]
191+
`
211192

212193
=== Step 5: Test Client Connectivity (Overview)
213194

0 commit comments

Comments
 (0)