-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement M1 Server Certificates Provisioning API #17
Comments
The configured external certificate management command To execute external commands, the Open5GS framework provides a set of functions such as Need to check if the external commands inherit the required environment variables from the parent Application Function process, so the next step is to prototype this by calling an external |
Tested by calling an external Edit: Subsequently found a flag Then, modified the external |
Started implementing a sample external Certificate Management as an external With this Tried to test the reservation operation, with request query parameter For example, for the M1 client request: |
The root cause of the above problem is that Open5GS does not extract the request URI query parameter from the parsed output of the We need to modify Open5GS to extract and store the query string value in its |
Meanwhile, I will continue to implement other M1 Server Certificates Provisioning operations (e.g. creation). |
You can find an example of extraction as below. Hope it can help you. Thanks! |
@acetcom: Thanks for pointing us to the above code snippet in Just so I understand what I am looking at, is this showing that the HTTP/2 server implementation in Open5GS always attempts to parse out the query parameters from the request URL and stores them in Would you therefore advise @devbbc that he might have better luck interacting with his Application Function using HTTP/2 rather than HTTP/1.1, i.e. by adding the |
Sample output of the creation operation:
Next operation to implement: |
HTTP1.1 is also supporting Query Parameter as below. |
@acetcom - Thanks for the pointers and suggestions. Yes, tested extracting the Query Parameter from both nghttp2 and http/1.1. Had success in both. Found that the query parameters are placed in |
Implemented the reservation operation. The sample output shows a response with mime-type Note that the query parameter requires
|
Implemented the Sample creation and retrieval operation:
|
The function to handle errors relevant to M1 Server Certificates Provisioning API are now handled by the new error functions defined in #37. |
The
Option 2 is implemented. Implementing option 1. |
Implemented option 1 for
|
You'll need to add |
Actually isn't it |
With a custom mustache template and modifications to the openapi generator scripts by @davidjwbbc ,
|
The use of the certificate manager script when sending the certificate and key to the AS was missing, the code was still trying to load this from a local file. I've added a |
Also fixed an issue where the external process calls to the |
The retrieveServerCertificate M1 request returns a 500 error when the certificate has been reserved but not uploaded, it should return 204. This is my fault as I'd put that response under "deleteServerCertificate" in the main text of this issue rather than "retrieveServerCertificate" where it should have been. This has now been corrected, but the corresponding alteration to the code needs to be made too. |
Modified the AF to return 204 for the retrieveServerCertificate M1 request when the certificate has been reserved but not uploaded, |
@devbbc, your code changes threw away previous bug fixes and code improvements due to an incorrectly handled conflict in git. Please revise your code changes to include the bug fixes and code improvements from the previous version. |
Tested the new code and this now looks good. |
Specification
In this reference implementation, each Server Certificate resource shall be uniquely identified by a UUID that is assigned by the 5GMS AF at the point of creation.
Design
The API for server certificates provisioning at M1 requires the use of SSL functions for creating private keys, certificate signing requests and public certificates.
We have two choices:
The second option gives us more choice when it comes to installation and configuration and would allow us to create more complex demonstrations or have an AF instance running in a 5G-MAG administered cloud instance that would be able to configure AS instances with certificates able to be authenticated by any browser. Therefore the rest of this design will focus on the design of the external certificate manage process and use when dealing with M1 server certificate requests.
External Certificate Management
This should be able to manage a local or remote repository of certificates and keys depending upon the implementation.
Syntax:
Common return codes:
0 = Success
1 = Problem with command line parameters
2 = Problem with certificate/key management
Other return codes may be used by specific commands to signal other issues, please see the individual commands for supplementary meanings for return codes.
ETag
s for locally stored CSR and public PEM certificates shall be the SHA256 hash of the CSR or public PEM certificate as a hexadecimal string. For externally managed certificates the provided ETag may be passed through, if no ETag is provided then the SHA256 of the public PEM certificate will be used.newcsr
This operation will generate a private key in the store and use it to create a CSR. An
ETag
,Last-Modified
andCache-Control
header will be output to stdout followed by the CSR in PEM format.The CSR will include the commonName as the CN field in the subject and the commonName and altNames will be included as
DNS:
entries in the subject alternative names extension.Extra return codes:
3 - Already a certificate or CSR using that id.
newcert
This operation will generate a private key and public certificate in the store.
The public certificate will include the commonName as the CN field in the subject and the commonName and altNames will be included as
DNS:
entries in the subject alternative names extension.Use the publiccert or servercert commands to retrieve the public certificate (and private key).
Extra return codes:
3 - Already a certificate or CSR using that id.
publiccert
Output the public certificate for the given id. This will output an
ETag
,Last-Modified
(with the modification timestamp of the certificate in IMF date-time format as defined in RFC 7231) and aCache-Control
header, followed by the public certificate which then may be followed by zero or more intermediate CA certificates in PEM format to stdout. If the id refers to anewcsr
certificate that has not been uploaded usingsetcert
, then return with exit code 8. If the id is not found then return with exit code 4.Extra return codes:
4 - Certificate not found
8 - Public Certificate not yet available.
servercert
Output the private key and public certificate for the given id. This will output the public certificate and private key first which then may be followed by zero or more intermediate CA certificates in PEM format to stdout.
Extra return codes:
4 - Certificate not found
setcert
This command accepts a signed pubic certificate in PEM format on stdin which will be checked and stored with the private key for the same id. The incoming certificate will be checked to see that the key matches the private key registered against this id. It is also an error to use this command to set a certificate for an id that did not use
newcsr
to generate a CSR, or one where a public certificate has already been registered.Extra return codes:
3 - Already a certificate or CSR using that id.
4 - Id not found
5 - No CSR issued
6 - Key does not match the private key
revoke
Revoke a public certificate and private key pair. This will mark the public certificate and private key, identified by id, as revoked and cause an update to any CRL associated.
Extra return codes:
4 - Certificate not found
7 - Certificate already revoked
delete
This will revoke and delete a public certificate and private key pair from the store. If the certificate has not previously been revoked, then it is revoked and will cause a CRL update. The public certificate and private key are then removed from the key store.
list
This lists the id and subject of private keys and certificates in the store. If any ids are given then the list is limited to those ids, if one or more of those ids cannot be found then the command will use return code 4.
The output list will be a tab separated list of certificate id, certificate subject (if available) and comma separated flags ("revoked", "expired", "awaiting"), e.g.:
The example shows:
newcsr
, that is still awaiting a certificate upload viasetcert
.msas-test
msas01
msas01
msas01
Extra return codes:
4 - Certificate not found
M1 ServerCertificatesProvisioning API
In all these
${CertMgmt}
represents the configured external certificate management command.createOrReserveServerCertificate
If the request query parameter
csr
istruepresent then this is a reservation operation; otherwise it a creation operation.reservation
${CertMgmt} -c newcsr ${uuid} ${canonicalDomainName}
(if canonicalDomainName is not known at this point use "localhost") and capture the stdout.Etag
,Last-Modified
andCache-Control
headers from the captured stdout to the M1 client response and return the rest of the captured stdout as the body of the response with mime-type "application/x-pem-file" and status code 200. TheLocation
header shall be used to return the resource path with the chosen UUID.creation
${CertMgmt} -c list
and look for a subject with aCN
field of${canonicalDomainName}
in the stdout.Location
header and respond with a 200 status code. No further processing is required for this request.${CertMgmt} -c newcert ${uuid} ${canonicalDomainName}
.Location
header set to the resource path including the generated UUID, there is no body data with this response.uploadServerCertificate
${CertMgmt} -c setcert ${certificateId}
and push the request body to stdin.retrieveServerCertificate
${CertMgmt} -c publiccert ${certificateId}
and capture the stdout.ETag
,Last-Modified
andCache-Control
headers, and the public PEM certificate(s) from the captured stdout as the body of the message.destroyServerCertificate
${CertMgmt} -c delete ${certificateId}
.Providing the certificate and key to the AS
Use the command
${CertMgmt} -c servercert ${certificateId}
to retrieve the private key and public certificate(s) from the store as stdout. Use the captured stdout in the M3 interface to provide the certificate to the AS using the UUID certificate ID.Relevant specifications
The text was updated successfully, but these errors were encountered: