Cannot receive texts from secure website ...

For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
_phillip
 
Posts: 313
Joined: Fri Apr 09, 2021 3:28 pm

Cannot receive texts from secure website ...

Post by _phillip »

When I say 'secure' I mean https and not http. This may not be my problem, but I have tried for days to solve this issue and nothing works. I can receive texts from one of my websites:
http://an_example_link.com
but never from this site:
https://www.not_the_real_link.org

Note. I am the admin for both of these sites.

The obvious difference between these sites being the https and the .org

Here is the pertinent code I am using successfully to send texts:

Code: Select all

const char server[] = "www.an_example_link.com";
void loop() {
    
    WiFi.setPins(WINC_CS, WINC_IRQ, WINC_RST, WINC_EN);

     postData = postVariable + " 7.5 feet";

    if (client.connect(server, 80)) {
      client.println("POST /includes/send_text.php HTTP/1.1");
      client.println("Host: www.an_example_link.com");
      client.println("Content-Type: application/x-www-form-urlencoded");
      client.print("Content-Length: ");
      client.println(postData.length());
      client.println();
      client.print(postData);
      Serial.println("Email Sent");
      Serial.println(postData);
    }
    if (client.connected()) {
      client.stop();
    }
  Serial.println(postData);
  delay(3000);
}
The sketch - as seen above - sends texts without fail. But if I change the code from:

Code: Select all

