root@OPNsense:~ # nc -v opnsense.org 443Connection to opnsense.org 443 port [tcp/https] succeeded!root@OPNsense:~ # nc -v my-nextcloud.xyz 443nc: connect to my-nextcloud.xyz port 443 (tcp) failed: Operation timed out
vi /usr/local/opnsense/mvc/app/library/OPNsense/Backup/Nextcloud.php
CURLOPT_SSL_VERIFYHOST => false,CURLOPT_SSL_VERIFYPEER => false,
curl_setopt_array($curl, array( CURLOPT_URL => $url, CURLOPT_CUSTOMREQUEST => $method, // Create a file in WebDAV is PUT CURLOPT_RETURNTRANSFER => true, // Do not output the data to STDOUT CURLOPT_VERBOSE => 0, // same here CURLOPT_MAXREDIRS => 0, // no redirects CURLOPT_TIMEOUT => 60, // maximum time: 1 min CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_USERPWD => $username . ":" . $password, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_HTTPHEADER => $headers));
public function curl_request( $url, $username, $password, $method, $error_message, $postdata = null, $headers = array("User-Agent: OPNsense Firewall"), $verify_ssl = true # additional parameter ) { $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => $url, CURLOPT_CUSTOMREQUEST => $method, // Create a file in WebDAV is PUT CURLOPT_RETURNTRANSFER => true, // Do not output the data to STDOUT CURLOPT_VERBOSE => 0, // same here CURLOPT_MAXREDIRS => 0, // no redirects CURLOPT_TIMEOUT => 60, // maximum time: 1 min CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_USERPWD => $username . ":" . $password, CURLOPT_SSL_VERIFYHOST => $verify_ssl, // verify ssl unless explicitly asked not to CURLOPT_SSL_VERIFYPEER => $verify_ssl, // same here CURLOPT_HTTPHEADER => $headers )); // Code continues as before... }
curl_setopt($ch, CURLOPT_CAINFO, '/etc/ssl/certs/cacert.pem');
I've registered just to add this:I had the same "Cannot get real username" error, but in my case I was already using an FQDN and a trusted Letsencrypt cert.The root cause for me was that the directory I chose already existed, and the solution was to remove that directory in NC and then re-run the "Setup/Test" again. Doing so, the test succeeded and the directory was created and populated with a single XML backup on my NC server.
@drewhemm by default, curl uses the system's cert store. Where you can install the certificates and it will work. It is far better than building a backdoor or use it in a way that it will not survive the next update.
The following input errors were detected:Saved settings, but remote backup failed.
{"url":"https:\/\/[URL REDACTED]\/ocs\/v1.php\/cloud\/user","content_type":null,"http_code":0,"header_size":0,"request_size":0,"filetime":-1,"ssl_verify_result":1,"redirect_count":0,"total_time":0.009638,"namelookup_time":0.000617,"connect_time":0.00078,"pretransfer_time":0,"size_upload":0,"size_download":0,"speed_download":0,"speed_upload":0,"download_content_length":-1,"upload_content_length":-1,"starttransfer_time":0,"redirect_time":0,"redirect_url":"","primary_ip":"[IP REDACTED]","certinfo":[],"primary_port":443,"local_ip":"[IP REDACTED]","local_port":13732,"http_version":0,"protocol":2,"ssl_verifyresult":0,"scheme":"HTTPS","appconnect_time_us":0,"connect_time_us":780,"namelookup_time_us":617,"pretransfer_time_us":0,"redirect_time_us":0,"starttransfer_time_us":0,"total_time_us":9638}
curl: (60) SSL certificate problem: unable to get local issuer certificateopenssl: Verify return code: 21 (unable to verify the first certificate)