2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 09:16:53 +00:00

57_Calender: new attribute SSLVerify

git-svn-id: https://svn.fhem.de/fhem/trunk@12946 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
borisneubert 2017-01-03 17:22:41 +00:00
parent d36b95ceb9
commit 05d275b9e1
2 changed files with 39 additions and 2 deletions

View File

@ -1,5 +1,6 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it.
- feature: 57_Calender: new attribute SSLVerify
- feature: 00_MQTT: Added username password (optional).
- feature: 41_OREGON: support event-min-interval, event-on-change-reading,
etc. Changed module to new log function

View File

@ -1555,7 +1555,7 @@ sub Calendar_Initialize($) {
$hash->{SetFn} = "Calendar_Set";
$hash->{AttrFn} = "Calendar_Attr";
$hash->{NotifyFn}= "Calendar_Notify";
$hash->{AttrList}= "hideOlderThan hideLaterThan onCreateEvent $readingFnAttributes";
$hash->{AttrList}= "hideOlderThan hideLaterThan onCreateEvent SSLVerify:0,1 $readingFnAttributes";
}
@ -1713,6 +1713,10 @@ sub Calendar_Get($@) {
if($cmd eq "events") {
# see https://forum.fhem.de/index.php/topic,46608.msg397309.html#msg397309 for ideas
# get myCalendar events filter:mode=alarm|start|upcoming format=custom:{ sprintf("...") } select:series=next,max=8,from=-3d,to=10d
# attr myCalendar defaultFormat <format>
my @texts;
my @events= Calendar_GetEvents($hash, $t, undef, undef);
foreach my $event (@events) {
@ -2082,6 +2086,19 @@ sub Calendar_GetUpdate($$$) {
if($type eq "url") {
my $SSLVerify= AttrVal($name, "SSLVerify", undef);
my $SSLArgs= { };
if(defined($SSLVerify)) {
eval "use IO::Socket::SSL";
if($@) {
Log3 $hash, 2, $@;
} else {
my $SSLVerifyMode= eval("$SSLVerify ? SSL_VERIFY_PEER : SSL_VERIFY_NONE");
Log3 $hash, 5, "SSL verify mode set to $SSLVerifyMode";
$SSLArgs= { SSL_verify_mode => $SSLVerifyMode };
}
}
HttpUtils_NonblockingGet({
url => $url,
hideurl => 1,
@ -2090,6 +2107,7 @@ sub Calendar_GetUpdate($$$) {
timeout => 30,
type => 'caldata',
removeall => $removeall,
sslargs => $SSLArgs,
t => $t,
callback => \&Calendar_ProcessUpdate,
});
@ -2745,6 +2763,14 @@ sub CalendarAsHtml($;$) {
calendar event that is created. See section <a href="#CalendarPlugIns">Plug-ins</a> below.
</li><p>
<li><code>SSLVerify</code><br>
This attribute sets the verification mode for the peer certificate for connections secured by
SSL. Set attribute either to 0 for SSL_VERIFY_NONE (no certificate verification) or
to 1 for SSL_VERIFY_PEER (certificate verification). Disabling verification is useful
for local calendar installations (e.g. OwnCloud, NextCloud) without valid SSL certificate.
</li><p>
<li><a href="#readingFnAttributes">readingFnAttributes</a></li>
</ul>
<br>
@ -3121,7 +3147,17 @@ sub CalendarAsHtml($;$) {
Weitere Informationen unter <a href="#CalendarPlugIns">Plug-ins</a> im Text.
</li><p>
<li><a href="#readingFnAttributes">readingFnAttributes</a></li>
<li><code>SSLVerify</code><br>
Dieses Attribut setzt die Art der &Uuml;berpruuml;fung des Zertifikats des Partners
bei mit SSL gesicherten Verbindungen. Entweder auf 0 setzen f&uuml;r
SSL_VERIFY_NONE (keine &Uuml;berpr&uuml;fung des Zertifikats) oder auf 1 f&uuml;r
SSL_VERIFY_PEER (&Uuml;berpr&uuml;fung des Zertifikats). Die &Uuml;berpr&uuml;fung auszuschalten
ist n&uuml;tzlich f&uuml;r lokale Kalenderinstallationen(e.g. OwnCloud, NextCloud)
ohne g&uuml;tiges SSL-Zertifikat.
</li><p>
<li><a href="#readingFnAttributes">readingFnAttributes</a></li>
</ul>
<br>