config: Add the ability to disable device verification.

This commit is contained in:
Damir Jelić 2019-05-21 13:23:07 +02:00
parent 1ad5cf6e66
commit 48da1b6b14
4 changed files with 13 additions and 2 deletions

View File

@ -8,3 +8,4 @@ ListenAddress = localhost
ListenPort = 8009
Proxy = http://localhost:8080
SSL = False
IgnoreVerification = False

View File

@ -41,6 +41,11 @@ homeserver.
.It Cm SSL
A boolean that decides if SSL verification should be enabled for outgoing
connections to the homeserver. Defaults to "True".
.It Cm IgnoreVerification
A boolean that decides if device verification should be enabled. If this is True
devices will be marked as ignored automatically and encryption keys will be
shared with them, if this is False the user needs to verify, blacklist or ignore
devices manually before messages can be sent to a room. Defaults to "False".
.El
.Pp
Aditional to the homeserver section a special section with the name
@ -50,6 +55,7 @@ can be used to configure the following values for all homeservers:
.Cm ListenPort ,
.Cm Proxy ,
.Cm SSL
.Cm IgnoreVerification
.Pp
The
.Cm Default

View File

@ -14,6 +14,7 @@ class PanConfigParser(configparser.ConfigParser):
default_section="Default",
defaults={
"SSL": "True",
"IgnoreVerification": "False",
"ListenAddress": "localhost",
"ListenPort": "8009",
"LogLevel": "warnig",
@ -93,6 +94,7 @@ class ServerConfig:
listen_port = attr.ib(type=int)
proxy = attr.ib(type=str)
ssl = attr.ib(type=bool, default=True)
ignore_verification = attr.ib(type=bool, default=False)
@attr.s
@ -142,6 +144,7 @@ class PanConfig:
listen_address = section.getaddress("ListenAddress")
listen_port = section.getint("ListenPort")
ssl = section.getboolean("SSL")
ignore_verification = section.getboolean("IgnoreVerification")
proxy = section.geturl("Proxy")
listen_tuple = (listen_address, listen_port)
@ -158,7 +161,8 @@ class PanConfig:
listen_address,
listen_port,
proxy,
ssl
ssl,
ignore_verification
)
self.servers[section_name] = server_conf

View File

@ -724,7 +724,7 @@ class ProxyDaemon:
async with sem:
try:
return await _send()
return await _send(self.conf.ignore_verification)
except OlmTrustError as e:
# There are unverified/unblocked devices in the room, notify
# the UI thread about this and wait for a response.