Page MenuHomePhabricator

LoginNotify: Provide configuration to deny login if attempt is made from new IP
Closed, ResolvedPublic

Description

Summary

LoginNotify provides a notification if an attempt is made to login to an account from an IP not recently seen with that account. This task will introduce a configuration that also prevents the login from occurring.

Background

As an emergency measure, we made need to deny login to an account if it's from an unfamiliar IP.

Technical notes

  • TBD
  • There should be a configuration so that this is easily toggleable. The default is "off"

Acceptance criteria

  • When config is enabled, a login from an unfamiliar IP for a given account is denied
  • A log message with IP and user agent is generated, noting that the login was denied

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Change #1132015 had a related patch set uploaded (by Máté Szabó; author: Máté Szabó):

[mediawiki/extensions/LoginNotify@master] Introduce configuration to deny logins from unknown systems

https://gerrit.wikimedia.org/r/1132015

Change #1132025 had a related patch set uploaded (by Kosta Harlan; author: Máté Szabó):

[mediawiki/extensions/LoginNotify@wmf/1.44.0-wmf.22] Introduce configuration to deny logins from unknown systems

https://gerrit.wikimedia.org/r/1132025

Change #1132027 had a related patch set uploaded (by Máté Szabó; author: Máté Szabó):

[operations/mediawiki-config@master] Configure LoginNotify deny functionality

https://gerrit.wikimedia.org/r/1132027

Change #1132015 merged by jenkins-bot:

[mediawiki/extensions/LoginNotify@master] Introduce configuration to deny logins from unknown systems

https://gerrit.wikimedia.org/r/1132015

Change #1132027 merged by jenkins-bot:

[operations/mediawiki-config@master] Configure LoginNotify deny functionality

https://gerrit.wikimedia.org/r/1132027

Change #1132025 merged by jenkins-bot:

[mediawiki/extensions/LoginNotify@wmf/1.44.0-wmf.22] Introduce configuration to deny logins from unknown systems

https://gerrit.wikimedia.org/r/1132025

Mentioned in SAL (#wikimedia-operations) [2025-03-28T21:55:51Z] <sbassett@deploy1003> Started scap sync-world: Backport for [[gerrit:1132029|Add LoginNotify to disallowed local providers]], [[gerrit:1132025|Introduce configuration to deny logins from unknown systems (T390315)]], [[gerrit:1132027|Configure LoginNotify deny functionality (T390315)]]

Mentioned in SAL (#wikimedia-operations) [2025-03-28T22:10:29Z] <sbassett@deploy1003> sbassett, tgr, mszabo, kharlan: Backport for [[gerrit:1132029|Add LoginNotify to disallowed local providers]], [[gerrit:1132025|Introduce configuration to deny logins from unknown systems (T390315)]], [[gerrit:1132027|Configure LoginNotify deny functionality (T390315)]] synced to the testservers (https://wikitech.wikimedia.org/wiki/Mwdebug)

Mentioned in SAL (#wikimedia-operations) [2025-03-28T22:23:23Z] <sbassett@deploy1003> Finished scap sync-world: Backport for [[gerrit:1132029|Add LoginNotify to disallowed local providers]], [[gerrit:1132025|Introduce configuration to deny logins from unknown systems (T390315)]], [[gerrit:1132027|Configure LoginNotify deny functionality (T390315)]] (duration: 27m 32s)

dom_walden subscribed.

I am blocked from logging in when using a new IP and I don't have a loginnotify_prevlogins cookie set on my browser. Where the user I am trying to login has an email, I see an email sent with subject Failed attempt to log in to {wiki} as {user}. It does not seem to matter if the password is correct or not.

With various different LoginNotify configs I used the API to login with many different users and inspect what is recorded in debug logs by LoginNotify. Logins are rejected when the user is not known or if there is no info. In the case of no info, a job is created to lookup the information for a user but we still reject the login before the job has completed. This seems like a safe response.

It does not appear to affect creating accounts, re-entering your password (e.g. when changing password) or sending password resets.

Test environment: local docker LoginNotify 0.1 (79ad68a) 07:20, 1 April 2025.