Skip to content

Commit c3ba0a3

Browse files
committed
Implement password hash testing using new roundup-admin perftest.
Add new anypy/time_.py to provide a suitable definition for perf_counter for python2 or 3. Also update examples in upgrading.txt, man page, new translatable strings in locale.
1 parent e962041 commit c3ba0a3

File tree

17 files changed

+832
-220
lines changed

17 files changed

+832
-220
lines changed

doc/upgrading.txt

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -204,21 +204,41 @@ older 10000 round hashed passwords. If ``migrate_passwords`` is
204204
set to ``yes``, passwords will be automatically re-hashed using
205205
the new higher value when the user logs in.
206206

207-
This re-hashing might result in a slight delay (under 1
208-
second). If you see a large slowdown, check to see if you can
209-
execute::
207+
Increasing the number of rounds will slow down re-hashing. That's the
208+
whole point. Sadly it will also slow down logins. Usually the hash
209+
takes under 1 second, but if you are using a slow chip (e.g. an ARM V6
210+
at 700 bogo mips) it can take 30 seconds to compute the 2000000
211+
rounds. The slowdown is linear. So what takes .001 seconds at 10000
212+
rounds will take: ``2000000/10000 * .001 = 200 * .001`` seconds or 0.2
213+
seconds.
214+
215+
You can see how long it will take by using the new ``roundup-admin``
216+
``perftest`` command. After you have finished migrating your database,
217+
run::
218+
219+
roundup-admin -i <tracker_home> perftest password rounds=10000
220+
221+
and then::
222+
223+
roundup-admin -i <tracker_home> perftest password rounds=2,000,000
224+
225+
so see the difference. Output from this command looks like::
226+
227+
Hash time: 0.203151849s scheme: PBKDF2 rounds: 10000
228+
229+
If your testing reports a hash time in the 0.5 second range for 10000
230+
rounds, there may be another issue. See if executing::
210231

211232
python3 -c 'from hashlib import pbkdf2_hmac'
212233

213-
without an error.
234+
produces an error.
214235

215-
If you get an ImportError, you are using Roundup's fallback
216-
PBKDF2 implementation. It is written in Python and is much slower
217-
than the library version. As a result re-encrypting the password
218-
(and logging in which requires calculating the encrypted
219-
password) will be very slow.
236+
If you get an ImportError, you are using Roundup's fallback PBKDF2
237+
implementation. It is much slower than the library version. As a
238+
result re-encrypting the password (and logging in, which requires
239+
calculating the encrypted password) will be very slow.
220240

221-
You should find out how to make this succeed. You may need to
241+
You should find out how to make the import succeed. You may need to
222242
install an OS vendor package or some other library.
223243

224244
.. _recommended setting of 1,300,000: https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Cheat_Sheet.html#pbkdf2

locale/de.po

Lines changed: 56 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgid ""
77
msgstr ""
88
"Project-Id-Version: Roundup 2.3.0\n"
99
"Report-Msgid-Bugs-To: [email protected]\n"
10-
"POT-Creation-Date: 2023-03-01 12:54-0500\n"
10+
"POT-Creation-Date: 2023-03-03 17:28-0500\n"
1111
"PO-Revision-Date: 2016-04-11 09:13+0200\n"
1212
"Last-Translator: Tobias Herp <[email protected]>\n"
1313
"Language-Team: German Translators <[email protected]>\n"
@@ -1253,41 +1253,78 @@ msgstr ""
12531253
" "
12541254

12551255
#: ../roundup/admin.py:1742
1256-
msgid "Tracker updated"
1257-
msgstr "Tracker aktualisiert"
1256+
#, python-format
1257+
msgid "Tracker updated to schema version %s."
1258+
msgstr ""
12581259

1259-
#: ../roundup/admin.py:1745
1260-
msgid "No migration action required"
1260+
#: ../roundup/admin.py:1746
1261+
#, fuzzy, python-format
1262+
msgid "No migration action required. At schema version %s."
12611263
msgstr "Keine Migration notwendig"
12621264

