[KVM] Encrypted disk offering: volume created on a manually selected primary storage pool (NFS and SharedMountPoint) is not encrypted (no LUKS, no error)
維護者通常 1 天內回覆
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 35/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 停滯
- 技術堆疊
- java
研究方向
Start by tracing volume creation for requests that specify storageid, then compare that path with allocation by storage tag, using the reported KVM storage and encryption logs as clues. Check how the selected pool type and encryption metadata reach volume creation and attach. Done means manual pool selection either creates a LUKS volume with a stored passphrase or returns a clear error; linked PR #14667 is already open.
由索引模型根據 Issue 內容生成。
描述
problem
When a volume is created from a disk offering with encrypt=true and the primary storage pool is passed explicitly (storageid), the volume is not encrypted. There is no error: the volume is created and attached normally, but it is a plain qcow2 image with no LUKS header and volumes.passphrase_id is NULL. The same disk offering used with allocation by storage tag produces a LUKS volume.
The silent behavior is the main concern: an operator who picks the pool manually believes the data is encrypted at rest and it is not.
The same happens on a SharedMountPoint (iSCSI-backed) pool: manual selection produces a plain image with no error, while allocation by tag on that pool fails at attach (see #14663).
versions
- Apache CloudStack 4.22.1.1
- Hypervisor: KVM, host reports
host.volume.encryption - Volume format: qcow2
- Primary storage: NFS pool (
NetworkFilesystem) and SharedMountPoint pool (iSCSI-backed)
The steps to reproduce the bug
- Use a KVM host that supports volume encryption.
- Create a disk offering with encryption enabled and a storage tag that matches an NFS pool.
- Create a volume from that offering with allocation by tag. Result: LUKS volume (works as expected).
- Create a second volume from the same kind of encrypted offering (no storage tag), passing the NFS pool explicitly:
createVolume diskofferingid=<encrypted offering> storageid=<nfs pool id> ... - Attach it to a VM. No error is returned.
- Check the result:
volumes.passphrase_idis NULL, and the agent log shows no encryption option in the create command and no<encryption>element in the disk XML (excerpts below). - Repeating steps 4 to 6 on a SharedMountPoint (iSCSI-backed) pool gives the same result:
passphrase_idNULL, plain qcow2, no error. We ran the manual-selection test 11 times with two disk offerings on both pool types, with the same result every time. In one earlier unplanned run (outside our test protocol) a manual selection on the SharedMountPoint pool produced a volume with a passphrase and a visible attach failure; we could not reproduce it in 3 deliberate repeats.
Allocation by tag (works), agent DEBUG log:
DEBUG [utils.script.Script] Executing command [qemu-img create --object secret,file=<keyfile>,id=sec0 -o encrypt.format=luks,preallocation=off,encrypt.key-secret=sec0 -f qcow2 /mnt/50e883ef-d010-3cb7-95fa-30dc5faeae7d/a4dcb52d-6bbc-4edb-afe8-f6a9f8ef902f 5368709120 ].
DEBUG [kvm.storage.KVMStorageProcessor] Attaching device: <disk device='disk' type='file'>
<driver name='qemu' type='qcow2' cache='none' />
<source file='/mnt/50e883ef-d010-3cb7-95fa-30dc5faeae7d/a4dcb52d-6bbc-4edb-afe8-f6a9f8ef902f'/>
<target dev='vde' bus='virtio'/>
<serial>a4dcb52d6bbc4edbafe8</serial>
<encryption format='luks'>
<secret type='passphrase' uuid='2b94d58b-0848-3559-b193-f1d5846dadfc' />
</encryption>
</disk>
Manual pool selection (silent failure), agent DEBUG log:
DEBUG [utils.script.Script] Executing command [qemu-img create -o preallocation=off -f qcow2 /mnt/50e883ef-d010-3cb7-95fa-30dc5faeae7d/aeb9b9fa-3b24-4a65-9664-ff51cf2f7753 5368709120 ].
DEBUG [kvm.storage.KVMStorageProcessor] Attaching device: <disk device='disk' type='file'>
<driver name='qemu' type='qcow2' cache='none' />
<source file='/mnt/50e883ef-d010-3cb7-95fa-30dc5faeae7d/aeb9b9fa-3b24-4a65-9664-ff51cf2f7753'/>
<target dev='vde' bus='virtio'/>
<serial>aeb9b9fa3b244a659664</serial>
</disk>
DEBUG [cloud.agent.Agent] Seq 1-1174595077813569846: [...] "org.apache.cloudstack.storage.command.AttachAnswer":{ [...] "result":"true" [...] }
Manual pool selection on the SharedMountPoint (iSCSI-backed) pool, agent DEBUG log: volume created through libvirt (no qemu-img create, no encryption option), attached without <encryption>, and the attach succeeds. The database shows passphrase_id NULL and encrypt_format NULL for the volume.
INFO [kvm.storage.LibvirtStorageAdaptor] Attempting to create volume f279db6b-d6fd-4339-943c-ad01455af989 (SharedMountPoint) in pool 0d3db4e4-0e9a-4421-a5a4-72e9770d27c1 with size (5.00 GB) 5368709120
DEBUG [kvm.storage.LibvirtStorageAdaptor] <volume>
<name>f279db6b-d6fd-4339-943c-ad01455af989</name>
<capacity>5368709120</capacity>
<target>
<format type='qcow2'/>
<permissions><mode>0744</mode></permissions></target>
</volume>
DEBUG [cloud.agent.Agent] Seq 1-1174595077813576597: [...] "org.apache.cloudstack.storage.command.CreateObjectAnswer": [...] "result":"true" [...]
DEBUG [kvm.storage.KVMStorageProcessor] Attaching physical disk /mnt/<iscsi-pool>/f279db6b-d6fd-4339-943c-ad01455af989 with format qcow2
DEBUG [kvm.storage.KVMStorageProcessor] Attaching device: <disk device='disk' type='file'>
<driver name='qemu' type='qcow2' cache='none' />
<source file='/mnt/<iscsi-pool>/f279db6b-d6fd-4339-943c-ad01455af989'/>
<target dev='vdc' bus='virtio'/>
<serial>f279db6bd6fd4339943c</serial>
</disk>
DEBUG [cloud.agent.Agent] Seq 1-1174595077813576599: [...] "org.apache.cloudstack.storage.command.AttachAnswer": [...] "poolType":"SharedMountPoint", [...] "result":"true" [...]
What to do about it?
The decision to encrypt should not depend on how the pool was chosen. Either apply LUKS (and store the passphrase) on the manual-pool path, or fail the request with a clear error.
Note: PR #13228 changes several getPassphraseId() != null checks to isEncrypted() (which also considers encryptFormat). We have not verified that it affects this scenario, so it may or may not be related.
- 主要語言
- Java
- 星號
- 3.1k
- 分支
- 1.4k
- 平均合併
- 7 天 16 小時
- 30 天內合併 PR
- 15
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
apache/cloudstack 的其他 Issue
-
resizeVolume of a running system VM's volume is accepted but the VM never sees the new size可能已有人在做 @bhouse-nexthop 於 3 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 72/100
apache/cloudstack#14645 · 1 則留言 ·
維護者通常 1 天內回覆
-
VR reports a load balancer change as applied when haproxy.cfg cannot be replaced可能已有人在做 @bhouse-nexthop 於 3 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 78/100
apache/cloudstack#14633 · 1 則留言 ·
維護者通常 1 天內回覆
-
restartNetwork reports a ResourceUnavailableException as an unexpected error (530), unlike restartVPC (534)可能已有人在做 @bhouse-nexthop 於 3 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 78/100
apache/cloudstack#14631 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 68/100
apache/cloudstack#14625 · 1 則留言 ·
維護者通常 1 天內回覆
-
Remote access VPN users are disconnected on every LB, ACL, port forward or firewall change (xl2tpd restarted on every iptables pass)可能已有人在做 @willbennett-devops 於 12 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 72/100
apache/cloudstack#14545 · 1 則留言 ·
維護者通常 1 天內回覆
查看 apache/cloudstack 的全部 Issue
相似的 Issue
-
[Bug]: Nullable implicit operator on string extensible enums still throws for a null string可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉bug emitter:client:csharp
難度 2/5 1-3 小時 新手友好度 84/100
microsoft/typespec#12572 · 1 則留言 · 1 個 reaction ·
維護者通常 1 天內回覆
-
[BUG]: Java SDK MountRequest always sends update-optional fields, resetting stored mount settings未關閉bug
難度 2/5 1-3 小時 新手友好度 75/100
維護者通常 1 天內回覆
-
GCC 15.2: -Wcast-qual warning - cast discards const qualifier from pointer target type (H5trace.c)未關閉
難度 2/5 1-3 小時 新手友好度 73/100
維護者通常 1 天內回覆
-
[Bug] RemotingHelper.connect swaps the socket send and receive buffer configuration可能已有人在做 @amalsaidov 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 82/100
維護者通常 1 天內回覆
-
needs-area-label
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 2 天內回覆