https://sylabs.io/guides/3.7/user-guide/signNverify.html?highlight=descriptor
Advanced Signing - SIF IDs and Groups—-查看
As well as the default behaviour, which signs all objects, fine-grained control of signing is possible.
If you sif list a SIF file you will see it is comprised of a number of objects. Each object has an ID, and belongs to a GROUP.
$ singularity sif list my_container.sifContainer id: e455d2ae-7f0b-4c79-b3ef-315a4913d76aCreated on: 2019-11-15 10:11:58 -0600 CSTModified on: 2019-11-15 10:11:58 -0600 CST----------------------------------------------------Descriptor list:ID |GROUP |LINK |SIF POSITION (start-end) |TYPE------------------------------------------------------------------------------1 |1 |NONE |32768-32800 |Def.FILE2 |1 |NONE |36864-36961 |JSON.Generic3 |1 |NONE |40960-25890816 |FS (Squashfs/*System/amd64)
I can choose to sign and verify a specific object with the --sif-id option to sign and verify.
$ singularity sign --sif-id 1 my_container.sifSigning image: my_container.sifEnter key passphrase :Signature created and applied to my_container.sif$ singularity verify --sif-id 1 my_container.sifVerifying image: my_container.sif[LOCAL] Signing entity: David Trudgian (Demo keys) <david.trudgian@sylabs.io>[LOCAL] Fingerprint: 65833F473098C6215E750B3BDFD69E5CEE85D448Objects verified:ID |GROUP |LINK |TYPE------------------------------------------------1 |1 |NONE |Def.FILEContainer verified: my_container.sif
Note that running the verify command without specifying the specific sif-id gives a fatal error. The container is not considered verified as whole because other objects could have been changed without my knowledge.
$ singularity verify my_container.sifVerifying image: my_container.sif[LOCAL] Signing entity: David Trudgian (Demo keys) <david.trudgian@sylabs.io>[LOCAL] Fingerprint: 65833F473098C6215E750B3BDFD69E5CEE85D448Error encountered during signature verification: object 2: object not signedFATAL: Failed to verify container: integrity: object 2: object not signed
SIF Image Files—-定义
https://sylabs.io/guides/3.7/user-guide/bind_paths_and_mounts.html?highlight=descriptor
Advanced users may wish to create a standalone SIF image, which contains an ext3 or squashfs data partition holding files, by using the singularity sif commands similarly to the persistent overlays instructions:
# Create a new empty SIF file$singularity sif new inputs.sif# Add the squashfs data image from above to the SIF$singularity sif add --datatype 4 --partarch 2 --partfs 1 --parttype 3 inputs.sif inputs.squashfs# Run Singularity, binding data from the SIF file$singularity run -B inputs.sif:/input-data:image-src=/ mycontainer.sifSingularity> ls /input-data1 2 3 4 5 6 7 8 9
If your bind source is a SIF then Singularity will bind from the first data partition in the SIF, or you may specify an alternative descriptor by ID with the additional bind option :id=n, where n is the descriptor ID.
