This is a work in progress… but someone asked me for this information so I’ll publish as it is.
I had a lot of playing around with MQWEB on Linux, and I thought that z/OS would be just a small step more than Linux. After many false steps, it is very similar to Linux – but because z/OS is more secure than Linux you have to do more work to get the right permissions.
Once you have set up the keyrings and got your web browser to talk to the Liberty at the back end, you can then
- logon with userid and password
- logon with digital certificate, so there is now set up to map your Linux digital certificate to a z/OS userid
Once you have got the z/OS userids set up, you need to set up the RACF groups which determine if you are allowed to use the server, and if you are a read only user, or a full function.
z/OS certificates background.
- You use the RACF RACDCERT command to manage certificates
- Certificates either stored in an (encrypted) RACF data base.
- You provide similar information as with midrange machines to define certificates, such as Organisation, Common Name, Country etc.
- On z/OS you cannot specify Extended Key Usage (EKU) attributes.
- A certificate has two parts,
- a private part, this allows you to encrypt data for that certificate. It must be kept securely.
- a public part – anyone can have a copy of this – allows them to decrypt a message created using the private key.
- Certificate ownership. The RACF documentation says
- User certificate A certificate that is associated with a RACF user ID and is used to authenticate the user’s identity. The RACF user ID can represent a traditional user or be assigned to a server or started procedure. These are identified by ID(…).
- Certificate-authority certificate. A certificate that is associated with a certificate authority and is used to verify signatures in other certificates. These are identified by CERTAUTH.
- Site certificate. A certificate that is associated with an off-platform server or other network entity, such as a peer VPNserver. This category of certificate can also be used to share a single certificate and its private key among multiple RACF user IDs. When used for sharing, a certificate might be referred to as a placeholder certificate. These are identified by SITE.
- A certificate has to have the TRUST attribute to be visible in a keyring.
- Applications access certificate via a user’s keyring.
- A userid can have many keyrings
- A keyring can have many certificates. They can belong to User, Certificate Authority, or Site.
- You can control access at an individual keyring level.
- Your web browser will likely have two keyrings (similar to midrange)
- A Server key ring containing the private certificate to identify the server, and has the private key. This keyring might only be used by a group of MQWEB servers and no other applications. A web server in CICS would have a its own keyring.
- A Trust store. This has the public certificates and allows people to communicate with the web server. It typically has Certificate Authority certificates. A CA certificate can validate all users who’s certificate was signed by the CA. So one CA in the keyring could validate 1000 users. If the end users are using self signed certificates, then the z/OS keyring has to have a copy of every self signed certificate. If you add a new certificate then you may have to restart the server.
- You might share this trust store with all web servers, either native or within CICS.
Steps for setting up the certificates and keyrings to connect the browser to the z/OS web server
- Server keyring
- Create a z/OS certificate authority
- Create a server keyring
- Create a certificate for the server
- Add the certificate to the keying
- Add the CA to the keyring
- Give the mqweb userid access to the keyring.
- Export the CA certificate, download it, distribute it to all users. Import into their web browsers.
- Trust keyring
- Create a (shared) keyring
- Get the CA from your users, upload to z/OS import them into the keyring
- Give the server userids access to the keyring
Once you have been sucessfull with setting up the keyrings you will either be logged on on, or get a logon panel.
You now have to configure the environment to allow people to logon with the correct authorities.
Detailed steps.
I found it easiest to create JCL using batch TSO with the various commands rather than use panels, or typing commands. It means you can repeat the steps until they work.
//IBMRABB JOB 1,MSGCLASS=H //S1 EXEC PGM=IKJEFT01,REGION=0M //SYSPRINT DD SYSOUT=* //SYSTSPRT DD SYSOUT=* //SYSTSIN DD * Put your commands here /* this (with a space in front) is ignored /*
Configuration
- The MQWEB server runs with userid START1
- It will have a server key keyring called KEY
- It will have a trust store keyring called TRUST
- The IP address of the z/OS image is 10.1.1.2. This is needed when defining the server’s certificate because the clients compare this with web server’s location. It can be IP(‘nn.nn.nn.nn’) or DOMAIN(‘ABC.COM’).
Create the CA
/* Delete it in case it existed
RACDCERT CERTAUTH DELETE(LABEL('TEMP-CA'))
/* the CA needs size >= 2048 otherwise Chrome browser may ignore it
/* The certificate shows up in browsers under org-TEST
RACDCERT GENCERT -
CERTAUTH -
SUBJECTSDN(CN('TEMPCertification Authority')-
O('TEMP') -
OU('TEST')) -
NOTAFTER( DATE(2021-07-01 ) -
KEYUSAGE(HANDSHAKE,CERTSIGN,DOCSIGN,DATAENCRYPT ) -
RSA SIZE(2048) -
WITHLABEL('TEMP-CA')
RACDCERT CERTAUTH EXPORT(LABEL('TEMP-CA'))-
DSN('IBMUSER.CERT.TEMPCA.PEM') -
FORMAT(CERTB64) -
PASSWORD('password')
You can now download the dataset IBMUSER.CERT.TEMPCA.PEM and import it into the browser’s keystore.
Create the server keyring
RACDCERT DELRING(KEY) ID(START1)
RACDCERT ADDRING(KEY) ID(START1)
Create the certificate to identify the server
This needs the ALTNAME so the browsers accept the certificate
RACDCERT ID(START1) DELETE(LABEL('TEMP'))
RACDCERT ID(START1) GENCERT -
SUBJECTSDN(CN('TEMP') -
O('TEMP') -
OU('TEST')) -
ALTNAME(IP(10.1.1.2)) -
SIGNWITH (CERTAUTH LABEL('TEMP-CA')) -
RSA SIZE(2048)
NOTAFTER( DATE(2021-12-29))-
WITHLABEL('TEMP')
/* KEYUSAGE is not needed
RACDCERT ID(START1) ALTER(LABEL(‘TEMP’))TRUST
RACDCERT ID(START1) CONNECT(RING(KEY) LABEL('TEMP'))
RACDCERT ID(START1) CONNECT(RING(KEY) -
LABEL('TEMP-CA') CERTAUTH)
RACDCERT LIST(LABEL('TEMP-CA' )) CERTAUTH
RACDCERT LIST(LABEL('TEMP' )) ID(START1)
SETROPTS RACLIST(DIGTCERT,DIGTRING ) refresh
Give the servers userid access to the server’s keyring
See here.
RDEFINE RDATALIB START1.KEY.LST UACC(NONE) /* READ access enables retrieving one's own private key /* UPDATE access enables retrieving other's. PERMIT START1.KEY.LST CLASS(RDATALIB) ID(START1 ) ACCESS(UPDATE) PERMIT START1.KEY.LST CLASS(RDATALIB) ID(IBMUSER) ACCESS(UPDATE) SETROPTS RACLIST(RDATALIB) REFRESH RLIST FACILITY START1.KEY.LST
Upload the CA from the midrange machine and store in the key store.
The certificate ( .pem file) looks like
—–BEGIN CERTIFICATE—–
…
—–END CERTIFICATE—–
So should be uploaded as a source file.
RACDCERT CERTAUTH DELETE(LABEL('Linux-CA2'))
RACDCERT SITE ADD('IBMUSER.CACERT.PEM') -
WITHLABEL('Linux-CA2') TRUST
RACDCERT DELRING(TRUST) ID(START1)
RACDCERT ADDRING(TRUST) ID(START1)
RACDCERT ID(START1) CONNECT(RING(TRUST ) -
LABEL('Linux-CA2') SITE
RACDCERT LISTRING(TRUST ) ID(START1)
SETROPTS RACLIST(DIGTCERT,DIGTRING ) refresh
Of course you run this just once, and use the connect statement to add as many CAs as you have.