const char server[] = "www.an_example_link.com";
client.println("POST /includes/send_text.php HTTP/1.1");
client.println("Host: "www.an_example_link.com");
to the following:

Code: Select all

const char server[] = "www.not_the_real_link.org";
client.println("POST /includes/send_text.php HTTP/1.1");
client.println("Host: "www.not_the_real_link.org");
the texts are never sent.

My question is this: What code must be changed so that I can receive texts from this secure website?

Any help will be greatly appreciated.

Thank you.

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: Cannot receive texts from secure website ...

Post by mikeysklar »

You will need to upload certificates.

https://learn.adafruit.com/adafruit-win ... rtificates

User avatar
_phillip
 
Posts: 313
Joined: Fri Apr 09, 2021 3:28 pm

Re: Cannot receive texts from secure website ...

Post by _phillip »

@mikeysklar

Thank you SO MUCH for your comments.

I do not fully comprehend this at the moment, but I will follow the instructions.

Not so long ago I embedded a php script which sent me texts whenever someone visited this site. Needless to say, I was shocked at the hundreds of visits from all over the globe which were totally bogus. I have no idea why people do this.

That said, since these php scripts were sent from this site, I - wrongfully - assumed that I could trigger texts embedded within an includes folder. I have much to learn.

Thanks again!

User avatar
_phillip
 
Posts: 313
Joined: Fri Apr 09, 2021 3:28 pm

Re: Cannot receive texts from secure website ...

Post by _phillip »

@mikeysklar

I followed the instructions and now I am not able to receive any texts whatsoever.

Here is a screen grab showing the successful domain upload:
certificates_uploaded copy.png
certificates_uploaded copy.png (168.55 KiB) Viewed 276 times
The grab pane shows that the http://www.talavermdwca.org domain has been uploaded. I am using an Adafruit MO WIFI board so I did have to add the setPins (...) code to the sketch.

I also ran 'CheckWiFi101FirmwareVersion and this is what was shown in the console pane:
firmware_check copy.png
firmware_check copy.png (66.03 KiB) Viewed 276 times
That does not match the Adafruit instructions. Not certain what to try next.

Thanks.

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: Cannot receive texts from secure website ...

Post by mikeysklar »

Congratulations on getting the certificates uploaded. That is usually the more complicated part, but works best with your M0 based setup.

The Firmware Version check failing is likely do to a difference in shield pinouts versus the integrated M0 WINC1500.

Which version of the Wifi101 library are you running? Is it 0.16.1?

I have seen one mention of a work around with the sites not responding (SSL and non-SSL).
So having got my cert (b.t.w this is an letsencrypt cert on my web server in the cloud) into the ATWinc1500 flash I discovered that though the ATwinc1500 firmware supported TLS 1.2 cipher methods, the wifi101 library did not. So for the case where the cert is uploaded but you still cannot connect to the https server this is most likely issue. The fix for this is to update WiFi101.cpp source file to enable the necessary TLS 1.2 cipher method. In my case, the change was:

m2m_ssl_set_active_ciphersuites(SSL_CIPHER_RSA_WITH_AES_128_CBC_SHA | SSL_CIPHER_RSA_WITH_AES_128_CBC_SHA256 | SSL_CIPHER_RSA_WITH_AES_128_GCM_SHA256 | SSL_CIPHER_RSA_WITH_AES_256_CBC_SHA | SSL_CIPHER_RSA_WITH_AES_256_CBC_SHA256 | SSL_CIPHER_DHE_RSA_WITH_AES_128_GCM_SHA256 );

This change was around line 317; cipher names are in the socket.h file.
viewtopic.php?f=53&t=189363&p=917826&hi ... re#p917826

User avatar
_phillip
 
Posts: 313
Joined: Fri Apr 09, 2021 3:28 pm

Re: Cannot receive texts from secure website ...

Post by _phillip »

@mikeysklar

Thank you for sticking with me on this issue.

The WiFi101 library version that I am using is 0.16.0 as shown from the CHANGELOG grab as follows:
WiFi101-library-version.png
WiFi101-library-version.png (267.75 KiB) Viewed 263 times
From your comments it seems that I should upgrade to 0.16.1. I will try to do that and hopefully that will help because I MUST resolve this issue. And, the sooner, the better.

Thanks again.

User avatar
_phillip
 
Posts: 313
Joined: Fri Apr 09, 2021 3:28 pm

Re: Cannot receive texts from secure website ...

Post by _phillip »

@mikeysklar

I just ran 'CheckWifi101FirmwareVersion.ino and - seemingly - drew a blank ...
firmware_check.png
firmware_check.png (70.95 KiB) Viewed 261 times
This is not what I was expecting ... ?

User avatar
_phillip
 
Posts: 313
Joined: Fri Apr 09, 2021 3:28 pm

Re: Cannot receive texts from secure website ...

Post by _phillip »

@mikeysklar

I upgrades the IDE to version 2 and it appears that it does not support FirmwareUpdater for the Feather MO;
no-supported-board-connected.png
no-supported-board-connected.png (89.5 KiB) Viewed 258 times
I will revert back to the previous version.

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: Cannot receive texts from secure website ...

Post by mikeysklar »

Okay, so roll back to Arduino IDE 1.8.19.

Make sure the Arduino WiFi101 library is current is the v0.16.1 release.

Modify the CheckWifi101FirmwareVersion with the setPins change:

Code: Select all

//Configure pins for Adafruit ATWINC1500 Feather
WiFi.setPins(8,7,4,2);
open the serial console and see if it can detect and run. If you still get no response try the FirmwareUpdater code again.

User avatar
_phillip
 
Posts: 313
Joined: Fri Apr 09, 2021 3:28 pm

Re: Cannot receive texts from secure website ...

Post by _phillip »

Got it! Will report back with my progress.

Thanks again for your help.

User avatar
_phillip
 
Posts: 313
Joined: Fri Apr 09, 2021 3:28 pm

Re: Cannot receive texts from secure website ...

Post by _phillip »

I have reinstalled the same secure website via the Firmware Updater and still I cannot execute a file within the includes folder of this secure website like I am able to with an 'unsecure' website.
success!!.png
success!!.png (351.05 KiB) Viewed 210 times
And further ...
wifi101-firmware-check-passed.png
wifi101-firmware-check-passed.png (150.02 KiB) Viewed 210 times
I am not comfortable modifying the WiFi101.cpp file as a user did above, so I am back to square one.

If anyone has any suggestions to overcome this issue, please let me know.

Thanks!

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: Cannot receive texts from secure website ...

Post by mikeysklar »

You are on the latest firmware, uploaded a certificate and WiFi shield passed its check result test.

That looks like significant progress.

Are you able to get any sort of error now with the certificates in place? I'm curious if the TLS 1.2 cipher method mentioned earlier is relevant to this thread.

User avatar
_phillip
 
Posts: 313
Joined: Fri Apr 09, 2021 3:28 pm

Re: Cannot receive texts from secure website ...

Post by _phillip »

@mikeysklar
Thanks again for your support.

I've even removed the SSL cert from the website in question (to allow me to get it to send texts) but - somehow - the link for this website became the link to some other website. I have no idea ....
ms-yorks-site copy.png
ms-yorks-site copy.png (201.35 KiB) Viewed 203 times
Note the talavera link at the top.

Anyway, I reinstalled the cert and all is good once again. The site is now functioning as it did before ... but, I still am unable to trigger texts from this website.

So, out of desperation, I have taken a look at the WiFi.cpp library

https://github.com/arduino-libraries/Wi ... c/WiFi.cpp

and just as 'rmortimer' noted in his thread, line 317 is where he (apparently) made his addition to this library. This seems like an extreme measure to make this work, but perhaps this is my only option at this point. I have no idea if this will work, but I suppose I can make this change, rename the modified .cpp file and then #include it in my project file. If this works one would think that this code snippet should be added in the first place.

I will await your advice before I proceed.

Thanks again for your help.

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: Cannot receive texts from secure website ...

Post by mikeysklar »

You have a good plan. Keep an original of the CPP file and work with the modified to see if that resolves it. If it does we can pursue a library update through a github issue.

User avatar
_phillip
 
Posts: 313
Joined: Fri Apr 09, 2021 3:28 pm

Re: Cannot receive texts from secure website ...

Post by _phillip »

@mikeysklar

Sounds good. I will let you know how it goes.

Thanks again for your help.

Locked
Please be positive and constructive with your questions and comments.

Return to “Wireless: WiFi and Bluetooth”