Skip to content

Commit

Permalink
[aboot]: Add setfacl in the initramfs (#1185)
Browse files Browse the repository at this point in the history
Arista platforms need the filesystem ACLs to be removed on boot to
prevent invalid permission to be set for new files.
  • Loading branch information
Staphylo authored and lguohan committed Nov 25, 2017
1 parent dd7e924 commit 7f25b94
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions build_debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ sudo cp files/initramfs-tools/arista-convertfs $FILESYSTEM_ROOT/etc/initramfs-to
sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-premount/arista-convertfs
sudo cp files/initramfs-tools/mke2fs $FILESYSTEM_ROOT/etc/initramfs-tools/hooks/mke2fs
sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/hooks/mke2fs
sudo cp files/initramfs-tools/setfacl $FILESYSTEM_ROOT/etc/initramfs-tools/hooks/setfacl
sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/hooks/setfacl

# Hook into initramfs: rename the management interfaces on arista switches
sudo cp files/initramfs-tools/arista-net $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-premount/arista-net
Expand Down
3 changes: 3 additions & 0 deletions files/initramfs-tools/arista-convertfs.j2
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ fixup_flash_permissions() {
# this allows the sonic admin user to have read access on the flash
local flash_mnt="$1"
chmod o+rx "$flash_mnt"

# remove all the filesystem acls from the flash
setfacl -Rb "$flash_mnt"
}

# Extract kernel parameters
Expand Down
20 changes: 20 additions & 0 deletions files/initramfs-tools/setfacl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh
#Part of the code is revised based on initramfs-tools/hooks/fsck and initramfs-tool is under GPL v2.

PREREQ=""

prereqs()
{
echo "$PREREQ"
}

case $1 in
prereqs)
prereqs
exit 0
;;
esac

. /usr/share/initramfs-tools/hook-functions

copy_exec /usr/bin/setfacl /sbin/setfacl

0 comments on commit 7f25b94

Please sign in to comment.