Announcement

Collapse
No announcement yet.

Getting a new ssl/ttl error on my pollen/flu script

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Getting a new ssl/ttl error on my pollen/flu script

    I started getting an ssl/ttl error on my pollen/flu script a few days ago.

    Error:
    Code:
    Exception has been thrown by the target of an invocation.The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
    I can still access the json file from flustar.com using cURL and its format hasn't changed. I'm assuming they have changed their security protocol for their https.

    I tried adding this line of code
    Code:
    System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12
    in the script but it didn't seem to help.

    Not sure what else I can try to get this to work.

    Anyone have any ideas?

    Code:
     Imports System.Web.Script.Serialization
    Sub Main(ByVal Parms As Object)
    
    
    Dim fluIndex As Decimal
    Dim coughIndex As Decimal
    Dim strepIndex As Decimal
    Dim feverIndex As Decimal
    Try
    ' Create a WebRequest to the remote site, specifying Referer and UserAgent
    Dim getRequest As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("https://www.flustar.com/api/forecast/current/cold/80908")
    getRequest.Referer="https://www.flustar.com/api/forecast/current/cold/80908"
    getRequest.UserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36"
    Dim getResponse As System.Net.HttpWebResponse = getRequest.GetResponse()
    
    If getResponse.StatusCode = System.Net.HttpStatusCode.OK Then
    ' Parse the contents from the response to a stream object
    Dim stream As System.IO.Stream = getResponse.GetResponseStream()
    
    ' Create a reader for the stream object
    Dim reader As New System.IO.StreamReader(stream)
    
    ' Read from the stream object using the reader, put the contents in a string
    Dim contents As String = reader.ReadToEnd()
    
    ' Save JSON string into a JSON file
    My.Computer.FileSystem.WriteAllText(hs.GetAppPath & "\html\json\Flu.json", contents, False)
    
    ' Convert JSON string to object
    Dim jsonData As Object = New JavaScriptSerializer().Deserialize(Of Object)(contents)
    
    ' Get Flu Index
    fluIndex = CDec(jsonData("Location")("periods")("0")("Triggers")("0")(" Index"))
    
    ' Get Fever Index
    feverIndex = CDec(jsonData("Location")("periods")("0")("Triggers")("1")(" Index"))
    
    ' Get Strep Index
    strepIndex = CDec(jsonData("Location")("periods")("0")("Triggers")("2")(" Index"))
    
    ' Get Cough Index
    coughIndex = CDec(jsonData("Location")("periods")("0")("Triggers")("3")(" Index"))
    
    
    End If
    
    hs.SetDeviceValuebyRef (4034, fluIndex, True)
    hs.SetDeviceString(4034, fluIndex.ToString & " out of 12", True)
    hs.SetDeviceLastChange(4034, now)
    
    hs.SetDeviceValuebyRef (4035, feverIndex, True)
    hs.SetDeviceString(4035, feverIndex.ToString & " out of 12", True)
    hs.SetDeviceLastChange(4035, now)
    
    hs.SetDeviceValuebyRef (4036, strepIndex, True)
    hs.SetDeviceString(4036, strepIndex.ToString & " out of 12", True)
    hs.SetDeviceLastChange(4036, now)
    
    hs.SetDeviceValuebyRef (4037, coughIndex, True)
    hs.SetDeviceString(4037, coughIndex.ToString & " out of 12", True)
    hs.SetDeviceLastChange(4037, now)
    
    Catch ex As Exception
    
    hs.SetDeviceValuebyRef (4034, -1, True)
    hs.SetDeviceString(4034, "Error Retrieving Data", True)
    hs.SetDeviceLastChange(4034, now)
    
    hs.SetDeviceValuebyRef (4035, -1, True)
    hs.SetDeviceString(4035, "Error Retrieving Data", True)
    hs.SetDeviceLastChange(4035, now)
    
    hs.SetDeviceValuebyRef (4036, -1, True)
    hs.SetDeviceString(4036, "Error Retrieving Data", True)
    hs.SetDeviceLastChange(4036, now)
    
    hs.SetDeviceValuebyRef (4037, -1, True)
    hs.SetDeviceString(4037, "Error Retrieving Data", True)
    hs.SetDeviceLastChange(4037, now)
    
    hs.writelog("Error", "Error retrieving Flu Data.")
    
    End Try
    
    End Sub

    #2
    Probably nothing wrong with your script. it looks like flustar's SSL certificate has expired.
    Jon

    Comment


      #3
      Thanks Jon

      Didn't think to check that.

      Comment


        #4
        I checked and it looks like they updated their certificate on 1/19/22. That is the last day I was able to access. It says they are up to date according to digicert.com check site:

        DNS resolves flustar.com to 54.85.1.141


        HTTP Server Header: Microsoft-IIS/8.5
        TLS Certificate


        Common Name = Flustar.com

        Organization = IQVIA Inc

        City/Locality = Collegeville

        State/Province = Pennsylvania

        Country = US

        Subject Alternative Names = Flustar.com, www.Flustar.com

        Issuer = DigiCert TLS RSA SHA256 2020 CA1

        Serial Number = 06ED7158A982A4B88C72C5BE16D72BC4

        SHA1 Thumbprint = 2F2C0F7ECBD93134A80FEE239E49FB8A4C72410D

        Key Length = 2048

        Signature algorithm = SHA256-RSA

        Secure Renegotiation:
        TLS Certificate has not been revoked
        OCSP Staple: Not Enabled
        OCSP Origin: Good
        CRL Status: Good
        TLS Certificate expiration


        The certificate expires February 2, 2023 (373 days from today)
        Certificate Name matches flustar.com
        Subject Flustar.com
        Valid from 19/Jan/2022 to 02/Feb/2023
        Issuer DigiCert TLS RSA SHA256 2020 CA1
        Subject DigiCert TLS RSA SHA256 2020 CA1
        Valid from 24/Sep/2020 to 23/Sep/2030
        Issuer DigiCert Global Root CA
        TLS Certificate is correctly installed


        Congratulations! This certificate is correctly installed.

        Comment


          #5
          This is what I get here on Firefox and Chrome:

          Click image for larger version

Name:	Capture.PNG
Views:	114
Size:	30.6 KB
ID:	1523179Click image for larger version

Name:	Capture1.PNG
Views:	89
Size:	25.7 KB
ID:	1523180
          Jon

          Comment


            #6
            Well they finally fixed their certification after almost two weeks. The script started working again.

            An acquaintance of mine said his similar python script never failed through this and I was about to put "learn python" on my to do list.

            Comment

            Working...
            X