mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-06-01 20:52:10 -04:00
Detect integrity file system request
Signed-off-by: Daniel Weiße <dw@edgeless.systems>
This commit is contained in:
parent
10e9faab10
commit
3bb1ec96b1
2 changed files with 60 additions and 4 deletions
|
@ -7,6 +7,7 @@ import (
|
|||
"io/fs"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
cryptsetup "github.com/martinjungblut/go-cryptsetup"
|
||||
|
@ -16,10 +17,11 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
cryptPrefix = "/dev/mapper/"
|
||||
integritySuffix = "_dif"
|
||||
keySizeIntegrity = 96
|
||||
keySizeCrypt = 64
|
||||
cryptPrefix = "/dev/mapper/"
|
||||
integritySuffix = "_dif"
|
||||
integrityFSSuffix = "-integrity"
|
||||
keySizeIntegrity = 96
|
||||
keySizeCrypt = 64
|
||||
)
|
||||
|
||||
// packageLock is needed to block concurrent use of package functions, since libcryptsetup is not thread safe.
|
||||
|
@ -311,3 +313,12 @@ func performWipe(device DeviceMapper, volumeID, dek string) error {
|
|||
klog.V(4).Info("dm-integrity successfully initiated")
|
||||
return nil
|
||||
}
|
||||
|
||||
// IsIntegrityFS checks if the fstype string contains an integrity suffix.
|
||||
// If yes, returns the trimmed fstype and true, fstype and false otherwise.
|
||||
func IsIntegrityFS(fstype string) (string, bool) {
|
||||
if strings.HasSuffix(fstype, integrityFSSuffix) {
|
||||
return strings.TrimSuffix(fstype, integrityFSSuffix), true
|
||||
}
|
||||
return fstype, false
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue