2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-20 01:06:04 +00:00

TcpServerUtils.pm: certificate generation: handle pwd!=modpath (Forum #108789)

git-svn-id: https://svn.fhem.de/fhem/trunk@21319 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2020-02-29 20:48:21 +00:00
parent 50d5f3fd6e
commit d1e7581207

View File

@ -179,7 +179,8 @@ TcpServer_SetSSL($)
}
my $name = $hash->{NAME};
my $cp = AttrVal($name, "sslCertPrefix", "certs/server-");
my $cp = AttrVal("global", "modpath", ".")."/".
AttrVal($name, "sslCertPrefix", "certs/server-");
if(! -r "${cp}key.pem") {
Log 1, "$name: Server certificate missing, trying to create one";
@ -197,7 +198,7 @@ TcpServer_SetSSL($)
close(FH);
my $cmd = "openssl req -new -x509 -days 3650 -nodes -newkey rsa:2048 ".
"-config certreq.txt -out ${cp}cert.pm -keyout ${cp}key.pem";
"-config certreq.txt -out ${cp}cert.pem -keyout ${cp}key.pem";
Log 1, "Executing $cmd";
`$cmd`;
unlink("certreq.txt");