Red Hat Training

A Red Hat training course is available for Red Hat Fuse

Chapter 7. Securing the Management Console

Abstract

The default setting for Access-Control-Allow-Origin header for the JBoss Fuse Management Console permits unrestricted sharing. To restrict access to the JBoss Fuse Management Console, an OSGI fragment bundle must be implemented.

7.1. Controlling Access to the Fuse Management Console

Contents of the Fragment Bundle

A fragment bundle that enables the jolokia-access.xml policy file can be used to restrict access without altering the original hawtio-web.war. A fragment bundle that contains the jolokia-access.xml policy file within the CORS configuration can be added to limit access to a certain host by using <allow-origin> sections within the <cors> sections. The <allow-origin> section can contain the origin URL provided by browsers with the Origin: header, or a wildcard specification with *. For example:
<cors>
   <!-- Allow cross origin access from www.jolokia.org ... -->
   <allow-origin>http://www.jolokia.org</allow-origin>
   <!-- ... and all servers from jmx4perl.org with any protocol -->
   <allow-origin>*://*.jmx4perl.org</allow-origin>
   <!-- Check for the proper origin on the server side, too -->
   <strict-checking/>
</cors>
Build the fragment bundle according to the insructions in the OSGI specifications at OSGi Developer Downloads. For more information about OSGi dependencies see Managing OSGi dependencies. Ensure that you add the Fragment-Host header in the Manifest.MF bundle. After building the fragment bundle, use the following command to install it:
install file:///Location_Of_Fragment_Bundle_file/hawtio-web-fragment/target/hawtio-web-fragment-1.2-redhat-379.jar
Hawtio-web must be refreshed to pick up the fragment bundle. Use the follwing comands to refresh the hawtio-web bundle:
To find out the hawtio-web bundle ID:
JBossFuse:karaf@root> la | grep -i hawtio
Identify the number for the hawtio-web bundle. In the example below, the number is 253:
[ 253] [Active     ] [            ] [       ] [   80] hawtio :: hawtio-web (1.4.0.redhat-621083)
Refresh the hawtio-web bundle using the following command:
JBossFuse:karaf@root> refresh 253
Repeat the la | grep -i hawtio command to see the hawtio-web line with the fragment bundle attached:
[ 253] [Active     ] [            ] [       ] [   80] hawtio :: hawtio-web (1.4.0.redhat-621083), Fragments: 270