You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 38 Next »


Overview

The goal of this requirement is to implement new micro-service called CertService which will request certificates signed by external Certificate Authority (CA) using CMP over HTTP protocol. Uses CMPv2 client to send and receive CMPv2 messages. 

CertService's client will be also provided so other ONAP components (aka end components) can easily get certificate from CertService. End component is an ONAP component (e.g. DCAE collector or controller) which requires certificate from CMPv2 server to protect external traffic and uses CertService's client to get it.

CertService's client communicates with CertService via REST API, while CertService with CMPv2 server via CMP over HTTP.

To proof that CertService works Open Source CMPv2 server (EJBCA) will be deployed and used in E2E tests.

It is planned that Network Functions (aka xNFs) will get certificates from the same CMPv2 server and the same CA hierarchy, but will use own means to get such certificates. Cause xNFs and ONAP will get certificates signed by the same root CA and will trust such root CA, both parties will automatically trust each other and can communicate with each other.

Architecture sketch

certservice_high_level


Simplified certificate enrollment flow

certService_cert_enrollment_flow

Components description

CertService

REST API

MethodEndpointParameterReturned values


NameIs required?Transfer methodDescriptionNameAlways returned?Transfer methodDescription
GET

/certificate/{caName}

CA nameYesPath parameterName of Certificate Authority which should sign sent CSR. Must match CertService's CMPv2 servers configuration.Certificate chainYesBody (JSON)Signed certificate with whole certificate chain (intermediate CA certificates).
Base64 encoded CSR (Certificate Signing Request)YesHeaderCertificate Signing Request for given componentTrusted certificatesYesBody (JSON)Trusted certificates. In other words list of root CAs which should be treated as trust anchors. Must contain root CA which was used to sign certificate and may contain other root CAs.
Base64 encoded private keyYesHeaderPrivate key. Needed to create proof of possession (PoP)




CMPv2 server properties

CertService contains configuration of CMPv2 servers. To enroll certificate at least one CMPv2 server has to be configured. CMPv2 server configuration is read during CertService startup and runtime changes require (question) CertService restart.

Section holds all properties which are planned to be supported by CertService for CMPv2 based server.


Parameter nameRequiredSyntaxDescriptionValidation rules
CA NameYesString (1-128)The CA name should include the name of the external CA server and the issuerDN, which is the distinguished name of the CA on the external CA server that will sign our certificate.

String (1-128)

URLYesSchema + IPv4/FQDN + port + path

