Adding dm-crypt as core pkg

Signed-off-by: Christian Wuerdig <christian.wuerdig@gmail.com>
This commit is contained in:
Christian Wuerdig
2018-12-20 11:33:41 +13:00
committed by Christian Wuerdig
parent 8cd16c4904
commit a9bc7372de
16 changed files with 491 additions and 1 deletions

View File

@@ -0,0 +1,10 @@
#!/bin/sh
function failed {
printf "dm-crypt test suite FAILED\n" >&1
exit 1
}
[ -b /dev/mapper/it_is_encrypted ] || failed
printf "dm-crypt test suite PASSED\n" >&1

View File

@@ -0,0 +1,26 @@
#!/bin/sh
# SUMMARY: Check that the losetup package works
# LABELS:
# REPEAT:
set -e
# Source libraries. Uncomment if needed/defined
#. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
NAME=dm-crypt
DISK=disk.img
clean_up() {
rm -rf ${NAME}-* ${DISK}
}
trap clean_up EXIT
# Test code goes here
linuxkit build -format kernel+initrd -name ${NAME} test.yml
RESULT="$(linuxkit run -disk file=${DISK},size=32M ${NAME})"
echo "${RESULT}"
echo "${RESULT}" | grep -q "suite PASSED"
exit 0

View File

@@ -0,0 +1,30 @@
kernel:
image: linuxkit/kernel:4.14.88
cmdline: "console=ttyS0 console=ttyAMA0"
init:
- linuxkit/init:c563953a2277eb73a89d89f70e4b6dcdcfebc2d1
- linuxkit/runc:83d0edb4552b1a5df1f0976f05f442829eac38fe
onboot:
- name: dm-crypt
image: linuxkit/dm-crypt:9e41a164358b0235f0c242219b1a424c6552d46c
command: ["/usr/bin/crypto", "it_is_encrypted", "/dev/sda"]
- name: test
image: alpine:3.8
net: host
binds:
- /check.sh:/check.sh
- /dev:/dev
command: ["sh", "./check.sh"]
- name: poweroff
image: linuxkit/poweroff:afe8f7dd0d47a7991c54519b0f09124cb8c4e300
command: ["/bin/sh", "/poweroff.sh", "10"]
files:
- path: check.sh
source: ./check.sh
- path: etc/dm-crypt/key
contents: "abcdefghijklmnopqrstuvwxyz123456"
trust:
org:
- linuxkit
image:
- alpine:3.8

View File

@@ -0,0 +1,10 @@
#!/bin/sh
function failed {
printf "dm-crypt test suite FAILED\n" >&1
exit 1
}
[ -b /dev/mapper/it_is_encrypted ] || failed
printf "dm-crypt test suite PASSED\n" >&1

View File

@@ -0,0 +1,26 @@
#!/bin/sh
# SUMMARY: Check that the losetup package works
# LABELS:
# REPEAT:
set -e
# Source libraries. Uncomment if needed/defined
#. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
NAME=dm-crypt
DISK=disk.img
clean_up() {
rm -rf ${NAME}-* ${DISK}
}
trap clean_up EXIT
# Test code goes here
linuxkit build -format kernel+initrd -name ${NAME} test.yml
RESULT="$(linuxkit run -disk file=${DISK},size=8M ${NAME})"
echo "${RESULT}"
echo "${RESULT}" | grep -q "suite PASSED"
exit 0

View File

@@ -0,0 +1,30 @@
kernel:
image: linuxkit/kernel:4.14.88
cmdline: "console=ttyS0 console=ttyAMA0"
init:
- linuxkit/init:c563953a2277eb73a89d89f70e4b6dcdcfebc2d1
- linuxkit/runc:83d0edb4552b1a5df1f0976f05f442829eac38fe
onboot:
- name: dm-crypt
image: linuxkit/dm-crypt:9e41a164358b0235f0c242219b1a424c6552d46c
command: ["/usr/bin/crypto", "-l", "it_is_encrypted", "/dev/sda"]
- name: test
image: alpine:3.8
net: host
binds:
- /check.sh:/check.sh
- /dev:/dev
command: ["sh", "./check.sh"]
- name: poweroff
image: linuxkit/poweroff:afe8f7dd0d47a7991c54519b0f09124cb8c4e300
command: ["/bin/sh", "/poweroff.sh", "10"]
files:
- path: check.sh
source: ./check.sh
- path: etc/dm-crypt/key
contents: "abcdefghijklmnopqrstuvwxyz123456"
trust:
org:
- linuxkit
image:
- alpine:3.8

View File

@@ -0,0 +1,10 @@
#!/bin/sh
function failed {
printf "dm-crypt test suite FAILED\n" >&1
exit 1
}
[ -b /dev/mapper/it_is_encrypted ] || failed
printf "dm-crypt test suite PASSED\n" >&1

View File

@@ -0,0 +1,26 @@
#!/bin/sh
# SUMMARY: Check that the losetup package works
# LABELS:
# REPEAT:
set -e
# Source libraries. Uncomment if needed/defined
#. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
NAME=dm-crypt
DISK=disk.img
clean_up() {
rm -rf ${NAME}-* ${DISK}
}
trap clean_up EXIT
# Test code goes here
linuxkit build -format kernel+initrd -name ${NAME} test.yml
RESULT="$(linuxkit run -disk file=${DISK},size=32M ${NAME})"
echo "${RESULT}"
echo "${RESULT}" | grep -q "suite PASSED"
exit 0

View File

@@ -0,0 +1,33 @@
kernel:
image: linuxkit/kernel:4.14.88
cmdline: "console=ttyS0 console=ttyAMA0"
init:
- linuxkit/init:c563953a2277eb73a89d89f70e4b6dcdcfebc2d1
- linuxkit/runc:83d0edb4552b1a5df1f0976f05f442829eac38fe
onboot:
- name: dm-crypt
image: linuxkit/dm-crypt:9e41a164358b0235f0c242219b1a424c6552d46c
command: ["/usr/bin/crypto", "-k", "/some/other/enc_key", "it_is_encrypted", "/dev/sda"]
binds:
- /dev/:/dev
- /some/other/enc_key:/some/other/enc_key
- name: test
image: alpine:3.8
net: host
binds:
- /check.sh:/check.sh
- /dev:/dev
command: ["sh", "./check.sh"]
- name: poweroff
image: linuxkit/poweroff:afe8f7dd0d47a7991c54519b0f09124cb8c4e300
command: ["/bin/sh", "/poweroff.sh", "10"]
files:
- path: check.sh
source: ./check.sh
- path: some/other/enc_key
contents: "abcdefghijklmnopqrstuvwxyz123456"
trust:
org:
- linuxkit
image:
- alpine:3.8

View File

@@ -6,7 +6,7 @@ init:
- linuxkit/runc:83d0edb4552b1a5df1f0976f05f442829eac38fe
onboot:
- name: losetup
image: linuxkit/losetup:aaceeea49ac519bc3b87da239436dd997d67b431
image: linuxkit/losetup:b05ffc8641cc955abe45f6730cbe6d723b63bd3f
command: ["/usr/bin/loopy", "-c", "/var/test.img"]
- name: test
image: alpine:3.8