Piping to doveadm pw

Kevin N. kevin at notscheduled.eu
Wed Jun 16 20:19:12 EEST 2021


Oscar del Rio <delrio at mie.utoronto.ca> wrote:

> 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........

Thanks. Reading the manual was the first thing I did before posting to the list.

I'm not sure if this is relevant for the question, but I forgot to mention that the user enters it's password through a 'dialog --passwordbox'.

I guess my question is: it possible to pipe that into 'doveadm pw' directly from memory, without using any kind of on-disk temp file?


More information about the dovecot mailing list