1263-
#: ../roundup/admin.py:1771
1265+
#: ../roundup/admin.py:1751
1266+
msgid ""
1267+
"Usage: perftest [mode] [arguments]*\n"
1268+
"\n"
1269+
" Time operations in Roundup. Supported arguments:\n"
1270+
"\n"
1271+
" [password] [rounds=<integer>] [scheme=<scheme>]\n"
1272+
"\n"
1273+
" 'password' is the default mode. The tracker's config.ini\n"
1274+
" setting for 'password_pbkdf2_default_rounds' is the default\n"
1275+
" value for 'rounds'. On the command line, 'rounds' can include\n"
1276+
" thousands separator of ',' or '.'. 'scheme' is the default\n"
1277+
" coded into Roundup. List supported schemes by using 'scheme='.\n"
1278+
"\n"
1279+
" "
1280+
msgstr ""
1281+
1282+
#: ../roundup/admin.py:1785
1283+
msgid "Invalid 'rounds'. Must be larger than 999."
1284+
msgstr ""
1285+
1286+
#: ../roundup/admin.py:1789
1287+
#, python-format
1288+
msgid "Invalid 'rounds'. It must be an integer not: %s"
1289+
msgstr ""
1290+
1291+
#: ../roundup/admin.py:1816
1292+
msgid "scheme does not support rounds."
1293+
msgstr ""
1294+
1295+
#: ../roundup/admin.py:1819
1296+
#, python-format
1297+
msgid "Hash time: %(time)0.9f seconds, scheme: %(scheme)s, rounds: %(rounds)s"
1298+
msgstr ""
1299+
1300+
#: ../roundup/admin.py:1847
12641301
#, python-format
12651302
msgid "Unknown command \"%(command)s\" (\"help commands\" for a list)"
12661303
msgstr "Der Befehl \"%(command)s\" existiert nicht (siehe \"help commands\")"
12671304

1268-
#: ../roundup/admin.py:1777
1305+
#: ../roundup/admin.py:1853
12691306
#, python-format
12701307
msgid "Multiple commands match \"%(command)s\": %(list)s"
12711308
msgstr "Zur Abkürzung \"%(command)s\" passen mehrere Befehle: %(list)s"
12721309

1273-
#: ../roundup/admin.py:1786
1310+
#: ../roundup/admin.py:1862
12741311
msgid "Enter tracker home: "
12751312
msgstr "Tracker-Verzeichnis: "
12761313

12771314
# ../roundup/admin.py:1263 :1269 :1289
1278-
#: ../roundup/admin.py:1795 ../roundup/admin.py:1801 ../roundup/admin.py:1838
1279-
#: ../roundup/admin.py:1795:1801:1838
1315+
#: ../roundup/admin.py:1871 ../roundup/admin.py:1877 ../roundup/admin.py:1914
1316+
#: ../roundup/admin.py:1871:1877:1914
12801317
#, python-format
12811318
msgid "Error: %(message)s"
12821319
msgstr "Fehler: %(message)s"
12831320

1284-
#: ../roundup/admin.py:1811 ../roundup/admin.py:1815
1285-
#: ../roundup/admin.py:1811:1815
1321+
#: ../roundup/admin.py:1887 ../roundup/admin.py:1891
1322+
#: ../roundup/admin.py:1887:1891
12861323
#, python-format
12871324
msgid "Error: Couldn't open tracker: %(message)s"
12881325
msgstr "Fehler: Die Tracker-Instanz konnte nicht geöffnet werden: %(message)s"
12891326

1290-
#: ../roundup/admin.py:1851
1327+
#: ../roundup/admin.py:1927
12911328
#, python-format
12921329
msgid ""
12931330
"Roundup %s ready for input.\n"
@@ -1296,15 +1333,15 @@ msgstr ""
12961333
"Roundup %s ist bereit.\n"
12971334
"Schreiben Sie \"help\", um zur Hilfe zu gelangen."
12981335

1299-
#: ../roundup/admin.py:1856
1336+
#: ../roundup/admin.py:1932
13001337
msgid "Note: command history and editing not available"
13011338
msgstr "Bemerkung: Befehlsverlauf/-bearbeitung möglicherweise nicht verfügbar"
13021339

1303-
#: ../roundup/admin.py:1862
1340+
#: ../roundup/admin.py:1938
13041341
msgid "exit..."
13051342
msgstr "beenden..."
13061343

1307-
#: ../roundup/admin.py:1875
1344+
#: ../roundup/admin.py:1951
13081345
msgid "There are unsaved changes. Commit them (y/N)? "
13091346
msgstr "Es gibt noch ungespeicherte Änderungen. Änderungen speichern (y/N)?"
13101347

@@ -5663,6 +5700,9 @@ msgstr "Aufgabe anzeigen"
56635700
msgid "Password"
56645701
msgstr "Passwort"
56655702

5703+
#~ msgid "Tracker updated"
5704+
#~ msgstr "Tracker aktualisiert"
5705+
56665706
#~ msgid "roundup> "
56675707
#~ msgstr "roundup> "
56685708

locale/en.po

