5G-MAG / rt-5gms-application-provider

The 5GMS Application Provider interacts with the 5GMS Application Function via M1 Provisioning interface, and uses M8 interface to communicate with UE.
Other
2 stars 4 forks source link

Memory bug in the m1-session module #53

Closed stojkovicv closed 3 weeks ago

stojkovicv commented 1 month ago

Description

During implementation of the new WebUI endpoint to list ID values for Server Certificates, I noticed that the M1Session method provisioningSessionCertificateIds() always retrieves an empty list, even after successful creation of the Server Certificate for the certain Provisioning Session.

Reproduce

I've added debugging statement (cert_ids = await session.provisioningSessionCertificateIds(args.provisioning_session)) to the cmd_show_certificate from the m1_session.py wrapper, to show the output of the provisioningSessionCertificateIds(). Then i rebuilt the Python module to apply the changes in the executables: sudo python3 -m pip install ./python

  1. Clear the cache: rm -rf ~/rt-5gms-application-function/install/var/cache/rt-5gms/af/certificates
  2. Run the Application Function: ~/rt-5gms-application-function/install/bin/open5gs-msafd
  3. Create a Provisioning Session: m1-session new-provisioning-session -e MyAppId -a MyASPId
  4. Generate Server certificate for the Session: m1-session new-certificate -p ${provisioning_session_id}
  5. Display the details of the certificate and check debugging statement: m1-session show-certificate -p ${provisioning_session_id} -c ${certificate_id}

This is the result:

Certificate details for f9a4cf16-58dc-41ef-8bfc-d7aaf8f810a4:
  Serial = 536527347721373543460540976802317932831362325209
  Not before = 2024-08-12 18:59:17+00:00
  Not after = 2024-11-10 18:59:17+00:00
  Subject = C=GB,L=London,CN=localhost
            key=3F:50:9B:69:68:EB:98:8E:8E:40:D3:D7:6B:E2:E4:6F:E9:2A:D1:A6
  Issuer = C=GB,L=London,CN=localhost
           key=3F:50:9B:69:68:EB:98:8E:8E:40:D3:D7:6B:E2:E4:6F:E9:2A:D1:A6
  Subject Alternative Names:
    DNS:localhost

 Output of provisioningSessionCertificateIds function: 

Theoretically, this function is supposed to retrieve the same ID value (f9a4cf16-58dc-41ef-8bfc-d7aaf8f810a4)

dsilhavy commented 1 month ago

Check if this is already fixed in #51

davidjwbbc commented 3 weeks ago

Fix for incorrect certificates cache management in M1Session was merged in PR #56