Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bug fix for invalid certificates and timeout issues on remote servers
#1
I just set up a secondary server to work with THT and found out that some things went a bit weird with it. The first thing is I didn't think to have it connect to WHM via SSL since I'm not using SSL for my site so we don't have "This site is untrusted" popping up all the time and because PayPal handles all the sensitive data. So, first when you connect to a remote host, you need WHM to be connected to via SSL as set in your security settings. This works for the local server as well.

OK, so here are the bug fig fixes. So you don't have the server wasting resources when it can't connect to the server, we need to set the timout in curl_setopts. We also need to set the SSL verify peer setting to false so that every time we try to pull the XML file from the server to validate if WHM did what we wanted it to, we don't wind up with the error about the certificates not matching up. This even prevents the signup process from working properly as well. Below is how to fix this.

Open /includes/servers/whm.php
Find:

PHP Code:
curl_setopt($chCURLOPT_HTTPHEADER,$curlheaders); 

After it, add:
PHP Code:
curl_setopt($chCURLOPT_SSL_VERIFYPEERfalse);
                
curl_setopt($chCURLOPT_CONNECTTIMEOUT10);
                
curl_setopt($chCURLOPT_TIMEOUT10); 

Open /includes/servers/da.php
Find:

PHP Code:
curl_setopt($chCURLOPT_RETURNTRANSFER,1); 

After it, add:
PHP Code:
curl_setopt($chCURLOPT_SSL_VERIFYPEERfalse);
                
curl_setopt($chCURLOPT_CONNECTTIMEOUT10);
                
curl_setopt($chCURLOPT_TIMEOUT10); 
---
See my GitHub at https://github.com/cozylife
Reply
#2
You're a good asset to THT. Keep up the great work, and thanks to all your contributions.
Remote Servers - Shared, Reseller & KVM Hosting Services
Reply
#3
Thank you. =)
---
See my GitHub at https://github.com/cozylife
Reply
#4
PHP Code:
curl_setopt($chCURLOPT_HTTPAUTHCURLAUTH_ANY);
curl_setopt($chCURLOPT_SSL_VERIFYPEERfalse); 
These are already in whm.php on line 43 and 44 in the v1.2.3 tag.
Kevin Mark - TheHostingTool Lead Developer
Reply
#5
You're right, they are. I didn't notice that. Its on mine too and I don't know what caused them to get missed and send that error. That's weird. I had it in SSL mode as well. Maybe another option is overriding it? I'm building an automod script right now for THT to drum up some new modders since it'll be easier to mod for, or I'd work on that. If you see anything that looks out of place that could be stopping those from working, please let me know.
---
See my GitHub at https://github.com/cozylife
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)