<div dir="ltr"><div dir="ltr"><div dir="ltr">Hello Lennart. Thanks for your response. I did not express myself correctly.<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jun 6, 2024 at 7:05 PM Lennart Poettering <<a href="mailto:lennart@poettering.net">lennart@poettering.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Mi, 05.06.24 15:36, Sergio Arroutbi (<a href="mailto:sarroutb@redhat.com" target="_blank">sarroutb@redhat.com</a>) wrote:<br>
<br>
> Hello. I have tried with headless=yes. The issue with this is that<br>
> systemd-cryptsetup ends, so I can not provide the password for decryption<br>
> through socket provided in /run/systemd/ask-password/sck.numbers<br>
><br>
> I miss an option where systemd-cryptsetup is executed headless, but<br>
> continues running, without exiting.<br>
><br>
> I have tried with keyfile=/dev/urandom and option=keyfile-size=600000, but<br>
> it is too quick. I also tried try-empty-password, but this is tried only<br>
> once.<br>
><br>
> I am running out of ideas.<br>
<br>
Hmm, I am not sure I follow? So do you or do you not want cryptsetup<br>
ask for passwrds via the ask-password agent stuff?<br></blockquote><div><br></div><div>We are developing a PKCS11 plugin for Clevis (<a href="https://github.com/latchset/clevis">https://github.com/latchset/clevis</a>). Clevis allows automatic boot encrypted disks unlocking by storing some information into LUKS metadata.</div><div>To do so, it is executed in parallel to systemd-cryptsetup and, while the password is prompted to the user (and the agent runs), Clevis provides the key</div><div>by writing to the systemd-cryptsetup ask-password socket. <br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
I initially thought you don't, but now you do?<br></blockquote><div><br></div><div>Let me explain myself. What we want now is to disable systemd-cryptenroll password prompt at boot, (as our software already asks for the PKCS11 PIN), and provide the password as we are doing now,</div><div>by using the socket provided through the agent system. We just want systemd-cryptenroll to not ask for a password in the boot console. I don´t know if there is an option to disable it,</div><div>as using "headless" makes our software not able to communicate the PIN to systemd-cryptenroll. I have tried using a "fake" keyfile (/dev/urandom) in crypttab with the highest possible length,</div><div>but systemd-cryptenroll ends. I have also tried other crypttab options (such as retries, other timeouts, etc.), with no luck.</div><div>Ideally, a mechanism to make systemd-cryptsetup to be waiting for the password through the agent (and not the console) would be enough.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Or do you want to filter stuff, i.e. that<br>
systemd-ask-password-agent-tty only does its thing if asked for some<br>
passwords, but not for others?<br></blockquote><div><br></div><div>According to api-password.h, (systemd/src/shared/) you can provide different options:<br>        ASK_PASSWORD_ACCEPT_CACHED = 1 << 0, /* read from kernel keyring */                                                                                                          <br>...                                                                       <br>        ASK_PASSWORD_NO_TTY        = 1 << 4, /* never ask for password on tty */</div><div>...                                                                                                     <br>        ASK_PASSWORD_HEADLESS      = 1 << 9, /* headless mode: never query interactively */     </div><div> </div><div>So, using headless mode in crypttab should be the way, but it makes systemd-cryptsetup to exit, and we can not inject the password.<br><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
if that's what you want, let's take a step back, what are you actually<br>
trying to do? Can you describe your scenario better?<br></blockquote><div><br></div><div>I hope the previous description helps.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Lennart<br>
<br>
--<br>
Lennart Poettering, Berlin<br>
<br>
</blockquote></div></div><div dir="ltr"><br></div><div>Thank you very much<br clear="all"></div><div dir="ltr"><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr">Sergio Arroutbi Braojos<br>Senior Software Engineer at Red Hat - Special Projects (SECENGSP)<br><a href="http://redhat.com" target="_blank">Red Hat</a><br></div></div></div></div>