The sudo globalprotect CLI command is not importing client certificate on Ubuntu
5149
Created On 12/21/23 18:48 PM - Last Modified 12/21/23 18:50 PM
Question
A logged-in user wants to import a client certificate in the GP App on Ubuntu/Linux but when the command sudo globalprotect is run, it does not import the certificate, gets stuck, and does not give any results.
$ sudo globalprotect import-certificate --location ~/cert_Client-Cert.p12 [sudo] password for user1: Please input passcode:
Environment
GlobalProtect App
Ubuntu/Linux
Answer
The GlobalProtect has a process named PanGPA that runs in the user context. For example, if you logged in as user1, the PanGPA runs in user1 context.
~$ id uid=1000(user1) gid=1000(user1) groups=1000(user1),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),116(lxd) $ ps -ef | grep PanGPA user1 375660 375651 0 18:02 ? 00:00:00 /opt/paloaltonetworks/globalprotect/PanGPA start
The PanGPA.log under ~/.GlobalProtect/ directory shows the process ID (pid) of running PanGPA and the uid of user it's running with
P375660-T1160189760 12/21/2023 18:02:24:791 Info ( 236): ################### main - PanGPA started. pid = 375660. ################# # P375660-T1160189760 12/21/2023 18:02:24:791 Debug( 163): Current login user is user1. ... P375660-T1160189760 12/21/2023 18:02:24:913 Debug(2348): SetupDBusEnv: UID = 1000
The PanGPA accepts the globalprotect CLI commands running in the same user context and validates the uid.
When the globalprotect command is run in another user context or as sudo (uid 0), the command will fail or stuck and PanGPA.log will show an error
- Command run as sudo $ sudo globalprotect import-certificate --location ~/cert_Client-Cert.p12 [sudo] password for user1: Please input passcode: - PanGPA.log P375660-T1048561408 12/21/2023 18:33:33:785 Debug(1011): GpiCommandProc - received message: <request><type>import-certificate</type><uid>0</uid><client-cert-path>/home/user1/cert_Client-Cert-2.p12</client-cert-path><client-cert-passcode>********</client-cert-passcode></request> P375660-T1048561408 12/21/2023 18:33:33:786 Debug( 217): handleUIData - uid did not match gpi's uid. return.
Conclusion: The behavior is expected and as per design, please run the globalprotect CLI command in the same user context where PanGPA has been running in
Additional Information
GlobalProtect Admin Guide: Download and Install the GlobalProtect App for Linux