On 2021-06-16 5:23 a.m., Kevin N. wrote:
I am using 'doveadm pw' from inside a bash script to generate the salted hash 
for a user provided password.
I call it like: doveadm pw -s SHA256-CRYPT -u $user -p $password

Is there any possible way to use piping (so it won't show up in ps for example) 
to pass the username and password to 'doveadm pw' instead of using arguments?

% man doveadm-pw

-p password
              The plain text password for which the hash should be generated.  If no password was given doveadm(1)  will  prompt interac‐
              tively for one.
-u user
              When the DIGEST-MD5 scheme is used, also the user name must be given...  (so -u not needed here)

% doveadm pw -s SHA256-CRYPT
Enter new password: ******
Retype new password: ******
{SHA256-CRYPT}$5$yatls3zWaSMgSrue$FOlWYSb.......

% cat /tmp/test
test123
test123

% cat /tmp/test | doveadm pw -s SHA256-CRYPT
{SHA256-CRYPT}$5$rq.EciaKLycIT61g$smeKtkpQ........

Reply via email to