From f1cdc424327be91cfdbeb35449275cd8582bba8d Mon Sep 17 00:00:00 2001 From: Shulhan Date: Sat, 21 Oct 2023 19:52:17 +0700 Subject: all: implement remote "#get!" and "#put!" with owner and mode When script with magic command "#get!" or "#put!" executed using "play" command, one can changes the owner and/or permission mode by setting the user/group and permission bits after the magic command, for example, #get!user:group+0600 src dst Will changes the owner of dst in local into "user:group" with permission "0600", while #put!user:group+0600 src dst Will changes the owner of dst in remote into "user:group" with permission "0600". --- testdata/play/awwanssh.test/get.aww | 6 ++++++ testdata/play/awwanssh.test/get_test.data | 15 +++++++++++++++ testdata/play/awwanssh.test/put.aww | 6 ++++++ 3 files changed, 27 insertions(+) (limited to 'testdata') diff --git a/testdata/play/awwanssh.test/get.aww b/testdata/play/awwanssh.test/get.aww index c10ae27..4b5d604 100644 --- a/testdata/play/awwanssh.test/get.aww +++ b/testdata/play/awwanssh.test/get.aww @@ -10,3 +10,9 @@ ## privileged. #get:awwan:bin /etc/os-release {{.ScriptDir}}/tmp/get_with_owner.txt + +#get!+0601 /etc/crypttab {{.ScriptDir}}/tmp/sudoget_with_mode.txt + +#get!awwan:bin /etc/crypttab {{.ScriptDir}}/tmp/sudoget_with_owner.txt + +#get!awwan:bin+0602 /etc/crypttab {{.ScriptDir}}/tmp/sudoget_with_owner_mode.txt diff --git a/testdata/play/awwanssh.test/get_test.data b/testdata/play/awwanssh.test/get_test.data index ad4577d..aec7acb 100644 --- a/testdata/play/awwanssh.test/get_test.data +++ b/testdata/play/awwanssh.test/get_test.data @@ -18,3 +18,18 @@ LOGO=archlinux-logo <<< WithOwner:error Play: Get: chown awwan:bin "/home/awwan/src/testdata/play/awwanssh.test/tmp/get_with_owner.txt": exit status 1 + +<<< /etc/crypttab +# Configuration for encrypted block devices. +# See crypttab(5) for details. + +# NOTE: Do not list your root (/) partition here, it must be set up +# beforehand by the initramfs (/etc/mkinitcpio.conf). + +# +# home UUID=b8ad5c18-f445-495d-9095-c9ec4f9d2f37 /etc/mypassword1 +# data1 /dev/sda3 /etc/mypassword2 +# data2 /dev/sda5 /etc/cryptfs.key +# swap /dev/sdx4 /dev/urandom swap,cipher=aes-cbc-essiv:sha256,size=256 +# vol /dev/sdb7 none + diff --git a/testdata/play/awwanssh.test/put.aww b/testdata/play/awwanssh.test/put.aww index 9779ed2..e419a4f 100644 --- a/testdata/play/awwanssh.test/put.aww +++ b/testdata/play/awwanssh.test/put.aww @@ -10,3 +10,9 @@ ## privileged. #put:awwan:bin+666 {{.ScriptDir}}/plain.txt put_with_owner.txt + +#put!+604 {{.ScriptDir}}/plain.txt sudoput_with_mode.txt + +#put!awwan:bin {{.ScriptDir}}/plain.txt sudoput_with_owner.txt + +#put!awwan:bin+602 {{.ScriptDir}}/plain.txt sudoput_with_owner_mode.txt -- cgit v1.3