Can this OID notificate the expired certificates for SSL decryption and Global Protect?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Palo Alto Networks Approved
Palo Alto Networks Approved
Community Expert Verified
Community Expert Verified

Can this OID notificate the expired certificates for SSL decryption and Global Protect?

L1 Bithead

Hi,

 

I found the below OID in SNMP Trap.
Can this OID notificate the expired certificates for SSL decryption and Global Protect?

 

https://knowledgebase.paloaltonetworks.com/KCSArticleDetail?id=kA14u000000HBfzCAG

====
panCryptoCertExpiryTrap  .1.3.6.1.4.1.25461.2.1.3.2.0.100  Certificate expired
====

 

Best regards,
MasaW

1 accepted solution

Accepted Solutions

Cyber Elite
Cyber Elite

@MasaW,

This will not generate alerts for anything other than the device management certificate. You can automate these checks easily through some API calls and have whatever alert interval you wish, I've found this to work better than anything you can do natively.

 

A brief example of how you would do this, note that I specifically don't give working examples of scripts as someone implementing them needs to be able to maintain them.

#Collect the current certificates#
Get_Cert_List = requests.get('https://' + str(myFirewallUrl) + '/api/?type=config&action=get&xpath=/config/shared/certificate',headers=headers)

#Take the return and parse it#
Certificate_Dict = xmltodict.parse(Get_Cert_List.content)

Certificates = Certificate_Dict['response']['result']['certificate']['entry']
for Certificate in Certificates:
    Certificate_Name = Certificate['@name']
    Certificate_Expiration = Certificate['not-valid-after']
    Certificate_ExpiryEpoch = Certificate['expiry-epoch']
    Expiration_Date = datetime.datetime.fromtimestamp(int(Certificate_ExpiryEpoch))
    Current_Date = datetime.datetime.now()
    Date_Delta = Expiration_Date - Current_Date
    Day_Count = Date_Delta.days
    if Day_Count <=30:
        Alert_Certificate_Expiration(Certificate_Name=str(Certificate_Name),Certificate_Expiration=str(Certificate_Expiration),Date_Delta=str(Day_Count),NoAlert=NoAlert)

This should give you enough of an example if you choose to do this through the API that is more adaptable to what you specifically want. 

View solution in original post

1 REPLY 1

Cyber Elite
Cyber Elite

@MasaW,

This will not generate alerts for anything other than the device management certificate. You can automate these checks easily through some API calls and have whatever alert interval you wish, I've found this to work better than anything you can do natively.

 

A brief example of how you would do this, note that I specifically don't give working examples of scripts as someone implementing them needs to be able to maintain them.

#Collect the current certificates#
Get_Cert_List = requests.get('https://' + str(myFirewallUrl) + '/api/?type=config&action=get&xpath=/config/shared/certificate',headers=headers)

#Take the return and parse it#
Certificate_Dict = xmltodict.parse(Get_Cert_List.content)

Certificates = Certificate_Dict['response']['result']['certificate']['entry']
for Certificate in Certificates:
    Certificate_Name = Certificate['@name']
    Certificate_Expiration = Certificate['not-valid-after']
    Certificate_ExpiryEpoch = Certificate['expiry-epoch']
    Expiration_Date = datetime.datetime.fromtimestamp(int(Certificate_ExpiryEpoch))
    Current_Date = datetime.datetime.now()
    Date_Delta = Expiration_Date - Current_Date
    Day_Count = Date_Delta.days
    if Day_Count <=30:
        Alert_Certificate_Expiration(Certificate_Name=str(Certificate_Name),Certificate_Expiration=str(Certificate_Expiration),Date_Delta=str(Day_Count),NoAlert=NoAlert)

This should give you enough of an example if you choose to do this through the API that is more adaptable to what you specifically want. 

  • 1 accepted solution
  • 443 Views
  • 1 replies
  • 0 Likes
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!