2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 16:56:54 +00:00

TcpServerUtils.pm: add sslCertPrefix option (Forum #92030)

git-svn-id: https://svn.fhem.de/fhem/trunk@17529 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2018-10-14 12:57:06 +00:00
parent 567fea2a0c
commit 85dfd7d6ee
4 changed files with 55 additions and 8 deletions

View File

@ -36,11 +36,13 @@ MQTT2_SERVER_Initialize($)
no warnings 'qw';
my @attrList = qw(
SSL:0,1
autocreate
disable:0,1
disabledForIntervals
autocreate
rawEvents
SSL:0,1
sslVersion
sslCertPrefix
);
use warnings 'qw';
$hash->{AttrList} = join(" ", @attrList);
@ -580,6 +582,15 @@ MQTT2_SERVER_getStr($$)
Enable SSL (i.e. TLS)
</li><br>
<li>sslVersion<br>
See the global attribute sslVersion.
</li><br>
<li>sslCertPrefix<br>
Set the prefix for the SSL certificate, default is certs/server-, see
also the SSL attribute.
</li><br>
<a name="autocreate"></a>
<li>autocreate<br>
If set, MQTT2_DEVICES will be automatically created upon receiving an

View File

@ -187,9 +187,10 @@ FHEMWEB_Initialize($)
refresh
reverseLogs:0,1
roomIcons
sortRooms
showUsedFiles:0,1
sortRooms
sslVersion
sslCertPrefix
smallscreen:unused
smallscreenCommands:0,1
stylesheetPrefix
@ -3911,6 +3912,12 @@ FW_widgetOverride($$)
See the global attribute sslVersion.
</li><br>
<a name="sslCertPrefix"></a>
<li>sslCertPrefix<br>
Set the prefix for the SSL certificate, default is certs/server-, see
also the HTTPS attribute.
</li><br>
<a name="styleData"></a>
<li>styleData<br>
data-storage used by dynamic styles like f18
@ -4613,6 +4620,12 @@ FW_widgetOverride($$)
Siehe das global Attribut sslVersion.
</li><br>
<a name="sslCertPrefix"></a>
<li>sslCertPrefix<br>
Setzt das Pr&auml;fix der SSL-Zertifikate, die Voreinstellung ist
certs/server-, siehe auch das HTTP Attribut.
</li><br>
<a name="styleData"></a>
<li>styleData<br>
wird von dynamischen styles wie f18 werwendet

View File

@ -20,9 +20,22 @@ telnet_Initialize($)
$hash->{AsyncOutputFn} = "telnet_Output";
$hash->{UndefFn} = "telnet_Undef";
$hash->{AttrFn} = "telnet_Attr";
$hash->{AttrList} = "globalpassword password prompt allowedCommands ".
"allowfrom SSL connectTimeout connectInterval ".
"encoding:utf8,latin1 sslVersion";
no warnings 'qw';
my @attrList = qw(
SSL
allowedCommands
allowfrom
connectInterval
connectTimeout
encoding:utf8,latin1
globalpassword
password
prompt
sslCertPrefix
sslVersion
);
use warnings 'qw';
$hash->{AttrList} = join(" ", @attrList);
$hash->{ActivateInformFn} = "telnet_ActivateInform";
$hash->{CanAuthenticate} = 2;
@ -514,6 +527,10 @@ telnet_ActivateInform($)
<li>sslVersion<br>
See the global attribute sslVersion.
</li><br>
<li>sslCertPrefix<br>
Set the prefix for the SSL certificate, default is certs/server-, see
also the SSL attribute.
</li><br>
</ul>
@ -656,6 +673,11 @@ telnet_ActivateInform($)
Siehe das global Attribut sslVersion.
</li><br>
<li>sslCertPrefix<br>
Setzt das Pr&auml;fix der SSL-Zertifikate, die Voreinstellung ist
certs/server-, siehe auch das SSL Attribut.
</li><br>
</ul>
</ul>

View File

@ -111,12 +111,13 @@ TcpServer_Accept($$)
# Certs directory must be in the modpath, i.e. at the same level as the
# FHEM directory
my $mp = AttrVal("global", "modpath", ".");
my $certPrefix = AttrVal($name, "sslCertPrefix", "certs/server-");
my $ret;
eval {
$ret = IO::Socket::SSL->start_SSL($clientinfo[0], {
SSL_server => 1,
SSL_key_file => "$mp/certs/server-key.pem",
SSL_cert_file => "$mp/certs/server-cert.pem",
SSL_key_file => "$mp/${certPrefix}key.pem",
SSL_cert_file => "$mp/${certPrefix}cert.pem",
SSL_version => $sslVersion,
SSL_cipher_list => 'HIGH:!RC4:!eNULL:!aNULL',
Timeout => 4,