Cpanel Restore script

Post Reply
jonijoni
Posts: 21
Joined: Wed Sep 30, 2020 4:36 pm

Hallo, from the Cpanel Restore script I can see that it is generating new passwords for all email accounts, is there any way for keeping old password, because I have one account with 300 emails and it will be quite difficult to inform all users for new passwords
BR
User avatar
myVesta
Site Admin
Posts: 928
Joined: Fri Jun 19, 2020 9:59 am
Has thanked: 8 times
Been thanked: 6 times

Unfortunately, not.
Vesta is using MD5 hash function for passwords hashes, and cPanel uses (I think) SHA-256 algorithm.
Both algorithms are one-way-only, so there is no way to get decrypted value (in order to crypt it again with MD5 algorithm).
You can only set old passwords manually, if you know them.
You can also make bash script to set passwords quickly:

Code: Select all

v-change-mail-account-password yourVestaUsername domain.com mail_username1 somepass
v-change-mail-account-password yourVestaUsername domain.com mail_username2 somepass
v-change-mail-account-password yourVestaUsername domain.com mail_username3 somepass
....
katycomputer
Posts: 1
Joined: Wed Sep 08, 2021 12:55 am

I checked with the Dovecot support group, /home/account/conf/mail/domain.com/passwd can have a mixture of MD5 & SHA512-CRYPT, so it should be able to keep the existing passwords.
Reference: https://dovecot.org/pipermail/dovecot/2 ... 23010.html
User avatar
myVesta
Site Admin
Posts: 928
Joined: Fri Jun 19, 2020 9:59 am
Has thanked: 8 times
Been thanked: 6 times

katycomputer wrote: Sun Sep 12, 2021 5:50 am I checked with the Dovecot support group, /home/account/conf/mail/domain.com/passwd can have a mixture of MD5 & SHA512-CRYPT, so it should be able to keep the existing passwords.
Reference: https://dovecot.org/pipermail/dovecot/2 ... 23010.html
wow!
did you checked is it working?
User avatar
myVesta
Site Admin
Posts: 928
Joined: Fri Jun 19, 2020 9:59 am
Has thanked: 8 times
Been thanked: 6 times

Actually, our importer script will not copy mail passwords from cPanel, we must do it manually, for testing purposes.
But if it's working, we can modify importer script to do it automatically.
User avatar
myVesta
Site Admin
Posts: 928
Joined: Fri Jun 19, 2020 9:59 am
Has thanked: 8 times
Been thanked: 6 times

It works !
I manually copy-pasted passwords from cpanel_backup_extracted_folder/homedir/etc/mydomain.com/shadow
to /home/myuser/conf/mail/mydomain.com/passwd
in format

Code: Select all

testacc:{SHA512-CRYPT}***copy-pasted-password***:myuser:mail::/home/myuser:0
I will see now to make copying passwords automatically.
User avatar
myVesta
Site Admin
Posts: 928
Joined: Fri Jun 19, 2020 9:59 am
Has thanked: 8 times
Been thanked: 6 times

Done - https://github.com/myvesta/vesta/commit ... 3727482d8c

In order to get this fix, run:

Code: Select all

rm /var/cache/apt/archives/vesta_0.9.*
apt update && apt install --reinstall vesta
Post Reply