summaryrefslogtreecommitdiff
path: root/tools/pw_reset_mailout.py
blob: 1b94ede5c62dcb36a54b339ba619f30e60001c48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import sys
import csv
import time
import smtplib

import store
import config


def main():
    c = config.Config('/data/pypi/config.ini')
    if len(sys.argv) != 2:
        st = store.Store(c)
        st.open()
        w = csv.writer(sys.stdout)
        for user in st.get_users():
            w.writerow((user['name'], user['email']))
    else:
        with open(sys.argv[1]) as f:
            for name, email in csv.reader(f):
                message = TEXT.format(name=name, email=email)
                # send email
                s = smtplib.SMTP()
                s.connect('localhost')
                s.sendmail('richard@python.org', [email], message)
                s.close()
                time.sleep(.1)

TEXT = '''From: richard@python.org
To: {email}
Subject: PyPI security notice


TL;DR: please log into PyPI and change your password.

Dear PyPI user {name},

Recently we have been auditing and improving security of the Python Package
Index (PyPI) and other python.org hosts.

You may be aware that the wiki.python.org host was compromised. Since we must
assume that all passwords stored in that system are also compromised, and we
also assume that some users share passwords between python.org systems, we are
performing a password reset of all PyPI accounts in one week's time, at
2013-02-22 00:00 UTC.

If you log in before that deadline and change your password then you'll be
fine, otherwise you'll need to use the password recovery form after the reset
has occurred.

Additionally, we would ask you to begin to access PyPI using HTTPS through the
web. We're in the process of installing a new SSL certificate so the current
Big Red Certificate Warning should go away very soon.

We are in the process of updating the Python packaging toolset to use HTTPS.

These steps are but a couple of those we're intending to take to better secure
PyPI. If you are interested in these matters I encourage you to participate in
the discussion on the catalog SIG:

http://mail.python.org/mailman/listinfo/catalog-sig

Finally, we apologise for any inconvenience these changes have caused.


    Richard Jones
    richard@python.org
    PyPI Maintainer
'''

if __name__ == '__main__':
    main()