From: Chip Black Date: Tue, 19 Jul 2011 01:58:47 +0000 (-0500) Subject: Add tool to convert old plain passwords to MD5 X-Git-Tag: v1.6~1 X-Git-Url: http://git.bytex64.net/?a=commitdiff_plain;h=4cb5e55ccf51bafceafa493fb0596fd00d5e551d;p=blerg.git Add tool to convert old plain passwords to MD5 --- diff --git a/tools/convert_to_md5_passwords.pl b/tools/convert_to_md5_passwords.pl new file mode 100644 index 0000000..a129715 --- /dev/null +++ b/tools/convert_to_md5_passwords.pl @@ -0,0 +1,23 @@ +#!/usr/bin/perl +# Yes, we were storing passwords in plain text. +use Digest::MD5 qw/md5/; +use strict; + +my $datadir = shift; + +opendir DATA, $datadir; +while (my $user = readdir(DATA)) { + next if $user =~ /^\./; + print "Processing $user\n"; + open P, "$datadir/$user/password"; + my $password =

; + close P; + chomp $password; + + my $md5password = md5($user . $password); + + rename "$datadir/$user/password", "$datadir/$user/password.old"; + open P, ">$datadir/$user/password"; + print P $md5password; + close P; +}