Url to CMPv2 server; includes mandatory parts: scheme (http://) and IPv4/FQDN and optional parts: port and path (alias); e.g. http://127.0.0.1:8080/pkix or http://127.0.0.1/ejbca/publicweb/cmp/cmp


NOTE: If FQDN is given ONAP must be able to resolve it

Must be correct URL

Must start with http:// scheme

If port given, port from 1-65535 range

Issuer DNYesString (4-256)Distinguished Name of the CA that will sign the certificate on the CMPv2 server side. When creating an end entity on the external CA server for client mode this IssuerDN will be passed through as the ca to sign for that user.

String (4-256)

Correct DN

CA ModeYesEnum (CLIENT|RA)Issuer mode (either Registration Authority (RA) or client mode)

Value from predefined set

Authentication data::IAKYesString (1-256)Initial authentication key, used, together with RV, to authenticate request in CMPv2 server

String (1-256)

Authentication data::RVYesString (1-256)Reference value, used, together with IAK, to authenticate request in CMPv2 server

String (1-256)


CMPv2 client

Input table for CMPv2 client

CMPv2 will get two POJOs: first with CSR, fields extracted from CSR (like plain Common Name, Country, etc), private key and CA name (data mapped from REST API call) and second with CMPv2 server details.

(warning) More info TBA (warning)



Currently the POC for CMPv2 client is working based on the inputs below.

Input Values

Input Type

Description

Usage

csrMetaobjectcsrMeta object from aaf, would contain values needed for certificate request. any needed values that should be stored in the csrMeta will be mentioned below.stores all pertinent values for certificate request - these will be detailed below, and should be set before being passed to the cmpv2 client.
csrMeta:IssuerDnorg.bouncycastle.asn1.x500.X500Namedistinguished name of the CA we're receiving certificate from. Cannot be nullused in the creation of the cert on EJBCA server
csrMeta: SubjectDnorg.bouncycastle.asn1.x500.X500NameDistinguished name of the Entity the certificate is being issued to/ Certificate Requesting Entity. Cannot be null.used in the creation of the cert on EJBCA server
csrMeta: KeyPairjava.security.KeyPairKeyPair associated with the entity the certificate is being issued to. Cannot be nullused to create proof of possession for request to EJBCA server
csrMeta: Passwordobject which contains iak/rv?secret password value shared by EJBCA server. Cannot be nullused to authenticate ourselves to the EJBCA serve

csrMeta: CA Details

objectCertification Authority Details ( Http address, Port number and Path (which includes alias if used)). Cannot be nullused to Post Http request to External CA.

.cer file

java.security.cert.X509Certificate.cer (CSR) generated by Cert-man using Key-pair. Cannot be null.

used to validate response (.crt)/ certificate send from EJBCA server

caNamestringthe name which is a general description of the external CAused for debugging purposes
caModeenumstring noting whether the server we are contacting will be operating in either client or RA modeused for debugging purposes


Relevant values in Certificate Request message to EJBCA:

Value

Description

Information Included

PKIHeaderContains information common to many PKI messages.

SenderDN

IssuerDN

ProtectionAlgorithm (used for PkiProtection below)

PKIBodycontains message-specific information ie. certificate request message

CertificateRequestMessage, which includes:

SubjectDN

IssuerDN

SubjectPublicKey

PKIProtectioncontains bits that protect PKImessage (Specifically the iak/rv)



Test code for running cmpv2 client against EJBCA server through unit test

@Test
    public void testServerWithRealUrl()
        throws CmpClientException {

        setValidCsrMetaValuesAndDateValues();

        csrMeta.externalCaUrl("http://127.0.0.1/ejbca/publicweb/cmp/cmpSubRA");
        csrMeta.password("mypassword");

        CmpClientImpl cmpClient = new CmpClientImpl();
        try {
            cmpClient.createCertRequest("data", "RA", csrMeta, cert, notBefore, notAfter);
        } catch (CAOfflineException e) {
            e.printStackTrace();
        }
    }

    private void setValidCsrMetaValuesAndDateValues() {
        ArrayList<RDN> rdns = new ArrayList<>();
        try {
            rdns.add(new RDN("O=CommonCompany"));
        } catch (CertException e) {
            e.printStackTrace();
        }
        csrMeta = new CSRMeta(rdns);
        csrMeta.cn("Node123");
        csrMeta.san("CommonName.com");
        csrMeta.password("password");
        csrMeta.email("CommonName@cn.com");
        csrMeta.issuerCn("subCA");
        when(kpg.generateKeyPair()).thenReturn(keyPair);
        csrMeta.keypair(trans);
        csrMeta.externalCaUrl("http://127.0.0.1/ejbca/publicweb/cmp/cmp");

        try {
            notBefore =  Optional.ofNullable(new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").parse("2019/11/11 12:00:00"));
            notAfter =  Optional.ofNullable(new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").parse("2020/11/11 12:00:00"));
        } catch (ParseException e) {
            e.printStackTrace();
        }
    }



CertService's client

CertService's client properties

GroupParameter nameENV variable nameRequiredDefaultSyntaxDescriptionOrigin

Timeout
No30s
Timeout for REST API callsApplication helm chart

Path
Yes

Path where client will output generated keystore and truststore. Normally this path should be on a volume which is used to transfer keystore and truststore between CertService's client and end componentApplication helm chart

CA name
Yes

Name of CA which will enroll certificate. Must be same as configured on server side. Used in REST API callsOOM global value





CSR details

Common Name
Yes

Common name for which certificate from CMPv2 server should be issuedApplication helm chart
Organization
Yes

Organization for which certificate from CMPv2 server should be issuedOOM global value
Organization Unit
No

Organization unit for which certificate from CMPv2 server should be issuedOOM global value
Location
No

Location for which certificate from CMPv2 server should be issuedOOM global value
State
Yes

State for which certificate from CMPv2 server should be issuedOOM global value
Country
Yes

Country for which certificate from CMPv2 server should be issuedOOM global value
SANs
No

Subject Alternative Names (SANs) for which certificate from CMPv2 server should be issuedApplication helm chart

Usage

Cause ONAP is deployed in K8s, CertService's client will be delivered as independent container and should run as init container for end component. Both init container and end component must mount the same volume (persistent or ephemeral) to transfer generated artifacts.

Within you K8s workload add CertService's client as init container:

Make sure you pass as ENV variables all required parameters.

Mount to init container and your application container the same volume.

CMPv2 server

For testing purpose EJBCA is set up. It is configured with 2 layer CA hierarchy (root CA and intermediate CA).

EJBCA Setup Script

ejbcaSetup.sh

  • No labels