Issue with self signed SSL when sending POST request from ST

I’m using this project https://github.com/harperreed/SmartThings-webhook by @harper to send notification to a web server running on RPi. This works fine for a regular HTTP endpoint. But I have a self signed SSL on my endpoint, and I got this error:

http post failed: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

I tried several fix methods on my RPi but still receive the error. I don’t know if this error is caused by ST or my web server.

This is my main.php that handles the request:

<?php $jsonRequest = file_get_contents('php://input'); $data = json_decode($jsonRequest, true); // // Logging // $log = '/tmp/smartthings.log'; $request = "\n\n\n--------------------------------------------------------------------------------------------------"; $request .= "\n-------------------------------" . date(DATE_RFC2822) . "------------------------------------\n"; // Apache headers $headers = apache_request_headers(); foreach ($headers as $header => $value) { $request .= "$header: $value \n"; } // HTTP POST Data $request .= "HTTP Raw Data: "; $request .= $jsonRequest; // PHP Array from JSON $request .= "\n\nPHP Array from JSON: "; $request .= print_r($data, true); // Write raw request to log file file_put_contents($log, $request, FILE_APPEND);

I’ve been reading the selfsigned certificates are not allowed on ST. Did you find a workaround?

I still use self signed SSL but using this https://github.com/letsencrypt/letsencrypt. It’s free SSL but you keep and generate the cert on your machine.

1 Like