Skip to content

Commit d168b49

Browse files
authored
fix: no longer use /dev/stdin in cryptsetup commands (#77)
1 parent 6430012 commit d168b49

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

pkg/driver/luks_utils.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ func luksFormat(devicePath string, passphrase string) error {
2222
"--hash", defaultLuksHash, // hash algorithm
2323
"--cipher", defaultLuksCipher, // the cipher used
2424
"--key-size", defaultLuksKeyize, // the size of the encryption key
25-
devicePath, // device to encrypt
26-
"--key-file", "/dev/stdin", // read the passphrase from stdin
25+
devicePath, // device to encrypt
26+
"--key-file", "-", // read the passphrase from stdin
2727
}
2828

2929
luksFormatCmd := exec.Command(cryptsetupCmd, args...)
@@ -38,10 +38,10 @@ func luksFormat(devicePath string, passphrase string) error {
3838

3939
func luksOpen(devicePath string, mapperFile string, passphrase string) error {
4040
args := []string{
41-
"luksOpen", // open
42-
devicePath, // device to open
43-
mapperFile, // mapper file in which to open the device
44-
"--key-file", "/dev/stdin", // read the passphrase from stdin
41+
"luksOpen", // open
42+
devicePath, // device to open
43+
mapperFile, // mapper file in which to open the device
44+
"--key-file", "-", // read the passphrase from stdin
4545
}
4646

4747
luksOpenCmd := exec.Command(cryptsetupCmd, args...)
@@ -71,9 +71,9 @@ func luksClose(mapperFile string) error {
7171

7272
func luksResize(mapperFile, passphrase string) error {
7373
args := []string{
74-
"resize", // resize
75-
mapperFile, // mapper file to resize
76-
"--key-file", "/dev/stdin", // read the passphrase from stdin
74+
"resize", // resize
75+
mapperFile, // mapper file to resize
76+
"--key-file", "-", // read the passphrase from stdin
7777
}
7878

7979
luksResizeCmd := exec.Command(cryptsetupCmd, args...)

0 commit comments

Comments
 (0)