Lines changed: 52 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ msgid ""
1111
msgstr ""
1212
"Project-Id-Version: Roundup 2.3.0\n"
1313
"Report-Msgid-Bugs-To: [email protected]\n"
14-
"POT-Creation-Date: 2023-03-01 12:54-0500\n"
14+
"POT-Creation-Date: 2023-03-03 17:28-0500\n"
1515
"PO-Revision-Date: 2004-11-20 13:47+0200\n"
1616
"Last-Translator: Not applicable\n"
1717
"Language-Team: English\n"
@@ -846,55 +846,92 @@ msgid ""
846846
msgstr ""
847847

848848
#: ../roundup/admin.py:1742
849-
msgid "Tracker updated"
849+
#, python-format
850+
msgid "Tracker updated to schema version %s."
851+
msgstr ""
852+
853+
#: ../roundup/admin.py:1746
854+
#, python-format
855+
msgid "No migration action required. At schema version %s."
856+
msgstr ""
857+
858+
#: ../roundup/admin.py:1751
859+
msgid ""
860+
"Usage: perftest [mode] [arguments]*\n"
861+
"\n"
862+
" Time operations in Roundup. Supported arguments:\n"
863+
"\n"
864+
" [password] [rounds=<integer>] [scheme=<scheme>]\n"
865+
"\n"
866+
" 'password' is the default mode. The tracker's config.ini\n"
867+
" setting for 'password_pbkdf2_default_rounds' is the default\n"
868+
" value for 'rounds'. On the command line, 'rounds' can include\n"
869+
" thousands separator of ',' or '.'. 'scheme' is the default\n"
870+
" coded into Roundup. List supported schemes by using 'scheme='.\n"
871+
"\n"
872+
" "
873+
msgstr ""
874+
875+
#: ../roundup/admin.py:1785
876+
msgid "Invalid 'rounds'. Must be larger than 999."
877+
msgstr ""
878+
879+
#: ../roundup/admin.py:1789
880+
#, python-format
881+
msgid "Invalid 'rounds'. It must be an integer not: %s"
850882
msgstr ""
851883

852-
#: ../roundup/admin.py:1745
853-
msgid "No migration action required"
884+
#: ../roundup/admin.py:1816
885+
msgid "scheme does not support rounds."
854886
msgstr ""
855887

856-
#: ../roundup/admin.py:1771
888+
#: ../roundup/admin.py:1819
889+
#, python-format
890+
msgid "Hash time: %(time)0.9f seconds, scheme: %(scheme)s, rounds: %(rounds)s"
891+
msgstr ""
892+
893+
#: ../roundup/admin.py:1847
857894
#, python-format
858895
msgid "Unknown command \"%(command)s\" (\"help commands\" for a list)"
859896
msgstr ""
860897

861-
#: ../roundup/admin.py:1777
898+
#: ../roundup/admin.py:1853
862899
#, python-format
863900
msgid "Multiple commands match \"%(command)s\": %(list)s"
864901
msgstr ""
865902

866-
#: ../roundup/admin.py:1786
903+
#: ../roundup/admin.py:1862
867904
msgid "Enter tracker home: "
868905
msgstr ""
869906

870-
#: ../roundup/admin.py:1795 ../roundup/admin.py:1801 ../roundup/admin.py:1838
871-
#: ../roundup/admin.py:1795:1801:1838
907+
#: ../roundup/admin.py:1871 ../roundup/admin.py:1877 ../roundup/admin.py:1914
908+
#: ../roundup/admin.py:1871:1877:1914
872909
#, python-format
873910
msgid "Error: %(message)s"
874911
msgstr ""
875912

876-
#: ../roundup/admin.py:1811 ../roundup/admin.py:1815
877-
#: ../roundup/admin.py:1811:1815
913+
#: ../roundup/admin.py:1887 ../roundup/admin.py:1891
914+
#: ../roundup/admin.py:1887:1891
878915
#, python-format
879916
msgid "Error: Couldn't open tracker: %(message)s"
880917
msgstr ""
881918

882-
#: ../roundup/admin.py:1851
919+
#: ../roundup/admin.py:1927
883920
#, python-format
884921
msgid ""
885922
"Roundup %s ready for input.\n"
886923
"Type \"help\" for help."
887924
msgstr ""
888925

889-
#: ../roundup/admin.py:1856
926+
#: ../roundup/admin.py:1932
890927
msgid "Note: command history and editing not available"
891928
msgstr ""
892929

893-
#: ../roundup/admin.py:1862
930+
#: ../roundup/admin.py:1938
894931
msgid "exit..."
895932
msgstr ""
896933

897-
#: ../roundup/admin.py:1875
934+
#: ../roundup/admin.py:1951
898935
msgid "There are unsaved changes. Commit them (y/N)? "
899936
msgstr ""
900937

0 commit comments

Comments
 (0)