Compare commits
12 Commits
Author | SHA1 | Date | |
---|---|---|---|
79e9a37806
|
|||
d16118e695
|
|||
6e53449ff6
|
|||
fbcfdea96b
|
|||
99e408cc8d
|
|||
8fc9e0dcce
|
|||
95a4f97f58
|
|||
5290ef5e42
|
|||
94fa5555e0
|
|||
bd97e25dd8
|
|||
a1ed3f7f8e
|
|||
50fad9ce92
|
20
.drone.yml
20
.drone.yml
@@ -12,3 +12,23 @@ steps:
|
|||||||
commands:
|
commands:
|
||||||
- apt update && apt install -y libcryptsetup-dev libkeyutils-dev
|
- apt update && apt install -y libcryptsetup-dev libkeyutils-dev
|
||||||
- cargo test
|
- cargo test
|
||||||
|
|
||||||
|
- name: build
|
||||||
|
image: rust:1.37.0
|
||||||
|
commands:
|
||||||
|
- apt update && apt install -y libcryptsetup-dev libkeyutils-dev
|
||||||
|
- cargo install -f --path . --root .
|
||||||
|
when:
|
||||||
|
event: tag
|
||||||
|
- name: publish
|
||||||
|
image: plugins/github-release
|
||||||
|
settings:
|
||||||
|
api_key:
|
||||||
|
from_secret: github_release
|
||||||
|
files:
|
||||||
|
- bin/fido2luks
|
||||||
|
checksum:
|
||||||
|
- md5
|
||||||
|
- sha256
|
||||||
|
when:
|
||||||
|
event: tag
|
||||||
|
83
Cargo.lock
generated
83
Cargo.lock
generated
@@ -24,11 +24,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "backtrace"
|
name = "backtrace"
|
||||||
version = "0.3.37"
|
version = "0.3.38"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)",
|
"backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
@@ -44,16 +44,16 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bitflags"
|
name = "bitflags"
|
||||||
version = "1.1.0"
|
version = "1.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "blkid-rs"
|
name = "blkid-rs"
|
||||||
version = "0.1.1"
|
version = "0.1.2"
|
||||||
source = "git+https://github.com/shimunn/cryptsetup-rs.git?branch=destroy#2f3e0e20a4619e09750e759c96286f32c2baa2fa"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"uuid 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"uuid 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -77,7 +77,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cfg-if"
|
name = "cfg-if"
|
||||||
version = "0.1.9"
|
version = "0.1.10"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -87,7 +87,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
"atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bitflags 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@@ -99,26 +99,26 @@ name = "cloudabi"
|
|||||||
version = "0.0.3"
|
version = "0.0.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bitflags 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cryptsetup-rs"
|
name = "cryptsetup-rs"
|
||||||
version = "0.2.0"
|
version = "0.2.1"
|
||||||
source = "git+https://github.com/shimunn/cryptsetup-rs.git?branch=destroy#2f3e0e20a4619e09750e759c96286f32c2baa2fa"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"blkid-rs 0.1.1 (git+https://github.com/shimunn/cryptsetup-rs.git?branch=destroy)",
|
"blkid-rs 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"errno 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"errno 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libcryptsetup-sys 0.1.1 (git+https://github.com/shimunn/cryptsetup-rs.git?branch=destroy)",
|
"libcryptsetup-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"uuid 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"uuid 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ctap"
|
name = "ctap_hmac"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
source = "git+https://github.com/shimunn/ctap.git?branch=hmac_ext#3d3679d5b9a8c8cc90edb969c0f187740a3f2480"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"cbor-codec 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cbor-codec 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@@ -156,7 +156,7 @@ name = "failure"
|
|||||||
version = "0.1.5"
|
version = "0.1.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"backtrace 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)",
|
"backtrace 0.3.38 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -173,13 +173,13 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fido2luks"
|
name = "fido2luks"
|
||||||
version = "0.1.0"
|
version = "0.2.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cryptsetup-rs 0.2.0 (git+https://github.com/shimunn/cryptsetup-rs.git?branch=destroy)",
|
"cryptsetup-rs 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ctap 0.1.0 (git+https://github.com/shimunn/ctap.git?branch=hmac_ext)",
|
"ctap_hmac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libcryptsetup-sys 0.1.1 (git+https://github.com/shimunn/cryptsetup-rs.git?branch=destroy)",
|
"libcryptsetup-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rpassword 4.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rpassword 4.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"structopt 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"structopt 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@@ -220,8 +220,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libcryptsetup-sys"
|
name = "libcryptsetup-sys"
|
||||||
version = "0.1.1"
|
version = "0.1.2"
|
||||||
source = "git+https://github.com/shimunn/cryptsetup-rs.git?branch=destroy#2f3e0e20a4619e09750e759c96286f32c2baa2fa"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"pkg-config 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"pkg-config 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@@ -232,7 +232,7 @@ name = "log"
|
|||||||
version = "0.4.8"
|
version = "0.4.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -263,7 +263,7 @@ name = "proc-macro-error"
|
|||||||
version = "0.2.6"
|
version = "0.2.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"proc-macro2 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
@@ -278,7 +278,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "1.0.3"
|
version = "1.0.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@@ -297,7 +297,7 @@ name = "quote"
|
|||||||
version = "1.0.2"
|
version = "1.0.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"proc-macro2 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -493,7 +493,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"proc-macro-error 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"proc-macro-error 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"proc-macro2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"proc-macro2 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
@@ -513,7 +513,7 @@ name = "syn"
|
|||||||
version = "1.0.5"
|
version = "1.0.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"proc-macro2 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
@@ -574,11 +574,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "uuid"
|
name = "uuid"
|
||||||
version = "0.6.5"
|
version = "0.7.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -609,18 +608,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
|
"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
|
||||||
"checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90"
|
"checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90"
|
||||||
"checksum autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b671c8fb71b457dd4ae18c4ba1e59aa81793daacc361d82fcd410cef0d491875"
|
"checksum autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b671c8fb71b457dd4ae18c4ba1e59aa81793daacc361d82fcd410cef0d491875"
|
||||||
"checksum backtrace 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)" = "5180c5a20655b14a819b652fd2378fa5f1697b6c9ddad3e695c2f9cedf6df4e2"
|
"checksum backtrace 0.3.38 (registry+https://github.com/rust-lang/crates.io-index)" = "690a62be8920ccf773ee00ef0968649b0e724cda8bd5b12286302b4ae955fdf5"
|
||||||
"checksum backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)" = "82a830b4ef2d1124a711c71d263c5abdc710ef8e907bd508c88be475cebc422b"
|
"checksum backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)" = "82a830b4ef2d1124a711c71d263c5abdc710ef8e907bd508c88be475cebc422b"
|
||||||
"checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd"
|
"checksum bitflags 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8a606a02debe2813760609f57a64a2ffd27d9fdf5b2f133eaca0b248dd92cdd2"
|
||||||
"checksum blkid-rs 0.1.1 (git+https://github.com/shimunn/cryptsetup-rs.git?branch=destroy)" = "<none>"
|
"checksum blkid-rs 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5056e517a69878f709dadf9f311a8f4519e67446d1a748001ec7226ea1e71dd0"
|
||||||
"checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5"
|
"checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5"
|
||||||
"checksum cbor-codec 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e083a023562b37c52837e850131a51b1154cceb9d149f41ee3d386737b140f46"
|
"checksum cbor-codec 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e083a023562b37c52837e850131a51b1154cceb9d149f41ee3d386737b140f46"
|
||||||
"checksum cc 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)" = "4fc9a35e1f4290eb9e5fc54ba6cf40671ed2a2514c3eeb2b2a908dda2ea5a1be"
|
"checksum cc 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)" = "4fc9a35e1f4290eb9e5fc54ba6cf40671ed2a2514c3eeb2b2a908dda2ea5a1be"
|
||||||
"checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33"
|
"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
|
||||||
"checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9"
|
"checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9"
|
||||||
"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
|
"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
|
||||||
"checksum cryptsetup-rs 0.2.0 (git+https://github.com/shimunn/cryptsetup-rs.git?branch=destroy)" = "<none>"
|
"checksum cryptsetup-rs 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8b1eb6abff80fdc7b52c37b3e58f5a4cbda78bffc01ac7b02c1296552a07028a"
|
||||||
"checksum ctap 0.1.0 (git+https://github.com/shimunn/ctap.git?branch=hmac_ext)" = "<none>"
|
"checksum ctap_hmac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4f91b9400ac9c99e3280065f5bfd6eb7f0a9bb737a7fd166fda4153338e115e3"
|
||||||
"checksum errno 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c2a071601ed01b988f896ab14b95e67335d1eeb50190932a1320f7fe3cadc84e"
|
"checksum errno 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c2a071601ed01b988f896ab14b95e67335d1eeb50190932a1320f7fe3cadc84e"
|
||||||
"checksum errno-dragonfly 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "14ca354e36190500e1e1fb267c647932382b54053c50b14970856c0b00a35067"
|
"checksum errno-dragonfly 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "14ca354e36190500e1e1fb267c647932382b54053c50b14970856c0b00a35067"
|
||||||
"checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2"
|
"checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2"
|
||||||
@@ -631,14 +630,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
"checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77"
|
"checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77"
|
||||||
"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||||
"checksum libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)" = "34fcd2c08d2f832f376f4173a231990fa5aef4e99fb569867318a227ef4c06ba"
|
"checksum libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)" = "34fcd2c08d2f832f376f4173a231990fa5aef4e99fb569867318a227ef4c06ba"
|
||||||
"checksum libcryptsetup-sys 0.1.1 (git+https://github.com/shimunn/cryptsetup-rs.git?branch=destroy)" = "<none>"
|
"checksum libcryptsetup-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f8cab37dfc7316ea263a42ffa51b4b75c9022538576350d7a416de697384f596"
|
||||||
"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
|
"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
|
||||||
"checksum num-derive 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "eafd0b45c5537c3ba526f79d3e75120036502bebacbb3f3220914067ce39dbf2"
|
"checksum num-derive 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "eafd0b45c5537c3ba526f79d3e75120036502bebacbb3f3220914067ce39dbf2"
|
||||||
"checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32"
|
"checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32"
|
||||||
"checksum pkg-config 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)" = "72d5370d90f49f70bd033c3d75e87fc529fbfff9d6f7cccef07d6170079d91ea"
|
"checksum pkg-config 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)" = "72d5370d90f49f70bd033c3d75e87fc529fbfff9d6f7cccef07d6170079d91ea"
|
||||||
"checksum proc-macro-error 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "aeccfe4d5d8ea175d5f0e4a2ad0637e0f4121d63bd99d356fb1f39ab2e7c6097"
|
"checksum proc-macro-error 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "aeccfe4d5d8ea175d5f0e4a2ad0637e0f4121d63bd99d356fb1f39ab2e7c6097"
|
||||||
"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
|
"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
|
||||||
"checksum proc-macro2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e98a83a9f9b331f54b924e68a66acb1bb35cb01fb0a23645139967abefb697e8"
|
"checksum proc-macro2 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "90cf5f418035b98e655e9cdb225047638296b862b42411c4e45bb88d700f7fc0"
|
||||||
"checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1"
|
"checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1"
|
||||||
"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe"
|
"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe"
|
||||||
"checksum rand 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)" = "64ac302d8f83c0c1974bf758f6b041c6c8ada916fbb44a609158ca8b064cc76c"
|
"checksum rand 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)" = "64ac302d8f83c0c1974bf758f6b041c6c8ada916fbb44a609158ca8b064cc76c"
|
||||||
@@ -673,7 +672,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
|
"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
|
||||||
"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
|
"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
|
||||||
"checksum untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "55cd1f4b4e96b46aeb8d4855db4a7a9bd96eeeb5c6a1ab54593328761642ce2f"
|
"checksum untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "55cd1f4b4e96b46aeb8d4855db4a7a9bd96eeeb5c6a1ab54593328761642ce2f"
|
||||||
"checksum uuid 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e1436e58182935dcd9ce0add9ea0b558e8a87befe01c1a301e6020aeb0876363"
|
"checksum uuid 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)" = "90dbc611eb48397705a6b0f6e917da23ae517e4d127123d2cf7674206627d32a"
|
||||||
"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a"
|
"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a"
|
||||||
"checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6"
|
"checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6"
|
||||||
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||||
|
20
Cargo.toml
20
Cargo.toml
@@ -1,14 +1,24 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "fido2luks"
|
name = "fido2luks"
|
||||||
version = "0.1.0"
|
version = "0.2.1"
|
||||||
authors = ["shimunn <shimun@shimun.net>"]
|
authors = ["shimunn <shimun@shimun.net>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
|
description = "Decrypt your LUKS partition using a FIDO2 compatible authenticator"
|
||||||
|
documentation = "https://github.com/shimunn/fido2luks/blob/master/README.md"
|
||||||
|
homepage = "https://github.com/shimunn/fido2luks"
|
||||||
|
repository = "https://github.com/shimunn/fido2luks"
|
||||||
|
readme = "README.md"
|
||||||
|
keywords = ["luks", "fido2", "u2f"]
|
||||||
|
categories = ["command-line-utilities"]
|
||||||
|
license-file = "LICENSE"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
ctap = { git = "https://github.com/shimunn/ctap.git", branch = "hmac_ext" }
|
#ctap = "0.1.0"
|
||||||
#cryptsetup-rs = "0.2.0"
|
ctap_hmac = "0.1.1"
|
||||||
cryptsetup-rs = { git = "https://github.com/shimunn/cryptsetup-rs.git", branch = "destroy" }
|
cryptsetup-rs = "0.2.1"
|
||||||
libcryptsetup-sys = { git = "https://github.com/shimunn/cryptsetup-rs.git", branch = "destroy" }
|
libcryptsetup-sys = "0.1.2"
|
||||||
|
|
||||||
|
|
||||||
hex = "0.3.2"
|
hex = "0.3.2"
|
||||||
rust-crypto = "0.2.36"
|
rust-crypto = "0.2.36"
|
||||||
|
51
README.md
51
README.md
@@ -1,6 +1,6 @@
|
|||||||
# fido2luks
|
# fido2luks [](https://crates.io/crates/fido2luks)
|
||||||
|
|
||||||
This will allow you to unlock your luks encrypted disk with an fido2 compatable key
|
This will allow you to unlock your luks encrypted disk with an fido2 compatible key
|
||||||
|
|
||||||
Note: This has only been tested under Fedora 30 using a Solo Key
|
Note: This has only been tested under Fedora 30 using a Solo Key
|
||||||
|
|
||||||
@@ -20,13 +20,13 @@ git clone https://github.com/shimunn/fido2luks.git && cd fido2luks
|
|||||||
#Alternativly cargo build --release && sudo cp target/release/fido2luks /usr/bin/
|
#Alternativly cargo build --release && sudo cp target/release/fido2luks /usr/bin/
|
||||||
CARGO_INSTALL_ROOT=/usr sudo -E cargo install -f --path .
|
CARGO_INSTALL_ROOT=/usr sudo -E cargo install -f --path .
|
||||||
|
|
||||||
echo FIDO2LUKS_CREDENTIAL_ID=$(fido2luks credential) >> fido2luks.conf
|
echo FIDO2LUKS_CREDENTIAL_ID=$(fido2luks credential) >> dracut/96luks-2fa/fido2luks.conf
|
||||||
|
|
||||||
set -a
|
set -a
|
||||||
. fido2luks.conf
|
. dracut/96luks-2fa/fido2luks.conf
|
||||||
|
|
||||||
#Repeat for each luks volume
|
#Repeat for each luks volume
|
||||||
sudo -E fido2luks -i addkey /dev/disk/by-uuid/<DISK_UUID>
|
sudo -E fido2luks -i add-key /dev/disk/by-uuid/<DISK_UUID>
|
||||||
|
|
||||||
#Test(only works if the luks container isn't active)
|
#Test(only works if the luks container isn't active)
|
||||||
sudo -E fido2luks -i open /dev/disk/by-uuid/<DISK_UUID> luks-<DISK_UUID>
|
sudo -E fido2luks -i open /dev/disk/by-uuid/<DISK_UUID> luks-<DISK_UUID>
|
||||||
@@ -43,14 +43,22 @@ sudo make install
|
|||||||
|
|
||||||
### Grub
|
### Grub
|
||||||
|
|
||||||
Add `rd.luks.2fa=<CREDENTIAL_ID>:<DISK_UUID>` to `GRUB_CMDLINE_LINUX`
|
Add `rd.luks.2fa=<CREDENTIAL_ID>:<DISK_UUID>` to `GRUB_CMDLINE_LINUX` in /etc/default/grub
|
||||||
|
|
||||||
Note: This is only required for your root disk, systemd will try to unlock all other luks partions using the same key if you added it using `fido2luks addkey`
|
Note: This is only required for your root disk, systemd will try to unlock all other luks partions using the same key if you added it using `fido2luks add-key`
|
||||||
|
|
||||||
```
|
```
|
||||||
grub2-mkconfig > /boot/grub2/grub.cfg
|
grub2-mkconfig > /boot/grub2/grub.cfg
|
||||||
```
|
```
|
||||||
|
|
||||||
|
I'd also recommend to copy the executable onto /boot so that it is accessible in case you have to access your disk from a live system
|
||||||
|
|
||||||
|
```
|
||||||
|
mkdir /boot/fido2luks/
|
||||||
|
cp /usr/bin/fido2luks /boot/fido2luks/
|
||||||
|
cp /etc/fido2luks.conf /boot/fido2luks/
|
||||||
|
```
|
||||||
|
|
||||||
## Test
|
## Test
|
||||||
|
|
||||||
Just reboot and see if it works, if thats the case you should remove your old less secure password from your luks header:
|
Just reboot and see if it works, if thats the case you should remove your old less secure password from your luks header:
|
||||||
@@ -61,3 +69,32 @@ cryptsetup luksHeaderBackup /dev/disk/by-uuid/<DISK_UUID> --header-backup-file l
|
|||||||
#There is no turning back if you mess this up, make sure you made a backup
|
#There is no turning back if you mess this up, make sure you made a backup
|
||||||
fido2luks -i add-key --exclusive /dev/disk/by-uuid/<DISK_UUID>
|
fido2luks -i add-key --exclusive /dev/disk/by-uuid/<DISK_UUID>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Addtional settings
|
||||||
|
|
||||||
|
### Password less
|
||||||
|
|
||||||
|
Remove your previous secret as described in the next section, incase you already added one.
|
||||||
|
|
||||||
|
Open `/etc/fido2luks.conf` and replace `FIDO2LUKS_SALT=Ask` with `FIDO2LUKS_SALT=string:<YOUR_RANDOM_STRING>`
|
||||||
|
|
||||||
|
Import the new config into env:
|
||||||
|
|
||||||
|
```
|
||||||
|
set -a
|
||||||
|
. /etc/fido2luks.conf
|
||||||
|
```
|
||||||
|
|
||||||
|
Then add the new secret to each device and update dracut afterwards `dracut -f`
|
||||||
|
|
||||||
|
## Removal
|
||||||
|
|
||||||
|
Remove `rd.luks.2fa` from `GRUB_CMDLINE_LINUX` in /etc/default/grub
|
||||||
|
|
||||||
|
```
|
||||||
|
set -a
|
||||||
|
. fido2luks.conf
|
||||||
|
sudo -E fido2luks -i replace-key /dev/disk/by-uuid/<DISK_UUID>
|
||||||
|
|
||||||
|
sudo rm -rf /usr/lib/dracut/modules.d/96luks-2fa /etc/dracut.conf.d/luks-2fa.conf
|
||||||
|
```
|
||||||
|
3
dracut/96luks-2fa/fido2luks.conf
Normal file
3
dracut/96luks-2fa/fido2luks.conf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
FIDO2LUKS_SALT=Ask
|
||||||
|
FIDO2LUKS_PASSWORD_HELPER=/usr/bin/systemd-ask-password Please enter second factor for LUKS disk encryption
|
||||||
|
|
@@ -1,11 +1,10 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
NORMAL_DIR="/tmp//run/systemd/system"
|
NORMAL_DIR="/run/systemd/system"
|
||||||
LUKS_2FA_WANTS="/etc/systemd/system/luks-2fa.target.wants"
|
LUKS_2FA_WANTS="/etc/systemd/system/luks-2fa.target.wants"
|
||||||
|
|
||||||
CRYPTSETUP="/usr/lib/systemd/systemd-cryptsetup"
|
CRYPTSETUP="/usr/lib/systemd/systemd-cryptsetup"
|
||||||
FIDO2LUKS="/usr/bin/fido2luks"
|
FIDO2LUKS="/usr/bin/fido2luks"
|
||||||
XXD="/usr/bin/xxd"
|
|
||||||
MOUNT=$(command -v mount)
|
MOUNT=$(command -v mount)
|
||||||
UMOUNT=$(command -v umount)
|
UMOUNT=$(command -v umount)
|
||||||
|
|
||||||
@@ -33,13 +32,12 @@ generate_service () {
|
|||||||
printf -- "\n\n[Service]"
|
printf -- "\n\n[Service]"
|
||||||
printf -- "\nType=oneshot"
|
printf -- "\nType=oneshot"
|
||||||
printf -- "\nRemainAfterExit=yes"
|
printf -- "\nRemainAfterExit=yes"
|
||||||
|
printf -- "\nEnvironmentFile=%s" "/etc/fido2luks.conf"
|
||||||
printf -- "\nEnvironment=FIDO2LUKS_CREDENTIAL_ID='%s'" "$credential_id"
|
printf -- "\nEnvironment=FIDO2LUKS_CREDENTIAL_ID='%s'" "$credential_id"
|
||||||
printf -- "\nEnvironment=FIDO2LUKS_SALT='%s'" "Ask"
|
|
||||||
printf -- "\nEnvironment=FIDO2LUKS_PASSWORD_HELPER='%s'" "/usr/bin/systemd-ask-password \"Disk 2fa password\""
|
|
||||||
printf -- "\nKeyringMode=%s" "shared"
|
printf -- "\nKeyringMode=%s" "shared"
|
||||||
printf -- "\nExecStartPre=-/usr/bin/plymouth display-message --text ${CON_MSG}"
|
printf -- "\nExecStartPre=-/usr/bin/plymouth display-message --text \"${CON_MSG}\""
|
||||||
printf -- "\nExecStartPre=-/bin/bash -c \"while ! ${FIDO2LUKS} connected; do /usr/bin/sleep 1; done\""
|
printf -- "\nExecStartPre=-/bin/bash -c \"while ! ${FIDO2LUKS} connected; do /usr/bin/sleep 1; done\""
|
||||||
printf -- "\nExecStartPre=-/usr/bin/plymouth hide-message --text ${CON_MSG}"
|
printf -- "\nExecStartPre=-/usr/bin/plymouth hide-message --text \"${CON_MSG}\""
|
||||||
printf -- "\nExecStart=/bin/bash -c \"${FIDO2LUKS} print-secret --bin | ${CRYPTSETUP} attach 'luks-%s' '/dev/disk/by-uuid/%s' '/dev/stdin'\"" "$target_uuid" "$target_uuid"
|
printf -- "\nExecStart=/bin/bash -c \"${FIDO2LUKS} print-secret --bin | ${CRYPTSETUP} attach 'luks-%s' '/dev/disk/by-uuid/%s' '/dev/stdin'\"" "$target_uuid" "$target_uuid"
|
||||||
printf -- "\nExecStop=${CRYPTSETUP} detach 'luks-%s'" "$target_uuid"
|
printf -- "\nExecStop=${CRYPTSETUP} detach 'luks-%s'" "$target_uuid"
|
||||||
} > "$sd_service"
|
} > "$sd_service"
|
||||||
@@ -50,7 +48,7 @@ generate_service () {
|
|||||||
printf -- "\nConditionPathExists=!/dev/mapper/luks-%s" "$target_uuid"
|
printf -- "\nConditionPathExists=!/dev/mapper/luks-%s" "$target_uuid"
|
||||||
} > "${sd_dir}/${crypto_target_service}.d/drop-in.conf"
|
} > "${sd_dir}/${crypto_target_service}.d/drop-in.conf"
|
||||||
|
|
||||||
# ln -sf "$sd_service" "${LUKS_2FA_WANTS}/"
|
ln -sf "$sd_service" "${LUKS_2FA_WANTS}/"
|
||||||
}
|
}
|
||||||
|
|
||||||
parse_cmdline () {
|
parse_cmdline () {
|
||||||
@@ -81,5 +79,4 @@ generate_from_cmdline () {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
#generate_from_cmdline
|
generate_from_cmdline
|
||||||
generate_service CRED UUID $timeout
|
|
||||||
|
@@ -18,6 +18,7 @@ depends () {
|
|||||||
install () {
|
install () {
|
||||||
inst "$moddir/luks-2fa-generator.sh" "/etc/systemd/system-generators/luks-2fa-generator.sh"
|
inst "$moddir/luks-2fa-generator.sh" "/etc/systemd/system-generators/luks-2fa-generator.sh"
|
||||||
inst_simple "/usr/bin/fido2luks" "/usr/bin/fido2luks"
|
inst_simple "/usr/bin/fido2luks" "/usr/bin/fido2luks"
|
||||||
|
inst_simple "/etc/fido2luks.conf" "/etc/fido2luks.conf"
|
||||||
inst "$systemdutildir/systemd-cryptsetup"
|
inst "$systemdutildir/systemd-cryptsetup"
|
||||||
mkdir -p "$initdir/luks-2fa"
|
mkdir -p "$initdir/luks-2fa"
|
||||||
|
|
||||||
|
@@ -15,6 +15,7 @@ help:
|
|||||||
install:
|
install:
|
||||||
cp ${MODULE_CONF_D}/${MODULE_CONF} ${DRACUT_CONF_D}/
|
cp ${MODULE_CONF_D}/${MODULE_CONF} ${DRACUT_CONF_D}/
|
||||||
cp -r ${MODULE_DIR} ${DRACUT_MODULES_D}/
|
cp -r ${MODULE_DIR} ${DRACUT_MODULES_D}/
|
||||||
|
cp ${MODULE_DIR}/fido2luks.conf /etc/fido2luks.conf
|
||||||
dracut -fv
|
dracut -fv
|
||||||
clean:
|
clean:
|
||||||
rm ${DRACUT_CONF_D}/${MODULE_CONF}
|
rm ${DRACUT_CONF_D}/${MODULE_CONF}
|
||||||
|
116
src/cli.rs
116
src/cli.rs
@@ -8,11 +8,15 @@ use cryptsetup_rs::{CryptDevice, Luks1CryptDevice};
|
|||||||
use libcryptsetup_sys::crypt_keyslot_info;
|
use libcryptsetup_sys::crypt_keyslot_info;
|
||||||
use structopt::StructOpt;
|
use structopt::StructOpt;
|
||||||
|
|
||||||
use std::fs::File;
|
use std::io::Write;
|
||||||
use std::io::{Read, Write};
|
|
||||||
use std::process::exit;
|
use std::process::exit;
|
||||||
|
|
||||||
pub fn add_key_to_luks(device: PathBuf, secret: &[u8; 32], exclusive: bool) -> Fido2LuksResult<u8> {
|
pub fn add_key_to_luks(
|
||||||
|
device: PathBuf,
|
||||||
|
secret: &[u8; 32],
|
||||||
|
old_secret: Box<dyn Fn() -> Fido2LuksResult<Vec<u8>>>,
|
||||||
|
exclusive: bool,
|
||||||
|
) -> Fido2LuksResult<u8> {
|
||||||
fn offer_format(
|
fn offer_format(
|
||||||
_dev: CryptDeviceOpenBuilder,
|
_dev: CryptDeviceOpenBuilder,
|
||||||
) -> Fido2LuksResult<CryptDeviceHandle<Luks1Params>> {
|
) -> Fido2LuksResult<CryptDeviceHandle<Luks1Params>> {
|
||||||
@@ -21,20 +25,7 @@ pub fn add_key_to_luks(device: PathBuf, secret: &[u8; 32], exclusive: bool) -> F
|
|||||||
let dev =
|
let dev =
|
||||||
|| -> luks::device::Result<CryptDeviceOpenBuilder> { luks::open(&device.canonicalize()?) };
|
|| -> luks::device::Result<CryptDeviceOpenBuilder> { luks::open(&device.canonicalize()?) };
|
||||||
|
|
||||||
let prev_key_info = rpassword::read_password_from_tty(Some(
|
let prev_key = old_secret()?;
|
||||||
"Please enter your current password or path to a keyfile in order to add a new key: ",
|
|
||||||
))?;
|
|
||||||
|
|
||||||
let prev_key = match prev_key_info.as_ref() {
|
|
||||||
"" => None,
|
|
||||||
keyfile if PathBuf::from(keyfile).exists() => {
|
|
||||||
let mut f = File::open(keyfile)?;
|
|
||||||
let mut key = Vec::new();
|
|
||||||
f.read_to_end(&mut key)?;
|
|
||||||
Some(key)
|
|
||||||
}
|
|
||||||
password => Some(Vec::from(password.as_bytes())),
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut handle = match dev()?.luks1() {
|
let mut handle = match dev()?.luks1() {
|
||||||
Ok(handle) => handle,
|
Ok(handle) => handle,
|
||||||
@@ -47,7 +38,7 @@ pub fn add_key_to_luks(device: PathBuf, secret: &[u8; 32], exclusive: bool) -> F
|
|||||||
err => err?,
|
err => err?,
|
||||||
};
|
};
|
||||||
handle.set_iteration_time(50);
|
handle.set_iteration_time(50);
|
||||||
let slot = handle.add_keyslot(secret, prev_key.as_ref().map(|b| b.as_slice()), None)?;
|
let slot = handle.add_keyslot(secret, Some(prev_key.as_slice()), None)?;
|
||||||
if exclusive {
|
if exclusive {
|
||||||
for old_slot in 0..8u8 {
|
for old_slot in 0..8u8 {
|
||||||
if old_slot != slot
|
if old_slot != slot
|
||||||
@@ -62,6 +53,23 @@ pub fn add_key_to_luks(device: PathBuf, secret: &[u8; 32], exclusive: bool) -> F
|
|||||||
Ok(slot)
|
Ok(slot)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn add_password_to_luks(
|
||||||
|
device: PathBuf,
|
||||||
|
secret: &[u8; 32],
|
||||||
|
new_secret: Box<dyn Fn() -> Fido2LuksResult<Vec<u8>>>,
|
||||||
|
add_password: bool,
|
||||||
|
) -> Fido2LuksResult<u8> {
|
||||||
|
let dev = luks::open(&device.canonicalize()?)?;
|
||||||
|
let mut handle = dev.luks1()?;
|
||||||
|
let prev_slot = if add_password {
|
||||||
|
Some(handle.add_keyslot(&secret[..], Some(&secret[..]), None)?)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
};
|
||||||
|
let slot = handle.update_keyslot(&new_secret()?[..], &secret[..], prev_slot)?;
|
||||||
|
Ok(slot)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn authenticator_connected() -> Fido2LuksResult<bool> {
|
pub fn authenticator_connected() -> Fido2LuksResult<bool> {
|
||||||
Ok(!device::get_devices()?.is_empty())
|
Ok(!device::get_devices()?.is_empty())
|
||||||
}
|
}
|
||||||
@@ -80,8 +88,18 @@ pub struct SecretGeneration {
|
|||||||
/// FIDO credential id, generate using fido2luks credential
|
/// FIDO credential id, generate using fido2luks credential
|
||||||
#[structopt(name = "credential-id", env = "FIDO2LUKS_CREDENTIAL_ID")]
|
#[structopt(name = "credential-id", env = "FIDO2LUKS_CREDENTIAL_ID")]
|
||||||
pub credential_id: String,
|
pub credential_id: String,
|
||||||
/// Salt for secret generation, defaults to Password
|
/// Salt for secret generation, defaults to 'ask'
|
||||||
#[structopt(name = "salt", env = "FIDO2LUKS_SALT", default_value = "Ask")]
|
///
|
||||||
|
/// Options:{n}
|
||||||
|
/// - ask : Promt user using password helper{n}
|
||||||
|
/// - file:<PATH> : Will read <FILE>{n}
|
||||||
|
/// - string:<STRING> : Will use <STRING>, which will be handled like a password provided to the 'ask' option{n}
|
||||||
|
#[structopt(
|
||||||
|
name = "salt",
|
||||||
|
long = "salt",
|
||||||
|
env = "FIDO2LUKS_SALT",
|
||||||
|
default_value = "ask"
|
||||||
|
)]
|
||||||
pub salt: InputSalt,
|
pub salt: InputSalt,
|
||||||
/// Script used to obtain passwords, overridden by --interactive flag
|
/// Script used to obtain passwords, overridden by --interactive flag
|
||||||
#[structopt(
|
#[structopt(
|
||||||
@@ -128,6 +146,24 @@ pub enum Command {
|
|||||||
/// Will wipe all other keys
|
/// Will wipe all other keys
|
||||||
#[structopt(short = "e", long = "exclusive")]
|
#[structopt(short = "e", long = "exclusive")]
|
||||||
exclusive: bool,
|
exclusive: bool,
|
||||||
|
/// Use a keyfile instead of a password
|
||||||
|
#[structopt(short = "d", long = "keyfile")]
|
||||||
|
keyfile: Option<PathBuf>,
|
||||||
|
#[structopt(flatten)]
|
||||||
|
secret_gen: SecretGeneration,
|
||||||
|
},
|
||||||
|
|
||||||
|
/// Replace a previously added key with a password
|
||||||
|
#[structopt(name = "replace-key")]
|
||||||
|
ReplaceKey {
|
||||||
|
#[structopt(env = "FIDO2LUKS_DEVICE")]
|
||||||
|
device: PathBuf,
|
||||||
|
/// Add the password and keep the key
|
||||||
|
#[structopt(short = "a", long = "add-password")]
|
||||||
|
add_password: bool,
|
||||||
|
/// Use a keyfile instead of a password
|
||||||
|
#[structopt(short = "d", long = "keyfile")]
|
||||||
|
keyfile: Option<PathBuf>,
|
||||||
#[structopt(flatten)]
|
#[structopt(flatten)]
|
||||||
secret_gen: SecretGeneration,
|
secret_gen: SecretGeneration,
|
||||||
},
|
},
|
||||||
@@ -177,10 +213,22 @@ pub fn run_cli() -> Fido2LuksResult<()> {
|
|||||||
Command::AddKey {
|
Command::AddKey {
|
||||||
device,
|
device,
|
||||||
exclusive,
|
exclusive,
|
||||||
|
keyfile,
|
||||||
ref secret_gen,
|
ref secret_gen,
|
||||||
} => {
|
} => {
|
||||||
let secret = secret_gen.patch(&args).obtain_secret()?;
|
let secret = secret_gen.patch(&args).obtain_secret()?;
|
||||||
let slot = add_key_to_luks(device.clone(), &secret, *exclusive)?;
|
let slot = add_key_to_luks(
|
||||||
|
device.clone(),
|
||||||
|
&secret,
|
||||||
|
if let Some(keyfile) = keyfile.clone() {
|
||||||
|
Box::new(move || util::read_keyfile(keyfile.clone()))
|
||||||
|
} else {
|
||||||
|
Box::new(|| {
|
||||||
|
util::read_password("Old password", true).map(|p| p.as_bytes().to_vec())
|
||||||
|
})
|
||||||
|
},
|
||||||
|
*exclusive,
|
||||||
|
)?;
|
||||||
println!(
|
println!(
|
||||||
"Added to key to device {}, slot: {}",
|
"Added to key to device {}, slot: {}",
|
||||||
device.display(),
|
device.display(),
|
||||||
@@ -188,6 +236,32 @@ pub fn run_cli() -> Fido2LuksResult<()> {
|
|||||||
);
|
);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
Command::ReplaceKey {
|
||||||
|
device,
|
||||||
|
add_password,
|
||||||
|
keyfile,
|
||||||
|
ref secret_gen,
|
||||||
|
} => {
|
||||||
|
let secret = secret_gen.patch(&args).obtain_secret()?;
|
||||||
|
let slot = add_password_to_luks(
|
||||||
|
device.clone(),
|
||||||
|
&secret,
|
||||||
|
if let Some(keyfile) = keyfile.clone() {
|
||||||
|
Box::new(move || util::read_keyfile(keyfile.clone()))
|
||||||
|
} else {
|
||||||
|
Box::new(|| {
|
||||||
|
util::read_password("Password to add", true).map(|p| p.as_bytes().to_vec())
|
||||||
|
})
|
||||||
|
},
|
||||||
|
*add_password,
|
||||||
|
)?;
|
||||||
|
println!(
|
||||||
|
"Added to password to device {}, slot: {}",
|
||||||
|
device.display(),
|
||||||
|
slot
|
||||||
|
);
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
Command::Open {
|
Command::Open {
|
||||||
device,
|
device,
|
||||||
name,
|
name,
|
||||||
|
@@ -10,11 +10,11 @@ use std::path::PathBuf;
|
|||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
pub enum InputSalt {
|
pub enum InputSalt {
|
||||||
AskPassword,
|
AskPassword,
|
||||||
|
String(String),
|
||||||
File { path: PathBuf },
|
File { path: PathBuf },
|
||||||
Both { path: PathBuf },
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for InputSalt {
|
impl Default for InputSalt {
|
||||||
@@ -25,10 +25,14 @@ impl Default for InputSalt {
|
|||||||
|
|
||||||
impl From<&str> for InputSalt {
|
impl From<&str> for InputSalt {
|
||||||
fn from(s: &str) -> Self {
|
fn from(s: &str) -> Self {
|
||||||
if PathBuf::from(s).exists() && s != "Ask" {
|
let mut parts = s.split(":").into_iter();
|
||||||
InputSalt::File { path: s.into() }
|
match parts.next() {
|
||||||
} else {
|
Some("ask") | Some("Ask") => InputSalt::AskPassword,
|
||||||
InputSalt::AskPassword
|
Some("file") => InputSalt::File {
|
||||||
|
path: parts.collect::<Vec<_>>().join(":").into(),
|
||||||
|
},
|
||||||
|
Some("string") => InputSalt::String(parts.collect::<Vec<_>>().join(":")),
|
||||||
|
_ => Self::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -45,8 +49,8 @@ impl fmt::Display for InputSalt {
|
|||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
|
||||||
f.write_str(&match self {
|
f.write_str(&match self {
|
||||||
InputSalt::AskPassword => "ask".to_string(),
|
InputSalt::AskPassword => "ask".to_string(),
|
||||||
InputSalt::File { path } => path.display().to_string(),
|
InputSalt::String(s) => ["string", s].join(":"),
|
||||||
InputSalt::Both { path } => ["ask", path.display().to_string().as_str()].join(" + "),
|
InputSalt::File { path } => ["file", path.display().to_string().as_str()].join(":"),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -73,10 +77,7 @@ impl InputSalt {
|
|||||||
InputSalt::AskPassword => {
|
InputSalt::AskPassword => {
|
||||||
digest.input(password_helper.obtain()?.as_bytes());
|
digest.input(password_helper.obtain()?.as_bytes());
|
||||||
}
|
}
|
||||||
InputSalt::Both { path } => {
|
InputSalt::String(s) => digest.input(s.as_bytes()),
|
||||||
digest.input(&InputSalt::AskPassword.obtain(password_helper)?);
|
|
||||||
digest.input(&InputSalt::File { path: path.clone() }.obtain(password_helper)?)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
let mut salt = [0u8; 32];
|
let mut salt = [0u8; 32];
|
||||||
digest.result(&mut salt);
|
digest.result(&mut salt);
|
||||||
@@ -132,23 +133,7 @@ impl PasswordHelper {
|
|||||||
use PasswordHelper::*;
|
use PasswordHelper::*;
|
||||||
match self {
|
match self {
|
||||||
Systemd => unimplemented!(),
|
Systemd => unimplemented!(),
|
||||||
Stdin => Ok(rpassword::read_password_from_tty(Some("Password: "))
|
Stdin => Ok(util::read_password("Password", true)?),
|
||||||
.map_err(|e| Fido2LuksError::AskPassError {
|
|
||||||
cause: AskPassError::IO(e),
|
|
||||||
})
|
|
||||||
.and_then(|pass| {
|
|
||||||
match rpassword::read_password_from_tty(Some("Password again: ")).map_err(|e| {
|
|
||||||
Fido2LuksError::AskPassError {
|
|
||||||
cause: AskPassError::IO(e),
|
|
||||||
}
|
|
||||||
}) {
|
|
||||||
Ok(ref pass2) if &pass == pass2 => Ok(pass),
|
|
||||||
Ok(_) => Err(Fido2LuksError::AskPassError {
|
|
||||||
cause: error::AskPassError::Mismatch,
|
|
||||||
}),
|
|
||||||
e => e,
|
|
||||||
}
|
|
||||||
})?),
|
|
||||||
Script(password_helper) => {
|
Script(password_helper) => {
|
||||||
let mut helper_parts = password_helper.split(" ");
|
let mut helper_parts = password_helper.split(" ");
|
||||||
|
|
||||||
@@ -164,3 +149,25 @@ impl PasswordHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn input_salt_from_str() {
|
||||||
|
assert_eq!(
|
||||||
|
"file:/tmp/abc".parse::<InputSalt>().unwrap(),
|
||||||
|
InputSalt::File {
|
||||||
|
path: "/tmp/abc".into()
|
||||||
|
}
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
"string:abc".parse::<InputSalt>().unwrap(),
|
||||||
|
InputSalt::String("abc".into())
|
||||||
|
);
|
||||||
|
assert_eq!("ask".parse::<InputSalt>().unwrap(), InputSalt::AskPassword);
|
||||||
|
assert_eq!("lol".parse::<InputSalt>().unwrap(), InputSalt::default());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -17,7 +17,7 @@ pub enum Fido2LuksError {
|
|||||||
LuksError { cause: cryptsetup_rs::device::Error },
|
LuksError { cause: cryptsetup_rs::device::Error },
|
||||||
#[fail(display = "no authenticator found, please ensure you device is plugged in")]
|
#[fail(display = "no authenticator found, please ensure you device is plugged in")]
|
||||||
IoError { cause: io::Error },
|
IoError { cause: io::Error },
|
||||||
#[fail(display = "failed to parse config, please check formatting and contents")]
|
#[fail(display = "supplied secret isn't valid for this device")]
|
||||||
WrongSecret,
|
WrongSecret,
|
||||||
#[fail(display = "not an utf8 string")]
|
#[fail(display = "not an utf8 string")]
|
||||||
StringEncodingError { cause: FromUtf8Error },
|
StringEncodingError { cause: FromUtf8Error },
|
||||||
@@ -42,7 +42,12 @@ impl From<FidoError> for Fido2LuksError {
|
|||||||
|
|
||||||
impl From<cryptsetup_rs::device::Error> for Fido2LuksError {
|
impl From<cryptsetup_rs::device::Error> for Fido2LuksError {
|
||||||
fn from(e: cryptsetup_rs::device::Error) -> Self {
|
fn from(e: cryptsetup_rs::device::Error) -> Self {
|
||||||
LuksError { cause: e }
|
match e {
|
||||||
|
cryptsetup_rs::device::Error::CryptsetupError(error_no) if error_no.0 == 1i32 => {
|
||||||
|
WrongSecret
|
||||||
|
}
|
||||||
|
e => LuksError { cause: e },
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate failure;
|
extern crate failure;
|
||||||
|
extern crate ctap_hmac as ctap;
|
||||||
use crate::cli::*;
|
use crate::cli::*;
|
||||||
use crate::config::*;
|
use crate::config::*;
|
||||||
use crate::device::*;
|
use crate::device::*;
|
||||||
@@ -7,9 +8,7 @@ use crate::error::*;
|
|||||||
use crypto::digest::Digest;
|
use crypto::digest::Digest;
|
||||||
use crypto::sha2::Sha256;
|
use crypto::sha2::Sha256;
|
||||||
use cryptsetup_rs as luks;
|
use cryptsetup_rs as luks;
|
||||||
|
|
||||||
use cryptsetup_rs::Luks1CryptDevice;
|
use cryptsetup_rs::Luks1CryptDevice;
|
||||||
use ctap;
|
|
||||||
|
|
||||||
use std::io::{self};
|
use std::io::{self};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
@@ -18,6 +17,7 @@ mod cli;
|
|||||||
mod config;
|
mod config;
|
||||||
mod device;
|
mod device;
|
||||||
mod error;
|
mod error;
|
||||||
|
mod util;
|
||||||
|
|
||||||
fn open_container(device: &PathBuf, name: &str, secret: &[u8; 32]) -> Fido2LuksResult<()> {
|
fn open_container(device: &PathBuf, name: &str, secret: &[u8; 32]) -> Fido2LuksResult<()> {
|
||||||
let mut handle = luks::open(device.canonicalize()?)?.luks1()?;
|
let mut handle = luks::open(device.canonicalize()?)?.luks1()?;
|
||||||
|
26
src/util.rs
Normal file
26
src/util.rs
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
use crate::error::*;
|
||||||
|
use std::fs::File;
|
||||||
|
use std::io::Read;
|
||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
|
pub fn read_password(q: &str, verify: bool) -> Fido2LuksResult<String> {
|
||||||
|
match rpassword::read_password_from_tty(Some(&[q, ": "].join("")))? {
|
||||||
|
ref pass
|
||||||
|
if verify
|
||||||
|
&& &rpassword::read_password_from_tty(Some(&[q, "(again): "].join(" ")))?
|
||||||
|
!= pass =>
|
||||||
|
{
|
||||||
|
Err(Fido2LuksError::AskPassError {
|
||||||
|
cause: AskPassError::Mismatch,
|
||||||
|
})?
|
||||||
|
}
|
||||||
|
pass => Ok(pass),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn read_keyfile<P: Into<PathBuf>>(path: P) -> Fido2LuksResult<Vec<u8>> {
|
||||||
|
let mut file = File::open(path.into())?;
|
||||||
|
let mut key = Vec::new();
|
||||||
|
file.read_to_end(&mut key)?;
|
||||||
|
Ok(key)
|
||||||
|
}
|
Reference in New Issue
Block a user