<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Certificate Expiry in General Topics</title>
    <link>https://live.paloaltonetworks.com/t5/general-topics/certificate-expiry/m-p/581182#M116340</link>
    <description>&lt;P&gt;Any suggestions on this please?&lt;/P&gt;</description>
    <pubDate>Thu, 21 Mar 2024 11:59:56 GMT</pubDate>
    <dc:creator>Sanjay_Ramaiah</dc:creator>
    <dc:date>2024-03-21T11:59:56Z</dc:date>
    <item>
      <title>Certificate Expiry</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/certificate-expiry/m-p/581015#M116325</link>
      <description>&lt;P&gt;Hi Team,&lt;/P&gt;
&lt;P&gt;May i know how to set the certificate expiry alerts to emails or any other option to get alerts on certificate expiry?&lt;/P&gt;
&lt;P&gt;Forward trust certificate used for SSL Decryption i need to get alerts for, so please suggest.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Sanjay S&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Mar 2024 10:07:57 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/certificate-expiry/m-p/581015#M116325</guid>
      <dc:creator>Sanjay_Ramaiah</dc:creator>
      <dc:date>2024-03-20T10:07:57Z</dc:date>
    </item>
    <item>
      <title>Re: Certificate Expiry</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/certificate-expiry/m-p/581182#M116340</link>
      <description>&lt;P&gt;Any suggestions on this please?&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2024 11:59:56 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/certificate-expiry/m-p/581182#M116340</guid>
      <dc:creator>Sanjay_Ramaiah</dc:creator>
      <dc:date>2024-03-21T11:59:56Z</dc:date>
    </item>
    <item>
      <title>Re: Certificate Expiry</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/certificate-expiry/m-p/581247#M116352</link>
      <description>&lt;P&gt;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/249853"&gt;@Sanjay_Ramaiah&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;The firewall itself doesn't have the ability to alert you to certificates that are about to expire. It's a relatively easy thing to script using the API to check all certificates on the firewall and pull the expiry-epoch to get the certificate expiration and trigger alerts for any expiring at a specified interval from the current date.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;api/?type=config&amp;amp;action=get&amp;amp;xpath=/config/shared/certificate&lt;/LI-CODE&gt;
&lt;P&gt;The above is an example of getting the shared certificates present on a firewall. If you create a dictionary of the result you can focus the individual certificates and read the results and analyze them fairly simply. &lt;/P&gt;
&lt;LI-CODE lang="python"&gt;## Collects the shared certificate list from the firewall ##
Cert_List = requests.get('https://&amp;lt;firewall&amp;gt;/api/?type=config&amp;amp;action=get&amp;amp;xpath=/config/shared/certificate',headers=headers)

## Make a dictionary from the result ##
Certificate_Dict = xmltodict.parse(Cert_List.content)

## Analyze the Certificates ##
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 &amp;lt;=30:
            Alert_Certificate_Expiration(Certificate_Name=str(Certificate_Name),Certificate_Expiration=str(Certificate_Expiration),Date_Delta=str(Day_Count),NoAlert=NoAlert)
        else:
            log_collector.debug(Certificate_Name + " : Certificate is valid until " + str(Certificate_Expiration))&lt;/LI-CODE&gt;
&lt;P&gt;Obviously this is a snip of a much larger script that contains components that won't allow this to just be copied and pasted and ran successfully, but the base of what you're trying to do is all present. &lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2024 19:40:22 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/certificate-expiry/m-p/581247#M116352</guid>
      <dc:creator>BPry</dc:creator>
      <dc:date>2024-03-21T19:40:22Z</dc:date>
    </item>
  </channel>
</rss>

