Add debug logging when skipping SASL mechanisms

It is useful to figure out what you forgot to configure
This commit is contained in:
Valentin Lorentz 2022-07-29 10:03:39 +02:00
parent f549ec12c6
commit ee60431396

View File

@ -1731,19 +1731,40 @@ class Irc(IrcCommandDispatcher, log.Firewalled):
self.sasl_current_mechanism = None self.sasl_current_mechanism = None
for mechanism in network_config.sasl.mechanisms(): for mechanism in network_config.sasl.mechanisms():
if mechanism == 'ecdsa-nist256p-challenge' and \ if mechanism == 'ecdsa-nist256p-challenge':
crypto and self.sasl_username and \ if not crypto:
self.sasl_ecdsa_key: log.debug('Skipping SASL %s, crypto module '
'is not available',
mechanism)
elif not self.sasl_username or not self.sasl_ecdsa_key:
log.debug('Skipping SASL %s, missing username and/or key',
mechanism)
else:
self.sasl_next_mechanisms.append(mechanism) self.sasl_next_mechanisms.append(mechanism)
elif mechanism == 'external' and ( elif mechanism == 'external':
network_config.certfile() or if not network_config.certfile() and \
conf.supybot.protocols.irc.certfile()): not conf.supybot.protocols.irc.certfile():
log.debug('Skipping SASL %s, missing cert file',
mechanism)
else:
self.sasl_next_mechanisms.append(mechanism) self.sasl_next_mechanisms.append(mechanism)
elif mechanism.startswith('scram-') and scram and \ elif mechanism.startswith('scram-'):
self.sasl_username and self.sasl_password: if not scram:
log.debug('Skipping SASL %s, scram module '
'is not available',
mechanism)
elif not self.sasl_username or not self.sasl_password:
log.debug('Skipping SASL %s, missing username and/or '
'password',
mechanism)
else:
self.sasl_next_mechanisms.append(mechanism) self.sasl_next_mechanisms.append(mechanism)
elif mechanism == 'plain' and \ elif mechanism == 'plain':
self.sasl_username and self.sasl_password: if not self.sasl_username or not self.sasl_password:
log.debug('Skipping SASL %s, missing username and/or '
'password',
mechanism)
else:
self.sasl_next_mechanisms.append(mechanism) self.sasl_next_mechanisms.append(mechanism)
if self.sasl_next_mechanisms: if self.sasl_next_mechanisms: