The following example assumes that the SSHD2
user
created in Creating the SSHD2
User is used to run the
server.
To use SAF certificates for authenticating the server, do the following steps. Replace the names and IDs with those appropriate to your system:
Create the server host key in SAF by giving the following TSO commands:
RACDCERT ID(SSHD2) GENCERT SUBJECTSDN(CN('LPAR1') OU('RD') O('EXAMPLE')) SIZE(1024) WITHLABEL('LPAR1.EXAMPLE.COM') RACDCERT ID(SSHD2) LIST
Give the following TSO command to generate the certification request:
RACDCERT ID(SSHD2) GENREQ(LABEL('LPAR1.EXAMPLE.COM')) DSN('SSHD2.LPAR1.CRT.REQ')
Use the PKCS#10 certification request in the data set
'SSHD2.LPAR1.CRT.REQ'
to enroll the certificate. The actual
steps depend on your CA setup.
After the enrollment is completed, store the received certificate
to a data set, for example 'SSHD2.LPAR1.CRT'
.
To connect the new certificate to a key ring, give the following TSO commands:
RACDCERT ID(SSHD2) ADD('SSHD2.LPAR1.CRT') TRUST WITHLABEL('LPAR1.EXAMPLE.COM') RACDCERT ID(SSHD2) ADDRING(SSH-HOSTKEY) RACDCERT ID(SSHD2) CONNECT(ID(SSHD2) LABEL('LPAR1.EXAMPLE.COM') RING(SSH-HOSTKEY) USAGE(PERSONAL)) RACDCERT ID(SSHD2) LISTRING(SSH-HOSTKEY)
For the settings to take effect, give the following TSO command:
SETROPTS RACLIST(DIGTCERT) REFRESH
Define the z/OS SAF external key provider in the
/opt/tectia/etc/sshd2_config
file:
HostKeyEkProvider zos-saf HostKeyEkInitString "KEYS(ID(SSHD2) RING(SSH-HOSTKEY) LABEL('LPAR1.EXAMPLE.COM'))" HostKey.Cert.Required yes
Note that HostKeyEkInitString
must point to a single
private key. Setting the HostKey.Cert.Required
option to
yes
defines that the server must authenticate with a
certificate. When the z/OS SAF provider is used, setting the option to
no
means that only the public key found in the SAF
certificate is used. Setting the option to optional
means
that both the SAF certificate and the public key found in the SAF
certificate are used.
For more information on the configuration file options, see
sshd2_config
. For information on
the format of the external key initialization string, see
ssh-externalkeys
.