Place a passphrase file into a remote server

dan07

New Member
Joined
Jun 18, 2022
Messages
2
Reaction score
0
Credits
24
Hello,

I am trying to unlock a luks encrypted drive using a passphrase located into a remote server. In order to test if the retrieval process works properly, I got a code from https://withblue.ink/2020/01/19/auto-mounting-encrypted-drives-with-a-remote-key-on-linux.html and executed the following command into terminal:


I adjusted the above command with my own azure address and it worked well and I got the passphrase into the terminal screen (even dropping a part of the code suggested into the withblue website; "| base64 -d").

However, when I place the whole script code (showed below) into the file (/etc/luks-key/luks-18TB) to retrieve the passphrase, the passphrase field into disks application reads the script code and not the passphrase retrieved by the code.

#!/bin/sh
set -e
# Request the file from Azure Blob Storage using the URL with the SAS token, then pipe it through `base64 -d` to decode it from base64
curl -s "https://ln5bxfzbl0tlf5z.blob.core.w...=gkaN2OSzN2zj1WSAPiLJMgtkcXLi2Y8EOVdBUmZQh88=" | base64 -d

Find below two screenshots showing what I expect to get into the passphrase field and what I am actually getting.

What am I missing? How should I proceed to have the script retrieving my passphrase from a remote server and unlocking my local drive?

Thanks a lot for the support.

Plain passphrase.png


Script to retrieve passphrase.png
 


$100 Digital Ocean Credit
Get a free VM to test out Linux!


Top