clevis-initramfs / clevis luks bind on Ubuntu 20.04 ignore custom port, go port 80 only
Ubuntu 20.04.1 LTS 5.4.0-47-generic
Installed packages: clevis-initramfs/focal-updates,now 12-1ubuntu2.1 clevis-luks/focal-updates,now 12-1ubuntu2.1 clevis/focal-updates,now 12-1ubuntu2.1
Tang server is RHEL8 listening on example.com (4.3.2.11) port 25999. Clevis Client is Ubuntu 20.04.1 with IP address 12.34.55.66
Steps to reproduce:
-
Install Ubuntu 20.04 server with LUKS encrypted LVM
-
Do a full dist-upgrade and reboot
-
apt install clevis-initramfs -
lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 55M 1 loop /snap/core18/1880
loop1 7:1 0 71.3M 1 loop /snap/lxd/16099
loop2 7:2 0 29.9M 1 loop /snap/snapd/8542
sr0 11:0 1 1024M 0 rom
vda 252:0 0 32G 0 disk
├─vda1 252:1 0 1M 0 part
├─vda2 252:2 0 1G 0 part /boot
└─vda3 252:3 0 31G 0 part
└─dm_crypt-0 253:0 0 31G 0 crypt
└─ubuntu--vg-ubuntu--lv 253:1 0 20G 0 lvm /
-
clevis luks bind -d /dev/vda3 tang '{"url":"http://example.com:25999"}' -
verify server hash and provide valid existing LUKS secret to complete enrollment
-
validate enrollment:
cryptsetup luksDump /dev/vda3
LUKS header information
Version: 2
Epoch: 9
Metadata area: 16384 [bytes]
Keyslots area: 16744448 [bytes]
UUID: a42f827a-fb42-4668-b27a-0de0aa64a965
Label: (no label)
Subsystem: (no subsystem)
Flags: (no flags)
Data segments:
0: crypt
offset: 16777216 [bytes]
length: (whole device)
cipher: aes-xts-plain64
sector: 512 [bytes]
Keyslots:
0: luks2
Key: 512 bits
Priority: normal
Cipher: aes-xts-plain64
Cipher key: 512 bits
PBKDF: argon2i
Time cost: 4
Memory: 502384
Threads: 1
Salt: 7b a8 a0 0e d4 20 2f 06 46 8e 7c 7a e6 97 d8 19
ef c4 9b ad 72 f5 ca 48 33 58 3a 99 d3 46 e8 72
AF stripes: 4000
AF hash: sha256
Area offset:32768 [bytes]
Area length:258048 [bytes]
Digest ID: 0
1: luks2
Key: 512 bits
Priority: normal
Cipher: aes-xts-plain64
Cipher key: 512 bits
PBKDF: argon2i
Time cost: 4
Memory: 502384
Threads: 1
Salt: 8a f1 eb f2 54 f2 59 79 31 88 6a e2 28 c4 9d 0f
b5 04 42 cf 30 9f c2 cc 5e 84 0a 83 9e d5 a1 ea
AF stripes: 4000
AF hash: sha256
Area offset:290816 [bytes]
Area length:258048 [bytes]
Digest ID: 0
2: luks2
Key: 512 bits
Priority: normal
Cipher: aes-xts-plain64
Cipher key: 512 bits
PBKDF: argon2i
Time cost: 4
Memory: 502384
Threads: 1
Salt: e4 2f 16 8c 6f 9f c4 c1 5b 03 07 bc 9e 24 f1 50
73 d1 a6 e9 45 64 e3 71 38 e1 e3 06 92 ee 87 3a
AF stripes: 4000
AF hash: sha256
Area offset:548864 [bytes]
Area length:258048 [bytes]
Digest ID: 0
3: luks2
Key: 512 bits
Priority: normal
Cipher: aes-xts-plain64
Cipher key: 512 bits
PBKDF: argon2i
Time cost: 4
Memory: 502384
Threads: 1
Salt: 98 cb 9f 78 94 ff e5 98 0c f3 b5 0a 80 9e cb 06
4c 61 ef 0d e2 42 73 7d 46 7f 65 b1 62 69 3a b9
AF stripes: 4000
AF hash: sha256
Area offset:806912 [bytes]
Area length:258048 [bytes]
Digest ID: 0
Tokens:
0: clevis
Keyslot: 1
1: clevis
Keyslot: 2
2: clevis
Keyslot: 3
Digests:
0: pbkdf2
Hash: sha256
Iterations: 125788
Salt: 2f fc 5b d6 b8 e9 be 19 d2 c2 c0 79 e5 e4 7d fb
51 bb 68 af b0 29 80 63 07 9d fe e5 8a 22 bd 0e
Digest: 68 bd 11 0d ae 04 93 4d 86 ca d0 3c 63 74 d1 a4
a1 fb 12 a7 ce 44 30 68 07 95 fc 89 7a 83 ef f1
Expected behavior: Upon rebooting clevis should contact http://example.com on port 25999 and unlock.
Actual behavior: System tries to reach tang server on port 80 as evidenced in firewall logs:
Sep 18 12:41:41 tangd kernel: Firewall: *TCP_IN Blocked* IN=ens3 OUT= MAC=56:00:01:00:00:00:fe:00:01:00:00:00:08:00 SRC=12.34.55.66 DST=4.3.2.11 LEN=60 TOS=0x00 PREC=0x00 TTL=53 ID=13418 DF PROTO=TCP SPT=57710 **DPT=80** WINDOW=64240 RES=0x00 SYN URGP=0
Sep 18 12:41:42 tangd kernel: Firewall: *TCP_IN Blocked* IN=ens3 OUT= MAC=56:00:01:00:00:00:fe:00:01:00:00:00:08:00 SRC=12.34.55.66 DST=4.3.2.11 LEN=60 TOS=0x00 PREC=0x00 TTL=53 ID=13419 DF PROTO=TCP SPT=57710 **DPT=80** WINDOW=64240 RES=0x00 SYN URGP=0
Sep 18 12:41:44 tangd kernel: Firewall: *TCP_IN Blocked* IN=ens3 OUT= MAC=56:00:01:00:00:00:fe:00:01:00:00:00:08:00 SRC=12.34.55.66 DST=4.3.2.11 LEN=60 TOS=0x00 PREC=0x00 TTL=53 ID=13420 DF PROTO=TCP SPT=57710 **DPT=80** WINDOW=64240 RES=0x00 SYN URGP=0
Notes:
Earlier versions of focal seemed to be OK. I have a few focal servers phoning home to this tangd on port 25999 just fine. Unless they were in-place upgrades from bionic. I will try to find out.
I can see that during enrollment the client makes GET request to the server on the correct port. As shown above, communication / enrollment work fine on port 2599. GET /adv => 200 (src/tangd.c:87)
Just during preboot it tries to POST on port 80
I think my report may have been invalid. Conducting further research.
I think my report may have been invalid. Conducting further research.
Looking into the LUKS header dump you posted I see you have 3 clevis bindings, in key slots 1, 2 and 3. Is it possible one of those is set up to port 80? If you can install clevis 13+, you could use clevis luks list -d /dev/vda3 to check this quickly.
The 3 bindings are from 3 successive enrollments, but I think there is something else going on because now I set up a brand new instance and it doesn't unlock or hit either port. I see it boot, do DHCP and then wait for LUKS passphrase. I can ping it so connectivity is up but no unlock attempt takes place. I will experiment with Clevis 13 from unstable.
I borrowed clevis 13-2 from groovy I can now see clevis luks list -d /dev/vda3 all points to the correct URL and port. I can curl /adv on that URL and port once booted and see output. During pre-boot I can see the instance is getting a DHCP lease and DNS. I can ping it. I will try a few more things.