diff --git a/src/conf.py b/src/conf.py index 76c4fab4c..d5cf0cf76 100644 --- a/src/conf.py +++ b/src/conf.py @@ -346,9 +346,7 @@ def registerNetwork(name, password='', ssl=True, sasl_username='', registry.String('', _("""A certificate that is trusted to verify certificates of this network (aka. Certificate Authority)."""))) registerGlobalValue(network, 'requireStarttls', registry.Boolean(False, - _("""Determines whether the bot will connect in plain text to %s - but require STARTTLS before authentication. This is ignored if the - connection already uses SSL.""") % name)) + _("""Deprecated config value, keep it to False."""))) registerGlobalValue(network, 'certfile', registry.String('', _("""Determines what certificate file (if any) the bot will use to diff --git a/src/irclib.py b/src/irclib.py index 33174b789..a18990484 100644 --- a/src/irclib.py +++ b/src/irclib.py @@ -990,6 +990,14 @@ class Irc(IrcCommandDispatcher, log.Firewalled): self.capNegociationEnded = False self.requireStarttls = not network_config.ssl() and \ network_config.requireStarttls() + if self.requireStarttls: + log.error(('STARTTLS is no longer supported. Set ' + 'supybot.networks.%s.requireStarttls to False ' + 'to disable it, and use supybot.networks.%s.ssl ' + 'instead.') % (self.network, self.network)) + self.driver.die() + self._reallyDie() + return self.resetSasl() def resetSasl(self): @@ -1036,22 +1044,7 @@ class Irc(IrcCommandDispatcher, log.Firewalled): self.sendMsg(ircmsgs.IrcMsg(command='CAP', args=('LS', '302'))) - if self.requireStarttls: - self.sendMsg(ircmsgs.IrcMsg(command='STARTTLS')) - else: - self.sendAuthenticationMessages() - - def do670(self, irc, msg): - """STARTTLS accepted.""" - log.info('%s: Starting TLS session.', self.network) - self.requireStarttls = False - self.driver.starttls() self.sendAuthenticationMessages() - def do691(self, irc, msg): - """STARTTLS refused.""" - log.error('%s: Server refused STARTTLS: %s', self.network, msg.args[0]) - self.feedMsg(ircmsgs.error('STARTTLS upgrade refused by the server')) - self.driver.reconnect() def sendAuthenticationMessages(self): # Notes: @@ -1282,13 +1275,6 @@ class Irc(IrcCommandDispatcher, log.Firewalled): s = self.state.capabilities_ls['sasl'] if s is not None: self.filterSaslMechanisms(set(s.split(','))) - if 'starttls' not in self.state.capabilities_ls and \ - self.requireStarttls: - log.error('%s: Server does not support STARTTLS.', self.network) - self.feedMsg(ircmsgs.error('STARTTLS upgrade not supported ' - 'by the server')) - self.die() - return # NOTE: Capabilities are requested in alphabetic order, because # sets are unordered, and their "order" is nondeterministic. # This is needed for the tests. diff --git a/test/test_irclib.py b/test/test_irclib.py index 882967158..99d6e4353 100644 --- a/test/test_irclib.py +++ b/test/test_irclib.py @@ -374,7 +374,6 @@ class IrcStateTestCase(SupyTestCase): st = irclib.IrcState() self.assert_(st.addMsg(self.irc, ircmsgs.IrcMsg('MODE foo +i')) or 1) - class IrcTestCase(SupyTestCase): def setUp(self): self.irc = irclib.Irc('test')