Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement FsGuard #5

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions includes.container/usr/bin/gen_fsguard_filelist
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

mkdir -p /FsGuard
touch /FsGuard/filelist

while [ $# -gt 0 ]; do
BASEPATH="$1"
for f in $(ls -1 $BASEPATH); do
echo "$BASEPATH/$f $(sha1sum $BASEPATH/$f | sed 's/ .*//g') $(ls -al $BASEPATH/$f | awk 'BEGIN{FS=" "}; {print $1};' | grep s > /dev/null && echo "true" || echo "false")" >> /FsGuard/filelist
done
shift
done
14 changes: 14 additions & 0 deletions includes.container/usr/bin/sign_filelist
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh

set -e

minisign -WG
minisign -Sm /FsGuard/filelist

touch /FsGuard/signature
echo -n "----begin attach----" >> /FsGuard/signature
cat /FsGuard/filelist.minisig >> /FsGuard/signature
echo -n "----begin second attach----" >> /FsGuard/signature
tail -n1 ./minisign.pub >> /FsGuard/signature

cat /FsGuard/signature >> /usr/bin/FsGuard
18 changes: 18 additions & 0 deletions recipe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,24 @@ modules:
- apt remove -y meson build-essential libadwaita-1-dev gettext
- apt autoremove -y
- apt clean

- name: fsguard
type: shell
source:
type: tar
url: https://github.com/linux-immutability-tools/FsGuard/releases/download/v0.1.2/FsGuard_0.1.2_linux_amd64.tar.gz
commands:
- mv /sources/FsGuard /usr/bin
- /usr/bin/gen_fsguard_filelist /usr/bin
- sed -i '\/usr\/bin\/gen_fsguard_filelist.*/d' /FsGuard/filelist
- sed -i '\/usr\/bin\/sign_filelist.*/d' /FsGuard/filelist
- /usr/bin/sign_filelist

- name: finish
type: shell
commands:
- rm /usr/bin/gen_fsguard_filelist
- rm /usr/bin/sign_filelist
- chmod +x /usr/bin/pkg-lock && chmod +x /usr/bin/pkg-unlock
- pkg-lock