Apache HTTP Server Nshield pkcs11 Ig
Apache HTTP Server Nshield pkcs11 Ig
Throughout this guide, the term HSM refers to nShield Solo and nShield Connect units.
Product Version
Feature Support
Softcards Yes
1.1.2.2. Connect +
1.2. Requirements
Ensure that you have supported versions of the nShield, Apache, and third-party
products. See Product configurations.
Consult the security team in your organization for a suitable setting of the SE Linux
policy to allow the web server read access to the files in /opt/nfast.
• The number and quorum of Administrator Cards in the Administrator Card Set
(ACS), and the policy for managing these cards.
• Whether the application keys are protected by the module, an Operator Card Set
(OCS) or a Softcard with or without a pass phrase.
• The number and quorum of Operator Cards in the OCS, and the policy for managing
these cards.
• Whether the Security World should be compliant with FIPS 140-2 Level 3.
% sudo setenforce 0
Entrust recommends that you install the HSM before configuring the Security World
software with your Apache HTTP Server.
1. On the computer that you want to make the Apache HTTP Server, install the latest
version of the Security World Software as described in the Installation Guide for the
HSM.
2. Create the Security World as described in the User Guide, creating the ACS and OCS
that you require.
You can confirm that the right binary is being run with the following command:
% which openssl
/usr/bin/openssl
If this command returns anything inside /opt/nfast, check your $PATH variable.
2.4.1. Configuration
Find out where your OpenSSL configuration file is located:
% openssl version -d
OPENSSLDIR: "/etc/pki/tls"
#
# OpenSSL example configuration file.
# This is mostly being used for generation of certificate requests.
#
# Note that you can include other files from the main configuration
# file using the .include directive.
#.include filename
# This definition stops the following lines generating an error if HOME isn't
# defined.
HOME = .
RANDFILE = $ENV::HOME/.rnd
# nShield PKCS11
openssl_conf = openssl_def
[openssl_def]
engines = engine_section
[engine_section]
pkcs11 = pkcs11_section
[pkcs11_section]
engine_id = pkcs11
dynamic_path = /usr/lib64/engines-1.1/pkcs11.so
MODULE_PATH = /opt/nfast/toolkits/pkcs11/libcknfast.so
init = 0
#!
If it does, you need to add the following to your OpenSSL configuration, adjusted to your
organization’s values:
[req]
distinguished_name = req_distinguished_name
req_extensions = v3_req
prompt = no
[req_distinguished_name]
C = US
ST = FL
L = Sunrise
O = Entrust
OU = nShield
CN = www.entrust.com
[v3_req]
subjectAltName = @alt_names
[alt_names]
DNS.1 = www.entrust.com
DNS.2 = entrust.com
Create a file called openssl.pkcs11.cnf with the settings above, and save it where your
OpenSSL configuration settings are located:
% sudo vi /etc/pki/tls/openssl.pkcs11.cnf
CKNFAST_DEBUG=10
CKNFAST_DEBUGFILE=/path/to/debug/file
CKNFAST_FAKE_ACCELERATOR_LOGIN=1
CKNFAST_LOADSHARING=1
% export OPENSSL_CONF=/etc/pki/tls/openssl.pkcs11.cnf
There may be other output, but you should see this included:
If it does, it indicates that there is no Security World. Make sure you create a Security
world first.
2. Debugging variables.
These variables can be used for debugging purpose. They can be set in
/opt/nfast/cknfastr or as environment variables.
CKNFAST_DEBUG=10
CKNFAST_DEBUGFILE=/path
If you don’t see the PKCS #11 engine in the output, check the dynamic_path line in the
openssl.pkcs11.cnf configuration file. This may vary on other platforms and other
operating system versions.
dynamic_path = /usr/lib64/engines-1.1/pkcs11.so
Available slots:
Slot 0 (0x1d622495): 6308-03E0-D947 Rt1
token label : accelerator
token manufacturer : nCipher Corp. Ltd
token model :
token flags : rng, token initialized, PIN initialized, other flags=0x200
hardware version : 0.0
firmware version : 12.50
serial num : 6308-03E0-D947
pin min/max : 0/256
Slot 1 (0x1d622496): 6308-03E0-D947 Rt1 slot 0
(empty)
Slot 2 (0x1d622497): 6308-03E0-D947 Rt1 slot 2
(token not recognized)
Slot 3 (0x1d622498): 6308-03E0-D947 Rt1 slot 3
(empty)
[Service]
Type=notify
Environment=LANG=C
Environment="OPENSSL_CONF=/etc/pki/tls/openssl.pkcs11.cnf"
4. Set the environment variable so that OpenSSL commands use the PKCS #11 engine:
% export OPENSSL_CONF=/etc/pki/tls/openssl.pkcs11.cnf
% openssl req -engine pkcs11 -new -x509 -days 365 -key pkcs11localhost.key -out pkcs11localhost.crt
b. Edit /etc/httpd/conf.d/ssl.conf and change the following lines to use the new
.key and .crt files:
CONNECTED(00000003)
depth=0 C = US, ST = FL, L = Sunrise, O = Entrust, OU = nShield, CN = www.entrust.com
verify return:1
---
Certificate chain
0 s:/C=US/ST=FL/L=Sunrise/O=Entrust/OU=nShield/CN=www.entrust.com
i:/C=US/ST=FL/L=Sunrise/O=Entrust/OU=nShield/CN=www.entrust.com
---
Server certificate
-----BEGIN CERTIFICATE-----
MIIDUDCCAjgCCQCx9G3D5F5XITANBgkqhkiG9w0BAQsFADBqMQswCQYDVQQGEwJV
UzELMAkGA1UECAwCRkwxEDAOBgNVBAcMB1N1bnJpc2UxEDAOBgNVBAoMB0VudHJ1
c3QxEDAOBgNVBAsMB25TaGllbGQxGDAWBgNVBAMMD3d3dy5lbnRydXN0LmNvbTAe
Fw0yMTAxMTExOTI5NDBaFw0yMjAxMTExOTI5NDBaMGoxCzAJBgNVBAYTAlVTMQsw
CQYDVQQIDAJGTDEQMA4GA1UEBwwHU3VucmlzZTEQMA4GA1UECgwHRW50cnVzdDEQ
MA4GA1UECwwHblNoaWVsZDEYMBYGA1UEAwwPd3d3LmVudHJ1c3QuY29tMIIBIjAN
BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0/el/YjuScdeGwMEJicEbMWU4LdM
KRjj9Kp66YvjRThrdValJlCMkC5Gu+BRDg02OhPrl11w6z3TfUm0+Aa/BAkhUcec
VO4+6YZf6LXB3cgrkACr/5mxsthTkU218tT2TD6Rlm0phorQqsv3T2tA37URgMYm
h5G6wRuBWrOCbKjncjEzx475NYw0I6oetl97+gZKerKz0YjRvZ2p3IGcV6bSI/u7
r/T10XF9q8sc04kzNd4ssAOMzlkwmN7XKMeayatDSD6HxNAGXMyCaDW52PTLtvcy
rEIonIfufxOdb/322DkUB6LDjQQkq5v9smE9Hw7CeIt0CadJjdkePmiAVwIDAQAB
MA0GCSqGSIb3DQEBCwUAA4IBAQBgbzge0Gekt8xyjAn4v+0nuVm5k2CfQGNoFl+m
w1KeqsVAyRfwBNjRf7ceOfZTQrn1o44eOtTLmFlLfOyiQO2yYky6uJ28Lnv2Ju3A
nZj08Fnyn/AoaPFqAqAJbKffSesLdw8Qf1d9Wcr5mbJcDOiQQKOz/xHE1a9saf5X
7HfP1eN0no1OyjEs03hgxmaTPzB9EK26QpQPzZD99Z0a3O9qbcRboTIUYUF725c1
V1gzCxLABK/k6ahquEPKNxqpb0B+ccrfIhgVMe0x6HsAPi3/epAGj8HQybrG1C6q
A7ghHyWDR8pVrLmuuJmNtilN5woybmD13mqFBJZ3MbGy5zeK
-----END CERTIFICATE-----
subject=/C=US/ST=FL/L=Sunrise/O=Entrust/OU=nShield/CN=www.entrust.com
issuer=/C=US/ST=FL/L=Sunrise/O=Entrust/OU=nShield/CN=www.entrust.com
---
No client certificate CA names sent
Peer signing digest: SHA512
Server Temp Key: ECDH, P-256, 256 bits
---
SSL handshake has read 1543 bytes and written 415 bytes
---
New, TLSv1/SSLv3, Cipher is ECDHE-RSA-AES256-GCM-SHA384
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
Protocol : TLSv1.2
Cipher : ECDHE-RSA-AES256-GCM-SHA384
Session-ID: 381AF3AA705C0769B1E8118A3268621E1AD86176CFEE339D5CE966892D84EF66
Session-ID-ctx:
Master-Key: 5B787BFAC32C85916C85FB57BBE6DC43E36C7D6E4C6F095DD84F07DB642A8A3FE56F9FD789726FE79D9382D647862246
Key-Arg : None
Krb5 Principal: None
PSK identity: None
b. Edit /etc/httpd/conf.d/ssl.conf and change the following lines to use the new
.key and .crt files:
SSLCertificateFile /etc/pki/tls/certs/modulersa.crt
SSLCertificateKeyFile "pkcs11:object=modulersa;token=accelerator"
SSLCryptoDevice pkcs11
Edit the /opt/nfast/cknfastrc file, and add the following information before
proceeding to set up Softcard protection:
2. Create a Softcard:
% ppmk -n apachesoftcard
3. Create a key:
Please wait........
Key successfully generated.
Path to key: /opt/nfast/kmdata/local/key_pkcs11_ucb87f22b0df8d3b72a2f4c654ae1d3b0973b93de8-
ddd20b997d276f3304e0011fc79971344c630b0f
% openssl req -engine pkcs11 -x509 -out softcard.crt -days 365 -key "pkcs11:model=;token=apachesoftcard;pin-
value=123456;object=softcardkey" -keyform ENGINE -subj "/CN=softcardkey"
If it does, make sure you expose the Softcards as described in this section, and run
the command again.
b. Edit /etc/httpd/conf.d/ssl.conf and change the following lines to use the new
.key and .crt files:
SSLCertificateFile /etc/pki/tls/certs/softcard.crt
SSLCertificateKeyFile "pkcs11:object=softcardkey;token=apachesoftcard;type=private?pin-value=123456"
SSLCryptoDevice pkcs11
2. Create a key:
Loading `apacheocs':
Module 1: 0 cards of 1 read
Module 1 slot 0: `apacheocs' #1
Module 1 slot 2: Admin Card #1
Module 1 slot 3: empty
Module 1 slot 0:- passphrase supplied - reading card
Card reading complete.
% openssl req -engine pkcs11 -x509 -out ocskey.crt -days 365 -key
"pkcs11:token=apacheocs;object=ocskey;type=private?pin-value=123456" -keyform engine -subj "/CN=ocskey"
b. Edit /etc/httpd/conf.d/ssl.conf and change the following lines to use the new
.key and .crt files:
SSLCertificateFile /etc/pki/tls/certs/ocskey.crt
SSLCertificateKeyFile "pkcs11:object=ocskey;token=apacheocs;type=private?pin-value=123456"
SSLCryptoDevice pkcs11
3.1. Prerequisites
1. This integration procedure uses two servers:
◦ Server #1 will be used to build the Apache Docker image.
This server will be referred to as "the build machine". It should be the same
server on which you did the Apache PKCS #11 integration.
◦ Server #2 is the server from which you have access to your Kubernetes
environment.
In this guide, this server has Red Hat CodeReady OpenShift installed. This will be
used to deploy the image. This server will be referred to as the "the Kubernetes
server".
2. Security World software is already installed on the build machine. This was
performed during the initial integration, refer to Install the Security World software
and create the Security World.
3. OpenSSL configured on the build machine.
4. nSCOP v1.1 installed on the build machine with Docker.
5. Access to a Kubernetes cluster in the Kubernetes server.
% export OPENSSL_CONF=/etc/pki/tls/openssl.pkcs11.cnf
6. Copy the key file from /opt/nfast/kmdata/local into the kmdl directory in your working
directory:
8. Copy the world and module files from /opt/nfast/kmdata/local into the working/kmdl
directory:
% cp /opt/nfast/kmdata/local/world ~/working/kmdl/.
% cp /opt/nfast/kmdata/local/module_XXXXXX ~/working/kmdl/.
The working/kmdl directory should contain the world file, the module file, the key and
the certificate.pem file. For example:
% ls -al1
% cp certificate.pem /etc/pki/tls/certs/.
SSLCertificateFile /etc/pki/tls/certs/certificate.pem
SSLCertificateKeyFile "pkcs11:object=apachecontainerkey;token=accelerator"
SSLCryptoDevice pkcs11
3. Build the nShield container for the hardserver and application (Red Hat):
% cd /opt/nscop
% sudo ./make-nshield-hwsp --from registry.access.redhat.com/ubi8/ubi --tag nshield-hwsp-pkcs11-redhat /mnt/iso
% sudo ./make-nshield-application --from registry.access.redhat.com/ubi8/ubi --tag nshield-app-pkcs11-redhat
/mnt/iso
% vi Dockerfile
FROM nshield-app-pkcs11-redhat
RUN yum -y install httpd mod_ssl openssl-pkcs11
COPY openssl.cnf /etc/pki/tls/openssl.cnf
COPY ssl.conf /etc/httpd/conf.d/ssl.conf
COPY httpd.conf /etc/httpd/conf/httpd.conf
EXPOSE 9443/tcp
COPY kmdl /opt/nfast/kmdata/local
COPY kmdl/certificate.pem /opt/nfast/kmdata/local/
COPY kmdl/certificate.pem /etc/pki/tls/certs/.
#(for openshift)
RUN chmod 777 /etc/httpd/run
ENTRYPOINT ["/usr/sbin/httpd", "-e", "info", "-D", "FOREGROUND"]
4. Once the build is complete, the new image will be included in the list of Docker
images:
% cd ~/working
% mkdir testimage
% cd testimage
% cp ../kmdl/certificate.pem .
2. In the testimage directory create the abi.sh script. This will be used to test the
performance of the Apache web server when integrated.
vi abi.sh
3. In the testimage, directory create the osc.sh script. This will be used to connect to the
Apache webserver when integrated, to test if the server is using the key and
certificates generated previously.
vi osc.sh
% vi Dockerfile
FROM registry.access.redhat.com/ubi8/ubi
RUN yum -y install net-tools httpd-tools openssl nano
COPY certificate.pem /opt/test/
COPY abi.sh /opt/test/
COPY osc.sh /opt/test/
RUN chmod 777 /opt/test/*.sh
1. Edit the /opt/nscop/config1/config file. Change HSM settings according to the HSM
that is being used and loaded with the Security World that matches your files in
/opt/nfast/kmdata/local.
% sudo vi /opt/nscop/config1/config
syntax-version=1
[nethsm_imports]
local_module=1
remote_esn=201E-03E0-D947
remote_ip=10.194.148.33
remote_port=9004
keyhash=84800d1bfff6515ed5806fe443bbaca812d73733
privileged=1
% osc.sh
CONNECTED(00000003)
Can't use SSL_get_servername
depth=0 CN = apachecontainerkey
verify return:1
---
Certificate chain
0 s:CN = apachecontainerkey
i:CN = apachecontainerkey
---
Server certificate
-----BEGIN CERTIFICATE-----
MIICwTCCAakCFAml778s/6aHXzKK84DsM6cvO2AhMA0GCSqGSIb3DQEBCwUAMB0x
GzAZBgNVBAMMEmFwYWNoZWNvbnRhaW5lcmtleTAeFw0yMTEyMjAxNjQwMjFaFw0y
MjEyMjAxNjQwMjFaMB0xGzAZBgNVBAMMEmFwYWNoZWNvbnRhaW5lcmtleTCCASIw
DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ48W0IR6OD5wcMuQv/aYCWnYa8u
htz+Pq2UiXcmwhd9fSSkeVGHVEOP5+dtdJKjI6DTMwWeFg+u515HLM+rteeQCicD
noXEm/WV8HRffNknznHtKMiOW75UNcsOxuavc0hKCdn/q/Yn5AsBQTbjmUSFQhDQ
Z4saNuN6PSgNJh/grjZilEhuRyh4neAEyiNMBIULXecbnBpoMnMtQLm6PT1IRZQC
QQ3L8yONTPXqiap/hcSdUxOZjaTwL7oDsnTaK42eXOx2MytfSMULw+KTwnCrKYNc
+DLiRCMJsVbdHwFahjMsidnLgheBnc7BN5LAx5rH0a2J1G9lDQv/5UFa+4sCAwEA
ATANBgkqhkiG9w0BAQsFAAOCAQEAaTAWb/jaEicXCvV/80IyDnSyBHSyDT3yKMrW
dEn4O6lUgEwo1tU1MgNHPr7ripKl2UQ4GS7vrntWU7d9k7Rzq2QQB5NkhvC1xzsB
RV/miBKTd4cNGMxfB+zmEWpv82nMKsWjfQmbwPVXoIHcprpCNrJKMBOIempbOsGo
i9Y2xBxJsT8HGZ027j1rB3yMmZHSBFMRHuDRGlPMlFbDmnzsC/6VMvB+iNMA1fgs
az3bKQMYJ7Q3BzwKWV730tAyOcVVk79aRRQBLpohjCBkJqsepuRMP2EP/aPkNJ9S
sgeFjwyrsyZE4SImJQORAThXwDbYbC5cbTknOVLCLkidg+Gfuw==
-----END CERTIFICATE-----
subject=CN = apachecontainerkey
issuer=CN = apachecontainerkey
---
No client certificate CA names sent
Peer signing digest: SHA256
Peer signature type: RSA-PSS
Server Temp Key: X25519, 253 bits
---
SSL handshake has read 1265 bytes and written 369 bytes
Verification: OK
---
New, TLSv1.3, Cipher is TLS_AES_256_GCM_SHA384
Server public key is 2048 bit
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
Early data was not sent
Verify return code: 0 (ok)
---
---
Post-Handshake New Session Ticket arrived:
SSL-Session:
Protocol : TLSv1.3
Cipher : TLS_AES_256_GCM_SHA384
Session-ID: 9EE98D136ABC1E77DC175D590226602E009BFFD76DDD3D2E67E610F10C1504B7
Session-ID-ctx:
Resumption PSK: 32F4D1F4A4BD0CE70A037EB5F773AFF3B19BD88F8127E03E4DB1ED3079917099004F1583C80D8C6F15CA6E0573058AD5
PSK identity: None
PSK identity hint: None
SRP username: None
TLS session ticket lifetime hint: 300 (seconds)
TLS session ticket:
0000 - ef e2 e0 5f 17 7c 72 3b-01 b7 9b 53 f9 73 d7 c9 ..._.|r;...S.s..
0010 - d5 fe b3 cc 03 b8 98 82-b8 3b df 92 fc 00 a1 f6 .........;......
0020 - c3 3e 63 1b f3 27 84 fd-cb 3d 8c a5 89 61 18 1f .>c..'...=...a..
0030 - dd 71 98 9e 19 dd 50 e3-e5 46 81 8b df a9 75 6b .q....P..F....uk
% abi.sh
This script tests performance against the server running in the container.
Concurrency Level: 50
Time taken for tests: 94.090 seconds
Complete requests: 10000
Failed requests: 0
Total transferred: 45170000 bytes
HTML transferred: 42340000 bytes
Requests per second: 106.28 [#/sec] (mean)
Time per request: 470.449 [ms] (mean)
Time per request: 9.409 [ms] (mean, across all concurrent requests)
Transfer rate: 468.82 [Kbytes/sec] received
2. Tag images:
3. Push images:
5. Show images:
7. Show images:
This server will be used to deploy the Kubernetes pod that will run the nShield
Apache application.
Install the latest version of the Security World Software as described in the
Installation Guide for the HSM.
3. Add the HSM used during the Apache container creation as a client to the OpenShift
server.
Install the HSM by following the instructions in the Installation Guide for the HSM.
Once the Kubernetes server has been added as a client in the HSM, enroll the HSM in
the Kubernetes server:
apiVersion: project.openshift.io/v1
kind: Project
metadata:
annotations:
openshift.io/description: ""
openshift.io/display-name: apache
openshift.io/requester: kube:admin
name: apache
spec:
finalizers:
- kubernetes
status:
phase: Active
c. Create the cm.yaml config map YAML file needed by the application. For example:
[nethsm_imports]
local_module=1
remote_esn=201E-03E0-D947
remote_ip=10.194.148.33
remote_port=9004
keyhash=84800d1bfff6515ed5806fe443bbaca812d73733
privileged=1
d. Create the secret.yaml Docker secret YAML file. This contains the required
credentials to pull the container images from the Docker registry being used. For
example:
apiVersion: v1
data:
.dockerconfigjson:
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
kind: Secret
metadata:
creationTimestamp: "2021-09-20T18:40:23Z"
name: regcred
namespace: apache
resourceVersion: "41868365"
selfLink: /api/v1/namespaces/default/secrets/regcred
uid: 96b9d6a4-de30-48cc-9c9a-bbf60730cf92
type: kubernetes.io/dockerconfigjson
e. Create the pod_apache.yaml pod YAML file that will be used to deploy the
application. For example:
- name: nshield-hwsp-pkcs11
image: >-
registry.eselab.net/cv-nshield-hwsp-pkcs11-redhat
imagePullPolicy: Always
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
ports:
- containerPort: 8080
protocol: TCP
resources: {}
volumeMounts:
- name: nscop-config-apache
mountPath: /opt/nfast/kmdata/config
- name: nscop-hardserver
mountPath: /opt/nfast/kmdata/hardserver.d
- name: nscop-sockets
mountPath: /opt/nfast/sockets
- name: nscop-sockets-priv
mountPath: /opt/nfast/sockets-priv
- name: nshield-apache-pkcs11
image: >-
registry.eselab.net/cv-nshield-apache-pkcs11-redhat
imagePullPolicy: Always
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
ports:
- containerPort: 9443
protocol: TCP
resources: {}
volumeMounts:
- name: nscop-sockets
mountPath: /opt/nfast/sockets
securityContext: {}
volumes:
- configMap:
name: nscop-config-apache
defaultMode: 420
name: nscop-config-apache
- name: nscop-hardserver
emptyDir: {}
- name: nscop-sockets
emptyDir: {}
- name: nscop-sockets-priv
emptyDir: {}
% cd yaml
% oc create -f project.yaml
project.project.openshift.io/apache created
% oc project apache
namespace/apache created
% oc create -f secret.yaml
secret/regcred created
configmap/nscop-config-apache created
% oc create -f pod_apache.yaml
pod/nshield-apache-example-9nl74 created
registry.eselab.net/cv-test-nshield-apache-pkcs11-redhat registry.eselab.net/cv-nshield-hwsp-pkcs11-redhat
registry.eselab.net/cv-nshield-apache-pkcs11-redhat
12. Open a debug session on the pod so you can check the Apache application:
% oc debug pod/nshield-apache-example-9nl74
13. In the debug session, run the osc.sh script to check the connection with the Apache
server that is running in the container.
You should see that it is using the key created when you created the Docker
container. In this case, this is the apachecontainerkey key.
sh-4.4# cd /opt/test/osc.sh
CONNECTED(00000003)
Can't use SSL_get_servername
depth=0 CN = apachecontainerkey
verify return:1
---
Certificate chain
0 s:CN = apachecontainerkey
i:CN = apachecontainerkey
---
Server certificate
-----BEGIN CERTIFICATE-----
MIICwTCCAakCFAml778s/6aHXzKK84DsM6cvO2AhMA0GCSqGSIb3DQEBCwUAMB0x
issuer=CN = apachecontainerkey
---
No client certificate CA names sent
Peer signing digest: SHA256
Peer signature type: RSA-PSS
Server Temp Key: X25519, 253 bits
---
SSL handshake has read 1265 bytes and written 369 bytes
Verification: OK
---
New, TLSv1.3, Cipher is TLS_AES_256_GCM_SHA384
Server public key is 2048 bit
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
Early data was not sent
Verify return code: 0 (ok)
---
---
Post-Handshake New Session Ticket arrived:
SSL-Session:
Protocol : TLSv1.3
Cipher : TLS_AES_256_GCM_SHA384
Session-ID: 3FB4E1ACACEB5FC796DBB2EAC0BC92EBFC795AF7199BDAE680CAEBB606DE5D4F
Session-ID-ctx:
Resumption PSK: A41DA3DEBDE08228F09051E6671BCC1D3C0F715AF538D5476342067CDC3BFA717F88A1D3F9AE3DAA8F4AE3B954ADBAD3
PSK identity: None
PSK identity hint: None
SRP username: None
TLS session ticket lifetime hint: 300 (seconds)
TLS session ticket:
0000 - 29 42 88 f9 42 e6 a2 6c-5e c8 82 21 d1 4d 9d 8e )B..B..l^..!.M..
0010 - 58 0f 9d 98 7d 1d 9f cd-b7 1f 44 9f 69 7c b5 c3 X...}.....D.i|..
0020 - 0c 47 e4 18 db a5 7e d4-93 81 d2 46 a1 51 b8 97 .G....~....F.Q..
0030 - 50 cb d7 af ee 1a 4f 07-4c 20 5e 15 ca 7b ce e0 P.....O.L ^..{..
0040 - a8 9f fe 9e 6e 4c 21 21-43 e1 ca ce 0a 79 e0 f2 ....nL!!C....y..
0050 - 76 1c a6 e5 b9 ac eb 77-05 52 7a b0 1a 78 e8 4c v......w.Rz..x.L
0060 - 28 67 6c ef 01 5a 29 04-c8 b6 eb 17 b7 2c a5 8b (gl..Z)......,..
0070 - a7 5b da 33 eb dd 95 3d-58 05 03 b8 43 72 c8 70 .[.3...=X...Cr.p
0080 - cd b1 3c e4 fa 95 92 d4-6f a8 49 4f b3 03 02 53 ..<.....o.IO...S
0090 - 42 6c 7c d5 62 82 ee 01-80 09 cc 44 09 53 e0 25 Bl|.b......D.S.%
00a0 - 98 7a cf 55 9f 2a fb 14-c1 9f ea 20 a3 cc 31 d2 .z.U.*..... ..1.
00b0 - 8c 8d bd 09 4c 30 c2 07-83 b5 c2 5a 34 18 ce 74 ....L0.....Z4..t
00c0 - b8 66 35 1f 6d 41 a3 8a-aa d4 cb e8 97 4e b4 09 .f5.mA.......N..
00d0 - 76 8e 38 5b 9b a4 76 fa-0c 6d 01 a3 dd f6 7a 83 v.8[..v..m....z.
14. In the debug session, run the abi.sh script to check the performance of the Apache
server running in the container:
Concurrency Level: 50
Time taken for tests: 87.555 seconds
Complete requests: 10000
Failed requests: 0
Total transferred: 45170000 bytes
HTML transferred: 42340000 bytes
Requests per second: 114.21 [#/sec] (mean)
Time per request: 437.775 [ms] (mean)
Time per request: 8.755 [ms] (mean, across all concurrent requests)
Transfer rate: 503.81 [Kbytes/sec] received
The integration of Apache using PKC #11 running inside a Kubernetes container is now
complete.
or
/usr/sbin/httpd -e debug -X
4.2. /opt/nfast/cknfastrc
CKNFAST_DEBUG=10
CKNFAST_DEBUGFILE=/path/to/debug/file
CKNFAST_FAKE_ACCELERATOR_LOGIN=1
CKNFAST_LOADSHARING=1
Available slots:
Slot 0 (0x1d622495): 6308-03E0-D947 Rt1
token label : accelerator
token manufacturer : nCipher Corp. Ltd
token model :
token flags : rng, token initialized, PIN initialized, other flags=0x200
hardware version : 0.0
firmware version : 12.50
serial num : 6308-03E0-D947
pin min/max : 0/256
Slot 1 (0x1d622496): 6308-03E0-D947 Rt1 slot 0
(empty)
Slot 2 (0x1d622497): 6308-03E0-D947 Rt1 slot 2
(token not recognized)
Slot 3 (0x1d622498): 6308-03E0-D947 Rt1 slot 3
(empty)
2. Generate a key.
CKNFAST_FAKE_ACCELERATOR_LOGIN=1
This will force a good return when logging in. You can also set this as an
environment variable.
NFKM_recordkey failed 86 13
error: PKCS11 function C_GenerateKeyPair failed: rv = CKR_FUNCTION_FAILED (0x6)
Aborting.
You can query the module protected keys present in security world with the
following command:
4. Simple signing:
a. Create a test file to sign:
% openssl rsautl -engine pkcs11 -keyform engine -inkey "pkcs11:token=accelerator;id=%11%11" -sign -in
inputfile -out signature2
5. Self-signed certificate:
a. Create a self-signed certificate:
% openssl req -engine pkcs11 -keyform engine -key "pkcs11:token=accelerator;object=testrsaopenssl" -x509 -days
365 -subj "/CN=test1111" -out sscert.pem
If you see a message similar to "Can’t load /home/xxxxx/.rnd into RNG", do the
following:
More normal signatures can be created with the digest command such as:
To verify use: