How to change the password after postfixadmin forgets the password?
This document describes how to change the password after postfixadmin forgets the password. We will share this with you for your reference. The details are as follows:
Postfix Admin is a Web-based Postfix email sending server management tool that can directly manage Postfix virtual domain names and users.
Because postfixadmin was not used to add or delete users for a while, you suddenly forgot the management password when using it. You can use a foreigner's method to change the password directly in the database, and then log on successfully.
Php source code:
<? Phpecho md5crypt ("new password"); // md5crypt // Action: Creates MD5 encrypted password // Call: md5crypt (string cleartextpassword) function md5crypt ($ pw, $ salt = "", $ magic = "") {$ MAGIC = "$1 $"; if ($ magic = "") {$ magic = $ MAGIC ;} if ($ salt = "") {$ salt = create_salt () ;}$ slist = explode ("$", $ salt ); if (isset ($ slist [0]) & $ slist [0] = "1") {$ salt = $ slist [1];} $ salt = substr ($ salt, 0, 8); $ ctx = $ pw. $ magic. $ salt; $ final = hex2bin (md5 ($ pw. $ salt. $ pw); for ($ I = strlen ($ pw); $ I> 0; $ I-= 16) {if ($ I> 16) {$ ctx. = substr ($ final, 0, 16);} else {$ ctx. = substr ($ final, 0, $ I) ;} I I = strlen ($ pw); while ($ I> 0) {if ($ I & 1) {$ ctx. = chr (0);} else {$ ctx. = $ pw [0] ;}$ I => I >> 1 ;}$ final = hex2bin (md5 ($ ctx); for ($ I = 0; $ I <1000; $ I ++) {$ ctx1 = ""; if ($ I & 1) {$ ctx1. = $ pw;} else {$ ctx1. = substr ($ final, 0, 16);} if ($ I % 3) {$ ctx1. = $ salt;} if ($ I % 7) {$ ctx1. = $ pw;} if ($ I & 1) {$ ctx1. = substr ($ final, 0, 16);} else {$ ctx1. = $ pw ;}$ final = hex2bin (md5 ($ ctx1) ;}$ passwd = ""; $ passwd. = to64 (ord ($ final [0]) <16) | (ord ($ final [6]) <8) | (ord ($ final [12]), 4); $ passwd. = to64 (ord ($ final [1]) <16) | (ord ($ final [7]) <8) | (ord ($ final [13]), 4); $ passwd. = to64 (ord ($ final [2]) <16) | (ord ($ final [8]) <8) | (ord ($ final [14]), 4); $ passwd. = to64 (ord ($ final [3]) <16) | (ord ($ final [9]) <8) | (ord ($ final [15]), 4); $ passwd. = to64 (ord ($ final [4]) <16) | (ord ($ final [10]) <8) | (ord ($ final [5]), 4); $ passwd. = to64 (ord ($ final [11]), 2); return $ magic. $ salt. '$ '. $ passwd;} function create_salt () {srand (double) microtime () * 1000000); return substr (md5 (rand (), 0, 8 );} // PHP around 5.3.8 includes hex2bin as native function-http://php.net/hex2binfunction hex2bin ($ str) {$ len = strlen ($ str); $ nstr = ""; for ($ I = 0; $ I <$ len; $ I + = 2) {$ num = sscanf (substr ($ str, $ I, 2), "% x"); $ nstr. = chr ($ num [0]);} return $ nstr;} function to64 ($ v, $ n) {$ ITOA64 = ". /0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz "; $ ret =" "; while ($ n-1)> = 0) {$ n --; $ ret. = $ ITOA64 [$ v & 0x3f]; $ v = $ v> 6;} return $ ret ;}