Implementing Basic Authentication Using SAF for the MQ Web Console
Audience level
Some knowledge of MQ, z/OS, and Liberty
Skillset
MQ Administration, z/OS systems programming
Background
Basic authentication uses a user ID and password to access a resource. The MQ Web Console supports two basic authentication approaches: the basic registry and the SAF registry. This lab covers the SAF registry approach.
Modern production environments often prefer stronger authentication approaches such as tokens, passkeys, or enterprise single sign-on. For that reason, this lab should be treated as a learning exercise for sandbox or lab environments rather than a production deployment pattern.
Overview of the exercise
In this lab, you will:
I. Copy zos_saf_registry.xml
II. Alter server.xml
III. Customize zos_saf_registry.xml
IV. Configure RACF for the MQ Web Console SAF registry
V. Start the Liberty angel process
VI. Configure RACF for the angel process
VII. Restart and validate the MQ Web Console
Prerequisites
Before you begin, make sure the following are available:
- IBM MQ for z/OS with the MQ Web Console installed
- Access to the
mqwebserver configuration directory - Authority to edit the Liberty configuration files
- Authority to define and permit RACF resources in the
APPL,EJBROLE, andSERVERclasses - The user ID under which the MQ Web Console started task runs
- The SAF profile prefix you intend to use, for example
MQW942 - The unauthenticated or pre-authentication user ID you intend to use, for example
MQGUEST - Authority to start the Liberty angel started task and the MQ Web Console started task
Note: This lab uses
MQW942as the profile prefix andSYSPROGas the started task user in examples. Replace those values with the ones used in your environment.
Exercise
I. Copy zos_saf_registry.xml
- From the ISPF main menu, enter:
tso omvs
- In OMVS, list the sample MQ Web Console configuration files:
ls /usr/lpp/mqm/V9R4M2X/web/mq/samp/configuration
You should see a list of XML files, including zos_saf_registry.xml.
- Change to the
mqwebserver directory and copy the sample SAF registry file into it:
cd /var/mqm/servers/mqweb
cp /usr/lpp/mqm/V9R4M2X/web/mq/samp/configuration/zos_saf_registry.xml .
Important: Do not miss the final
.. It means the file is copied into the current directory.
-
Type
exitto leave OMVS. -
Return to the
mqwebdirectory in ISPF and confirm thatzos_saf_registry.xmlis now present.
II. Alter server.xml
-
Navigate to the
/var/mqm/servers/mqwebdirectory from ISPF option3.4. -
List the contents of the directory and locate
server.xmlandzos_saf_registry.xml. -
Edit
server.xml. -
Replace:
<include location="basic_registry.xml"/>
with:
<include location="zos_saf_registry.xml"/>
- Save
server.xmland exit.
III. Customize zos_saf_registry.xml
-
Edit
zos_saf_registry.xmlin ASCII mode. -
Modify the sample configuration so it looks similar to the following:
<server>
<featureManager>
<feature>appSecurity-2.0</feature>
<feature>zosSecurity-1.0</feature>
<feature>basicAuthenticationMQ-1.0</feature>
<feature>apiDiscovery-1.0</feature>
</featureManager>
<enterpriseApplication id="com.ibm.mq.console" />
<enterpriseApplication id="com.ibm.mq.rest" />
<safRegistry id="saf" />
<safAuthorization id="saf" reportAuthorizationCheckDetails="true"/>
<safCredentials unauthenticatedUser="MQGUEST" profilePrefix="MQW942" suppressAuthFailureMessages="false"/>
<sslDefault sslRef="mqDefaultSSLConfig"/>
</server>
- Review the key values:
profilePrefix="MQW942"identifies the RACF profile prefix used by Liberty and MQ WebunauthenticatedUser="MQGUEST"identifies the user used before full authentication occurs, allowing the login page to be presented-
safAuthorizationenables SAF-based authorization for the web console and REST applications -
Save the file and exit.
-
Edit
mqwebuser.xmlin ASCII mode and make sure it contains a configuration similar to the following:
<server>
<featureManager>
<feature>appSecurity-2.0</feature>
</featureManager>
<webAppSecurity allowFailOverToBasicAuth="true"/>
<webAppSecurity overrideHttpAuthMethod="BASIC"/>
<variable name="httpsPort" value="9443"/>
<variable name="httpHost" value="-1"/>
<httpEndpoint host="*" httpPort="-1" httpsPort="9443"
id="defaultHttpEndpoint"/>
<sslDefault sslRef="mqDefaultSSLConfig"/>
</server>
- Save
mqwebuser.xmland exit.
Note: Some sites choose to keep this configuration in a single file. In this lab, the configuration is kept separate to make it easier to switch between basic registry and SAF registry examples.
IV. Configure RACF for the MQ Web Console SAF registry
-
Return to the ISPF main menu and enter option
6for the TSO command line. -
Define the application profile for the MQ Web Console using your SAF profile prefix. For example:
RDEFINE APPL MQW942 UACC(NONE)
- Permit access to users who need to reach the MQ Web login screen, including the unauthenticated user ID specified in
zos_saf_registry.xml. For example:
PERMIT MQW942 CLASS(APPL) ACCESS(READ) ID(MQGUEST)
PERMIT MQW942 CLASS(APPL) ACCESS(READ) ID(userID)
- Refresh the
APPLclass:
SETROPTS RACLIST(APPL) REFRESH
- Define the
EJBROLEprofiles used for MQ Console and REST security roles:
RDEFINE EJBROLE MQW942.com.ibm.mq.console.MQWebAdmin UACC(NONE)
RDEFINE EJBROLE MQW942.com.ibm.mq.console.MQWebAdminRO UACC(NONE)
RDEFINE EJBROLE MQW942.com.ibm.mq.console.MQWebUser UACC(NONE)
RDEFINE EJBROLE MQW942.com.ibm.mq.rest.MQWebAdmin UACC(NONE)
RDEFINE EJBROLE MQW942.com.ibm.mq.rest.MQWebAdminRO UACC(NONE)
RDEFINE EJBROLE MQW942.com.ibm.mq.rest.MQWebUser UACC(NONE)
RDEFINE EJBROLE MQW942.com.ibm.mq.rest.MFTWebAdmin UACC(NONE)
RDEFINE EJBROLE MQW942.com.ibm.mq.rest.MFTWebAdminRO UACC(NONE)
- Permit users to the appropriate roles. For example, to allow a user full administrative access to the REST API:
PERMIT MQW942.com.ibm.mq.rest.MQWebAdmin CLASS(EJBROLE) ACCESS(READ) ID(userID)
-
Repeat the necessary
PERMITcommands for the MQ Console and REST roles required by your users. -
A simple role mapping summary is shown below:
| Role | Typical use |
|---|---|
MQWebAdmin |
Full administrative access to the MQ Web Console or REST API |
MQWebAdminRO |
Read-only administrative access |
MQWebUser |
Basic user access with fewer administrative capabilities |
- Refresh the relevant RACF class for these role definitions according to your site standards.
Note: If
EJBROLEis RACLISTed in your environment, refresh that class after the updates. The original lab refreshedAPPLa second time here, but in practice you should make sure the class containing the updated definitions is refreshed.
V. Start the angel process
-
The Liberty angel process is a started task that allows Liberty servers to use z/OS authorized services. It is long-lived and can be shared by multiple Liberty servers.
-
Navigate to SDSF from the ISPF main menu.
-
In the SDSF command input line, start the angel task:
/S MQANGEL
- In SDSF
DA, set the prefix toMQ*and confirm that theMQANGELaddress space is running.
VI. Configure the MQ Web started task for angel usage
-
Return to ISPF option
3.4and navigate to the procedure library that contains the MQ Web started task, for exampleSYS1.PROCLIB. -
Locate the
MQWEBSprocedure and edit it. -
Review the
STDENVsection. Make sure the following Java option is present in the active environment section used by the started task:
IBM_JAVA_OPTIONS=-Dcom.ibm.ws.zos.core.angelName=MQANGEL
-
Make sure it is placed in the active environment section, not in an unused or commented section.
-
Save the procedure and exit.
VII. Configure RACF for angel process access
-
If you now try to restart the MQ Web Console, it may fail because the started task user ID does not yet have access to the required Liberty angel resources. In the following examples, the MQ Web started task user is
SYSPROG. -
From ISPF option
6, define a profile for the angel and permit the started task user:
RDEFINE SERVER BBG.ANGEL UACC(NONE) OWNER(SYSPROG)
PERMIT BBG.ANGEL CLASS(SERVER) ACCESS(READ) ID(SYSPROG)
- Define a server profile for the named angel process using the same profile prefix concept:
RDEFINE SERVER BBG.ANGEL.MQW942 UACC(NONE) OWNER(SYSPROG)
PERMIT BBG.ANGEL.MQW942 CLASS(SERVER) ACCESS(READ) ID(SYSPROG)
- Define a server profile for the security prefix:
RDEFINE SERVER BBG.SECPFX.MQW942 UACC(NONE)
PERMIT BBG.SECPFX.MQW942 CLASS(SERVER) ACCESS(READ) ID(SYSPROG)
- Define a server profile for the authorized module
BBGZSAFM:
RDEFINE SERVER BBG.AUTHMOD.BBGZSAFM UACC(NONE) OWNER(SYSPROG)
PERMIT BBG.AUTHMOD.BBGZSAFM CLASS(SERVER) ACCESS(READ) ID(SYSPROG)
- Define a server profile for SAF credential services:
RDEFINE SERVER BBG.AUTHMOD.BBGZSAFM.SAFCRED UACC(NONE)
PERMIT BBG.AUTHMOD.BBGZSAFM.SAFCRED CLASS(SERVER) ACCESS(READ) ID(SYSPROG)
- Define a server profile for WLM services:
RDEFINE SERVER BBG.AUTHMOD.BBGZSAFM.ZOSWLM UACC(NONE)
PERMIT BBG.AUTHMOD.BBGZSAFM.ZOSWLM CLASS(SERVER) ACCESS(READ) ID(SYSPROG)
- Define a server profile for RRS transaction services:
RDEFINE SERVER BBG.AUTHMOD.BBGZSAFM.TXRRS UACC(NONE)
PERMIT BBG.AUTHMOD.BBGZSAFM.TXRRS CLASS(SERVER) ACCESS(READ) ID(SYSPROG)
- Define a server profile for dump services:
RDEFINE SERVER BBG.AUTHMOD.BBGZSAFM.ZOSDUMP UACC(NONE)
PERMIT BBG.AUTHMOD.BBGZSAFM.ZOSDUMP CLASS(SERVER) ACCESS(READ) ID(SYSPROG)
- Define server profiles for local adapter services:
RDEFINE SERVER BBG.AUTHMOD.BBGZSAFM.WOLA UACC(NONE) OWNER(SYSPROG)
PERMIT BBG.AUTHMOD.BBGZSAFM.WOLA CLASS(SERVER) ACCESS(READ) ID(SYSPROG)
RDEFINE SERVER BBG.AUTHMOD.BBGZSAFM.LOCALCOM UACC(NONE) OWNER(SYSPROG)
PERMIT BBG.AUTHMOD.BBGZSAFM.LOCALCOM CLASS(SERVER) ACCESS(READ) ID(SYSPROG)
- Define a server profile for product management services:
RDEFINE SERVER BBG.AUTHMOD.BBGZSAFM.PRODMGR UACC(NONE) OWNER(SYSPROG)
PERMIT BBG.AUTHMOD.BBGZSAFM.PRODMGR CLASS(SERVER) ACCESS(READ) ID(SYSPROG)
- Define a server profile for asynchronous I/O services:
RDEFINE SERVER BBG.AUTHMOD.BBGZSAFM.ZOSAIO UACC(NONE) OWNER(SYSPROG)
PERMIT BBG.AUTHMOD.BBGZSAFM.ZOSAIO CLASS(SERVER) ACCESS(READ) ID(SYSPROG)
- Define a server profile for the authorized client module
BBGZSCFM:
RDEFINE SERVER BBG.AUTHMOD.BBGZSCFM UACC(NONE) OWNER(SYSPROG)
PERMIT BBG.AUTHMOD.BBGZSCFM CLASS(SERVER) ACCESS(READ) ID(SYSPROG)
- Define a server profile for the client optimized local adapter services:
RDEFINE SERVER BBG.AUTHMOD.BBGZSCFM.WOLA UACC(NONE) OWNER(SYSPROG)
PERMIT BBG.AUTHMOD.BBGZSCFM.WOLA CLASS(SERVER) ACCESS(READ) ID(SYSPROG)
- Refresh the
SERVERclass:
SETROPTS RACLIST(SERVER) REFRESH
VIII. Restart and validate MQ Web
-
Restart the MQ Web Console started task from SDSF.
-
Open the MQ Web Console in a browser and confirm that the login screen appears.
-
Sign in using a permitted RACF user ID and password.
-
Confirm that the user can access the MQ Console or REST API functions allowed by the assigned
EJBROLEprofiles.
Validation checklist
Before considering the lab complete, confirm the following:
zos_saf_registry.xmlwas copied into themqwebserver directoryserver.xmlincludeszos_saf_registry.xmlzos_saf_registry.xmlcontains the correctprofilePrefixandunauthenticatedUser- RACF
APPLprofiles were created and permitted correctly - RACF
EJBROLEprofiles were created and permitted correctly MQANGELis running- The
MQWEBSstarted task environment includes the angel Java option - RACF
SERVERprofiles for angel access were defined and refreshed - The MQ Web Console starts successfully
- A permitted RACF user can log in successfully
Troubleshooting
If the MQ Web Console does not work as expected, check the following:
- The sample file was copied from the correct MQ version directory
server.xmlincludeszos_saf_registry.xmland notbasic_registry.xmlmqwebuser.xmlcontains a validhttpsPortattribute and valid XML syntax- The
profilePrefixin the XML matches the RACF profile names you created - The
unauthenticatedUserexists and has the requiredAPPLaccess - The MQ Web started task user has access to the required
SERVERclass profiles MQANGELis running- The Java option for the angel process is in the active
STDENVsection - The correct RACF classes were refreshed after updates
- The MQ Web started task was restarted after configuration changes
Common symptoms and causes:
- Login page does not appear: MQ Web did not start, XML is invalid, or HTTPS endpoint configuration is broken
- Login page appears but authentication fails for all users:
APPLprofile, SAF registry, orprofilePrefixconfiguration is wrong - Login works but authorization is wrong:
EJBROLEdefinitions orPERMITcommands are incomplete - MQ Web fails after angel changes:
MQANGELis not running,SERVERprofiles are missing, or the Liberty JVM option is not active - XML edit causes startup failure: the file was not edited in ASCII mode, or a syntax error was introduced
Cleanup or rollback
If you want to back out the change and return to the basic registry example:
- Edit
server.xmland replace:
<include location="zos_saf_registry.xml"/>
with:
<include location="basic_registry.xml"/>
-
Remove or ignore the SAF registry XML file if it is no longer needed.
-
Back out the RACF definitions according to your site's standards if they were created only for this lab.
-
Restart the MQ Web Console.
Appendix
More information about angel RACF profiles: IBM Documentation