dyne / tomb

the Crypto Undertaker
https://dyne.org/software/tomb
GNU General Public License v3.0
1.32k stars 150 forks source link

Avoid manual handling of loop devices #533

Closed Narrat closed 1 week ago

Narrat commented 1 month ago

Cryptsetup is since 1.3.0 capable of setting up a loop device if the device argument is a file. This has the additional benefit that those loop devices will get the AUTOCLEAR flag (available with Linux 2.6.25). This means those loop devices will be closed as soon their're unused (on luksClose).


Read about something unrelated, stumbled upon cryptsetup usage without explicit losetup fiddling and thought maybe this is something for tomb to adopt.

Alternatively lo_preserve() could be dropped and respective changes at other places still could apply. losetup -d removes devices lazily. If it cannot be closed it won't report EBUSY anymore, but instead set AUTOCLEAR (since Linux 3.7). Status can be seen via losetup --list.

Would be nice to get rid of lo_mount (now lo_check), but such a change would change behaviour (e.g. mapper name).

Things to check: If the comment from umount_tomb https://github.com/dyne/tomb/blob/75aafc0c8c6eacfbd7035ecf2a731dd7447f9dde/tomb#L3117-L3122 would still apply with the suggested changes

Narrat commented 1 month ago

The PR did escalate a little bit while researching if the comment I previously mentioned still applies. Of note: Current tomb (2.11) did not cover the case if tombmount would manually be --bind mount to another location. I'm not quite sure if this was the described case in #273, but this is now covered.

And with all those changes in place this PR is ready from my side

jaromil commented 1 month ago

I like it on a first read: less code and more readable, good simplifying strategy.

Are all corner cases observed covered by test units? I fhink is worth adding a few test units to lock in behavior as desired through future regressions.

Narrat commented 1 month ago

Indeed, a manual bind mount isn't covered. Will add that.

On a sidenote: The test tool has seen activity again and is now at version 1.2.1. Maybe it makes sense to update the copy in the repo. Although it won't be a drop-in update. They changed some parts fundamentaly between 1.0.0 and the most recent version.

jaromil commented 1 month ago

when anyone of us has time to update sharness lets do it in a separate PR. oh and BTW I really appreciate your substantial help on maintenance chores and updates ❤️

Narrat commented 1 month ago

Yeah, didn't intend to cram that into this PR :D But may help to open an issue. Should maybe be restructed, as adding this case didn't fit in the existing structure. Also noticed, that the bind test pollutes $HOME, which should probably be adjusted. Chores are tedious, but help in the long run :D And for me it goes without saying, that if I can give something back, do so. Especially since I use this tool for quite some time already.

Narrat commented 1 month ago

Hmm... the added test is working locally. Now to figure out was is different on these container images.

Narrat commented 1 month ago

Hmm... it failed at the original bind hook test, which I didn't touch beside the whitespace issue. It couldn't mount the test tomb because of the key? Password was okay, but now the key isn't available?

2024-08-07T20:01:26.7970001Z *** 75_hooks.sh ***
2024-08-07T20:01:26.8101728Z expecting success: 
2024-08-07T20:01:26.8102293Z     tt_open --tomb-pwd $DUMMYPASS &&
2024-08-07T20:01:26.8102684Z     tt_set_ownership "$MEDIA/$testname" &&
2024-08-07T20:01:26.8103020Z     RND="$RANDOM" &&
2024-08-07T20:01:26.8103375Z     bindtest="dyne-tomb-bind-test-$RND" &&
2024-08-07T20:01:26.8103767Z     echo "$RND" > "$MEDIA/$testname/$bindtest" &&
2024-08-07T20:01:26.8104180Z     rm -f "$MEDIA/$testname/bind-hooks" &&
2024-08-07T20:01:26.8104670Z     echo "$bindtest $bindtest" > "$MEDIA/$testname/bind-hooks" &&
2024-08-07T20:01:26.8105080Z     tt_close &&
2024-08-07T20:01:26.8105321Z     touch "$TEMPHOME/$bindtest" &&
2024-08-07T20:01:26.8105666Z     tt_open --tomb-pwd $DUMMYPASS &&
2024-08-07T20:01:26.8105973Z     echo "$RND" &&
2024-08-07T20:01:26.8106224Z     cat "$TEMPHOME/$bindtest" &&
2024-08-07T20:01:26.8106511Z     tt list $testname &&
2024-08-07T20:01:26.8106759Z     tt_close
2024-08-07T20:01:26.8106959Z     
2024-08-07T20:01:26.8365612Z tomb [D] Identified caller: runner (1001:127)
2024-08-07T20:01:26.8410513Z tomb [D] Updating HOME to match user's: /home/runner (was /tmp/tomb/sharness/trash directory.sharness)
2024-08-07T20:01:26.8427078Z tomb [D] Tomb command: open /tmp/tomb/test.tomb
2024-08-07T20:01:26.8443716Z tomb [D] Caller: uid[1001], gid[127], tty[::3 tty::].
2024-08-07T20:01:26.8459746Z tomb [D] Temporary directory: /tmp
2024-08-07T20:01:26.8475786Z tomb  .  Commanded to open tomb /tmp/tomb/test.tomb
2024-08-07T20:01:26.8492642Z tomb [D] is_valid_tomb /tmp/tomb/test.tomb
2024-08-07T20:01:26.8508817Z tomb [D] tomb file is readable
2024-08-07T20:01:26.8525842Z tomb [D] tomb file is a regular file
2024-08-07T20:01:26.8541715Z tomb [D] tomb file is not empty
2024-08-07T20:01:26.8656763Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:26.8713184Z tomb [D] Mapper: tomb.test.ccffcb34977c2f4aad5a9405f6b9c77d909cf6ca53d9c8783bb6985a36f9b78a.loop3
2024-08-07T20:01:26.8729523Z tomb [D] tomb file is not currently in use
2024-08-07T20:01:26.8745811Z tomb  .  Valid tomb file found: /tmp/tomb/test.tomb
2024-08-07T20:01:26.8784838Z tomb [D] load_key argument: /tmp/tomb/test.tomb.key
2024-08-07T20:01:26.8818173Z tomb [D] load_key: /tmp/tomb/test.tomb.key
2024-08-07T20:01:26.8834573Z tomb [D] is_valid_key
2024-08-07T20:01:26.8906779Z tomb  .  Key is valid.
2024-08-07T20:01:26.8924213Z tomb  .  Mountpoint not specified, using default: /media/test
2024-08-07T20:01:26.8941598Z tomb (*) Opening test on /media/test
2024-08-07T20:01:26.8990583Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:26.9037318Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:26.9101655Z tomb  .  This tomb is a valid LUKS encrypted device.
2024-08-07T20:01:26.9138930Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:26.9251400Z tomb  .  Cipher is "aes" mode "xts-plain64" hash "sha512"
2024-08-07T20:01:26.9297842Z tomb [D] Tomb key: /tmp/tomb/test.tomb.key
2024-08-07T20:01:26.9314837Z tomb [D] Tomb name: test (to be engraved)
2024-08-07T20:01:26.9338156Z tomb [D] tomb-pwd = test
2024-08-07T20:01:26.9355013Z tomb  .  A password is required to use key /tmp/tomb/test.tomb.key
2024-08-07T20:01:26.9372302Z tomb [D] ask_key_password with tombpass: test
2024-08-07T20:01:26.9389197Z tomb [D] get_lukskey
2024-08-07T20:01:26.9500483Z tomb [D] Created tempfile: /tmp/13439107071900728300
2024-08-07T20:01:27.2232682Z tomb [D] gpg: AES256.CFB encrypted data
2024-08-07T20:01:27.2250485Z tomb [D] [GNUPG:] NEED_PASSPHRASE_SYM 9 3 2
2024-08-07T20:01:27.2267937Z tomb [D] gpg: encrypted with 1 passphrase
2024-08-07T20:01:27.2285045Z tomb [D] [GNUPG:] BEGIN_DECRYPTION
2024-08-07T20:01:27.2301634Z tomb [D] [GNUPG:] DECRYPTION_COMPLIANCE_MODE 23
2024-08-07T20:01:27.2317990Z tomb [D] [GNUPG:] DECRYPTION_INFO 2 9 0
2024-08-07T20:01:27.2334657Z tomb [D] [GNUPG:] PLAINTEXT 62 1723060886 
2024-08-07T20:01:27.2350741Z tomb [D] [GNUPG:] DECRYPTION_OKAY
2024-08-07T20:01:27.2368014Z tomb [D] [GNUPG:] GOODMDC
2024-08-07T20:01:27.2384971Z tomb [D] [GNUPG:] END_DECRYPTION
2024-08-07T20:01:27.2401602Z tomb [D] get_lukskey returns 0
2024-08-07T20:01:27.2418343Z tomb  .  Password OK.
2024-08-07T20:01:27.2456316Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:29.3743972Z No key available with this passphrase.
2024-08-07T20:01:29.3780805Z tomb [E] Failure mounting the encrypted file.
2024-08-07T20:01:29.3799530Z tomb [D] Restoring access and modification time for /tmp/tomb/test.tomb.key
2024-08-07T20:01:29.3838745Z tomb [D] Restoring access and modification time for /tmp/tomb/test.tomb
2024-08-07T20:01:29.4060681Z      Tomb command returns 1
2024-08-07T20:01:29.4061871Z not ok 1 - Testing bind hooks
2024-08-07T20:01:29.4075333Z #  
2024-08-07T20:01:29.4075871Z #      tt_open --tomb-pwd $DUMMYPASS &&
2024-08-07T20:01:29.4076477Z #      tt_set_ownership "$MEDIA/$testname" &&
2024-08-07T20:01:29.4077062Z #      RND="$RANDOM" &&
2024-08-07T20:01:29.4077620Z #      bindtest="dyne-tomb-bind-test-$RND" &&
2024-08-07T20:01:29.4078253Z #      echo "$RND" > "$MEDIA/$testname/$bindtest" &&
2024-08-07T20:01:29.4078969Z #      rm -f "$MEDIA/$testname/bind-hooks" &&
2024-08-07T20:01:29.4079828Z #      echo "$bindtest $bindtest" > "$MEDIA/$testname/bind-hooks" &&
2024-08-07T20:01:29.4080513Z #      tt_close &&
2024-08-07T20:01:29.4081201Z #      touch "$TEMPHOME/$bindtest" &&
2024-08-07T20:01:29.4081749Z #      tt_open --tomb-pwd $DUMMYPASS &&
2024-08-07T20:01:29.4082254Z #      echo "$RND" &&
2024-08-07T20:01:29.4082868Z #      cat "$TEMPHOME/$bindtest" &&
2024-08-07T20:01:29.4083375Z #      tt list $testname &&
2024-08-07T20:01:29.4083783Z #      tt_close
2024-08-07T20:01:29.4084119Z #      
2024-08-07T20:01:29.4084521Z make[2]: *** [Makefile:40: 75_hooks.sh] Error 1

Relevant part:

2024-08-07T20:01:29.3743972Z No key available with this passphrase.
2024-08-07T20:01:29.3780805Z tomb [E] Failure mounting the encrypted file.
Narrat commented 1 month ago

The cancelled container confirms, that it works in general:

2024-08-07T20:01:32.0556580Z *** 75_hooks.sh ***
2024-08-07T20:01:32.0683807Z expecting success: 
2024-08-07T20:01:32.0684721Z     tt_open --tomb-pwd $DUMMYPASS &&
2024-08-07T20:01:32.0685373Z     tt_set_ownership "$MEDIA/$testname" &&
2024-08-07T20:01:32.0685762Z     RND="$RANDOM" &&
2024-08-07T20:01:32.0686162Z     bindtest="dyne-tomb-bind-test-$RND" &&
2024-08-07T20:01:32.0686621Z     echo "$RND" > "$MEDIA/$testname/$bindtest" &&
2024-08-07T20:01:32.0687087Z     rm -f "$MEDIA/$testname/bind-hooks" &&
2024-08-07T20:01:32.0687582Z     echo "$bindtest $bindtest" > "$MEDIA/$testname/bind-hooks" &&
2024-08-07T20:01:32.0687999Z     tt_close &&
2024-08-07T20:01:32.0688253Z     touch "$TEMPHOME/$bindtest" &&
2024-08-07T20:01:32.0688619Z     tt_open --tomb-pwd $DUMMYPASS &&
2024-08-07T20:01:32.0689070Z     echo "$RND" &&
2024-08-07T20:01:32.0689539Z     cat "$TEMPHOME/$bindtest" &&
2024-08-07T20:01:32.0690116Z     tt list $testname &&
2024-08-07T20:01:32.0690573Z     tt_close
2024-08-07T20:01:32.0690956Z     
2024-08-07T20:01:32.0929108Z tomb [D] Identified caller: runner (1001:127)
2024-08-07T20:01:32.0971803Z tomb [D] Updating HOME to match user's: /home/runner (was /tmp/tomb/sharness/trash directory.sharness)
2024-08-07T20:01:32.0985947Z tomb [D] Tomb command: open /tmp/tomb/test.tomb
2024-08-07T20:01:32.0999935Z tomb [D] Caller: uid[1001], gid[127], tty[::3 tty::].
2024-08-07T20:01:32.1013497Z tomb [D] Temporary directory: /tmp
2024-08-07T20:01:32.1027554Z tomb  .  Commanded to open tomb /tmp/tomb/test.tomb
2024-08-07T20:01:32.1042171Z tomb [D] is_valid_tomb /tmp/tomb/test.tomb
2024-08-07T20:01:32.1056349Z tomb [D] tomb file is readable
2024-08-07T20:01:32.1070165Z tomb [D] tomb file is a regular file
2024-08-07T20:01:32.1084103Z tomb [D] tomb file is not empty
2024-08-07T20:01:32.1198199Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:32.1250972Z tomb [D] Mapper: tomb.test.ccffcb34977c2f4aad5a9405f6b9c77d909cf6ca53d9c8783bb6985a36f9b78a.loop3
2024-08-07T20:01:32.1265050Z tomb [D] tomb file is not currently in use
2024-08-07T20:01:32.1279959Z tomb  .  Valid tomb file found: /tmp/tomb/test.tomb
2024-08-07T20:01:32.1315904Z tomb [D] load_key argument: /tmp/tomb/test.tomb.key
2024-08-07T20:01:32.1345776Z tomb [D] load_key: /tmp/tomb/test.tomb.key
2024-08-07T20:01:32.1360412Z tomb [D] is_valid_key
2024-08-07T20:01:32.1424304Z tomb  .  Key is valid.
2024-08-07T20:01:32.1440173Z tomb  .  Mountpoint not specified, using default: /media/test
2024-08-07T20:01:32.1454417Z tomb (*) Opening test on /media/test
2024-08-07T20:01:32.1499140Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:32.1544603Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:32.1591512Z tomb  .  This tomb is a valid LUKS encrypted device.
2024-08-07T20:01:32.1625693Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:32.1746414Z tomb  .  Cipher is "aes" mode "xts-plain64" hash "sha512"
2024-08-07T20:01:32.1785967Z tomb [D] Tomb key: /tmp/tomb/test.tomb.key
2024-08-07T20:01:32.1801249Z tomb [D] Tomb name: test (to be engraved)
2024-08-07T20:01:32.1821036Z tomb [D] tomb-pwd = test
2024-08-07T20:01:32.1835970Z tomb  .  A password is required to use key /tmp/tomb/test.tomb.key
2024-08-07T20:01:32.1849945Z tomb [D] ask_key_password with tombpass: test
2024-08-07T20:01:32.1864385Z tomb [D] get_lukskey
2024-08-07T20:01:32.1965108Z tomb [D] Created tempfile: /tmp/12064280892342131424
2024-08-07T20:01:32.6602110Z tomb [D] gpg: AES256 encrypted data
2024-08-07T20:01:32.6618121Z tomb [D] [GNUPG:] NEED_PASSPHRASE_SYM 9 3 2
2024-08-07T20:01:32.6633381Z tomb [D] gpg: encrypted with 1 passphrase
2024-08-07T20:01:32.6648362Z tomb [D] [GNUPG:] BEGIN_DECRYPTION
2024-08-07T20:01:32.6663533Z tomb [D] [GNUPG:] DECRYPTION_COMPLIANCE_MODE 23
2024-08-07T20:01:32.6678532Z tomb [D] [GNUPG:] DECRYPTION_INFO 2 9
2024-08-07T20:01:32.6693303Z tomb [D] [GNUPG:] PLAINTEXT 62 1723060891 
2024-08-07T20:01:32.6707995Z tomb [D] [GNUPG:] DECRYPTION_OKAY
2024-08-07T20:01:32.6723695Z tomb [D] [GNUPG:] GOODMDC
2024-08-07T20:01:32.6738273Z tomb [D] [GNUPG:] END_DECRYPTION
2024-08-07T20:01:32.6753051Z tomb [D] get_lukskey returns 0
2024-08-07T20:01:32.6767535Z tomb  .  Password OK.
2024-08-07T20:01:32.6801501Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:34.8668403Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:34.8715885Z tomb (*) Success unlocking tomb test
2024-08-07T20:01:34.8730510Z tomb [D] Key size is 512 for cipher aes-xts-plain64
2024-08-07T20:01:34.8749202Z tomb [D] detecting filesystem of /dev/mapper/tomb.test.ccffcb34977c2f4aad5a9405f6b9c77d909cf6ca53d9c8783bb6985a36f9b78a.loop3
2024-08-07T20:01:34.8788177Z tomb  .  Filesystem detected: ext4
2024-08-07T20:01:34.8804500Z tomb [D] Tomb engraved as test
2024-08-07T20:01:34.8819254Z tomb  .  Checking filesystem via /dev/loop3
2024-08-07T20:01:34.8849689Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:34.8862019Z fsck from util-linux 2.34
2024-08-07T20:01:34.8896145Z test: clean, 17/4608 files, 3743/7168 blocks
2024-08-07T20:01:34.8937811Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:34.9010603Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:34.9060637Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:34.9131638Z tomb (*) Success opening test.tomb on /media/test
2024-08-07T20:01:34.9167319Z cat: /media/test/.tty: No such file or directory
2024-08-07T20:01:34.9253547Z tomb  .  Last visit by runner(1001) from fv-az1053-478 on ::4 host::
2024-08-07T20:01:34.9266931Z tomb  .  on date Wed Aug  7 20:01:26 2024
2024-08-07T20:01:34.9298600Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:34.9338739Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:34.9368603Z tomb [D] updated control file /media/test/.uid = 1001
2024-08-07T20:01:34.9412577Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:34.9451129Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:34.9479344Z tomb [D] updated control file /media/test/.host = fv-az1053-478
2024-08-07T20:01:34.9522093Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:34.9561207Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:34.9589723Z tomb [D] updated control file /media/test/.last = 1723060894
2024-08-07T20:01:34.9605880Z tomb [D] bind-hooks not found in /media/test
2024-08-07T20:01:34.9637237Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:34.9667592Z tomb [D] Restoring access and modification time for /tmp/tomb/test.tomb.key
2024-08-07T20:01:34.9699845Z tomb [D] Restoring access and modification time for /tmp/tomb/test.tomb
2024-08-07T20:01:34.9905313Z loop device usage change to 4
2024-08-07T20:01:34.9905893Z      Tomb command returns 0
2024-08-07T20:01:35.0293797Z tomb [D] Identified caller: runner (1001:127)
2024-08-07T20:01:35.0334904Z tomb [D] Updating HOME to match user's: /home/runner (was /tmp/tomb/sharness/trash directory.sharness)
2024-08-07T20:01:35.0349359Z tomb [D] Tomb command: close test
2024-08-07T20:01:35.0364387Z tomb [D] Caller: uid[1001], gid[127], tty[::3 tty::].
2024-08-07T20:01:35.0378856Z tomb [D] Temporary directory: /tmp
2024-08-07T20:01:35.0438138Z tomb [D] Name: [test]
2024-08-07T20:01:35.0451721Z tomb [D] Mount: /media/test
2024-08-07T20:01:35.0465712Z tomb [D] Loop: loop3
2024-08-07T20:01:35.0479905Z tomb [D] Mapper: tomb.test.ccffcb34977c2f4aad5a9405f6b9c77d909cf6ca53d9c8783bb6985a36f9b78a.loop3
2024-08-07T20:01:35.0493798Z tomb  .  Closing tomb [test] mounted on /media/test
2024-08-07T20:01:35.0532665Z tomb [D] Performing umount of /media/test
2024-08-07T20:01:35.0570095Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:35.0681225Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:35.0721318Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:35.1149679Z tomb (*) Tomb [test] closed: your bones will rest in peace.
2024-08-07T20:01:35.1237396Z loop device usage change to 3
2024-08-07T20:01:35.1237967Z      Tomb command returns 0
2024-08-07T20:01:35.1491367Z tomb [D] Identified caller: runner (1001:127)
2024-08-07T20:01:35.1531020Z tomb [D] Updating HOME to match user's: /home/runner (was /tmp/tomb/sharness/trash directory.sharness)
2024-08-07T20:01:35.1544999Z tomb [D] Tomb command: open /tmp/tomb/test.tomb
2024-08-07T20:01:35.1559136Z tomb [D] Caller: uid[1001], gid[127], tty[::3 tty::].
2024-08-07T20:01:35.1572841Z tomb [D] Temporary directory: /tmp
2024-08-07T20:01:35.1586875Z tomb  .  Commanded to open tomb /tmp/tomb/test.tomb
2024-08-07T20:01:35.1601806Z tomb [D] is_valid_tomb /tmp/tomb/test.tomb
2024-08-07T20:01:35.1615848Z tomb [D] tomb file is readable
2024-08-07T20:01:35.1629652Z tomb [D] tomb file is a regular file
2024-08-07T20:01:35.1643824Z tomb [D] tomb file is not empty
2024-08-07T20:01:35.1759258Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:35.1809398Z tomb [D] Mapper: tomb.test.ccffcb34977c2f4aad5a9405f6b9c77d909cf6ca53d9c8783bb6985a36f9b78a.loop3
2024-08-07T20:01:35.1823078Z tomb [D] tomb file is not currently in use
2024-08-07T20:01:35.1837789Z tomb  .  Valid tomb file found: /tmp/tomb/test.tomb
2024-08-07T20:01:35.1872762Z tomb [D] load_key argument: /tmp/tomb/test.tomb.key
2024-08-07T20:01:35.1901685Z tomb [D] load_key: /tmp/tomb/test.tomb.key
2024-08-07T20:01:35.1916203Z tomb [D] is_valid_key
2024-08-07T20:01:35.1980336Z tomb  .  Key is valid.
2024-08-07T20:01:35.1994960Z tomb  .  Mountpoint not specified, using default: /media/test
2024-08-07T20:01:35.2008828Z tomb (*) Opening test on /media/test
2024-08-07T20:01:35.2051979Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:35.2094493Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:35.2137501Z tomb  .  This tomb is a valid LUKS encrypted device.
2024-08-07T20:01:35.2171028Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:35.2292847Z tomb  .  Cipher is "aes" mode "xts-plain64" hash "sha512"
2024-08-07T20:01:35.2330974Z tomb [D] Tomb key: /tmp/tomb/test.tomb.key
2024-08-07T20:01:35.2345593Z tomb [D] Tomb name: test (to be engraved)
2024-08-07T20:01:35.2365928Z tomb [D] tomb-pwd = test
2024-08-07T20:01:35.2380119Z tomb  .  A password is required to use key /tmp/tomb/test.tomb.key
2024-08-07T20:01:35.2393957Z tomb [D] ask_key_password with tombpass: test
2024-08-07T20:01:35.2407966Z tomb [D] get_lukskey
2024-08-07T20:01:35.2508960Z tomb [D] Created tempfile: /tmp/32446969772112450
2024-08-07T20:01:35.6943554Z tomb [D] gpg: AES256 encrypted data
2024-08-07T20:01:35.6958847Z tomb [D] [GNUPG:] NEED_PASSPHRASE_SYM 9 3 2
2024-08-07T20:01:35.6973515Z tomb [D] gpg: encrypted with 1 passphrase
2024-08-07T20:01:35.6988060Z tomb [D] [GNUPG:] BEGIN_DECRYPTION
2024-08-07T20:01:35.7002565Z tomb [D] [GNUPG:] DECRYPTION_COMPLIANCE_MODE 23
2024-08-07T20:01:35.7016985Z tomb [D] [GNUPG:] DECRYPTION_INFO 2 9
2024-08-07T20:01:35.7031676Z tomb [D] [GNUPG:] PLAINTEXT 62 1723060891 
2024-08-07T20:01:35.7048726Z tomb [D] [GNUPG:] DECRYPTION_OKAY
2024-08-07T20:01:35.7063364Z tomb [D] [GNUPG:] GOODMDC
2024-08-07T20:01:35.7078539Z tomb [D] [GNUPG:] END_DECRYPTION
2024-08-07T20:01:35.7093259Z tomb [D] get_lukskey returns 0
2024-08-07T20:01:35.7107798Z tomb  .  Password OK.
2024-08-07T20:01:35.7141950Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:37.9126579Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:37.9174357Z tomb (*) Success unlocking tomb test
2024-08-07T20:01:37.9189706Z tomb [D] Key size is 512 for cipher aes-xts-plain64
2024-08-07T20:01:37.9211908Z tomb [D] detecting filesystem of /dev/mapper/tomb.test.ccffcb34977c2f4aad5a9405f6b9c77d909cf6ca53d9c8783bb6985a36f9b78a.loop3
2024-08-07T20:01:37.9251388Z tomb  .  Filesystem detected: ext4
2024-08-07T20:01:37.9266111Z tomb [D] Tomb engraved as test
2024-08-07T20:01:37.9280973Z tomb  .  Checking filesystem via /dev/loop3
2024-08-07T20:01:37.9311068Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:37.9324386Z fsck from util-linux 2.34
2024-08-07T20:01:37.9359048Z test: clean, 19/4608 files, 3745/7168 blocks
2024-08-07T20:01:37.9402343Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:37.9468156Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:37.9520295Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:37.9603725Z tomb (*) Success opening test.tomb on /media/test
2024-08-07T20:01:37.9641119Z cat: /media/test/.tty: No such file or directory
2024-08-07T20:01:37.9726737Z tomb  .  Last visit by runner(1001) from fv-az1053-478 on ::4 host::
2024-08-07T20:01:37.9740560Z tomb  .  on date Wed Aug  7 20:01:34 2024
2024-08-07T20:01:37.9771872Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:37.9810565Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:37.9840476Z tomb [D] updated control file /media/test/.uid = 1001
2024-08-07T20:01:37.9884261Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:37.9923101Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:37.9951075Z tomb [D] updated control file /media/test/.host = fv-az1053-478
2024-08-07T20:01:37.9994633Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:38.0033101Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:38.0060319Z tomb [D] updated control file /media/test/.last = 1723060897
2024-08-07T20:01:38.0077282Z tomb [D] bind-hook found: dyne-tomb-bind-test-24905 -> dyne-tomb-bind-test-24905
2024-08-07T20:01:38.0091903Z tomb [W] bind-hook target not existent, skipping /home/runner/dyne-tomb-bind-test-24905
2024-08-07T20:01:38.0123573Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:38.0154944Z tomb [D] Restoring access and modification time for /tmp/tomb/test.tomb.key
2024-08-07T20:01:38.0187006Z tomb [D] Restoring access and modification time for /tmp/tomb/test.tomb
2024-08-07T20:01:38.0376701Z loop device usage change to 4
2024-08-07T20:01:38.0377125Z      Tomb command returns 0
2024-08-07T20:01:38.0377426Z 24905
2024-08-07T20:01:38.0631205Z tomb [D] Identified caller: runner (1001:127)
2024-08-07T20:01:38.0674236Z tomb [D] Updating HOME to match user's: /home/runner (was /tmp/tomb/sharness/trash directory.sharness)
2024-08-07T20:01:38.0688105Z tomb [D] Tomb command: list test
2024-08-07T20:01:38.0702222Z tomb [D] Caller: uid[1001], gid[127], tty[::3 tty::].
2024-08-07T20:01:38.0718682Z tomb [D] Temporary directory: /tmp
2024-08-07T20:01:38.0803322Z tomb  .  [test] open on /media/test using (rw,nodev,noatime)
2024-08-07T20:01:38.0816897Z tomb [D] [test] attached to /dev/loop3 device
2024-08-07T20:01:38.0830813Z tomb  .  [test] open since ::2 tombsince::
2024-08-07T20:01:38.0845831Z tomb  .  [test] size 24M of which 11M (47%) is used: 12M free 
2024-08-07T20:01:38.0955898Z      Tomb command returns 0
2024-08-07T20:01:38.1201537Z tomb [D] Identified caller: runner (1001:127)
2024-08-07T20:01:38.1240892Z tomb [D] Updating HOME to match user's: /home/runner (was /tmp/tomb/sharness/trash directory.sharness)
2024-08-07T20:01:38.1255062Z tomb [D] Tomb command: close test
2024-08-07T20:01:38.1269657Z tomb [D] Caller: uid[1001], gid[127], tty[::3 tty::].
2024-08-07T20:01:38.1284116Z tomb [D] Temporary directory: /tmp
2024-08-07T20:01:38.1342480Z tomb [D] Name: [test]
2024-08-07T20:01:38.1356968Z tomb [D] Mount: /media/test
2024-08-07T20:01:38.1371242Z tomb [D] Loop: loop3
2024-08-07T20:01:38.1385961Z tomb [D] Mapper: tomb.test.ccffcb34977c2f4aad5a9405f6b9c77d909cf6ca53d9c8783bb6985a36f9b78a.loop3
2024-08-07T20:01:38.1400954Z tomb  .  Closing tomb [test] mounted on /media/test
2024-08-07T20:01:38.1440742Z tomb [D] Performing umount of /media/test
2024-08-07T20:01:38.1479028Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:38.1568475Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:38.1608191Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:38.2187275Z tomb (*) Tomb [test] closed: your bones will rest in peace.
2024-08-07T20:01:38.2270906Z loop device usage change to 3
2024-08-07T20:01:38.2271747Z      Tomb command returns 0
2024-08-07T20:01:38.2273528Z ok 1 - Testing bind hooks
2024-08-07T20:01:38.2273863Z 
2024-08-07T20:01:38.2274956Z expecting success: 
2024-08-07T20:01:38.2275551Z     tt_open --tomb-pwd $DUMMYPASS &&
2024-08-07T20:01:38.2276000Z     tt_set_ownership "$MEDIA/$testname" &&
2024-08-07T20:01:38.2276418Z     sudo mkdir "$MEDIA/$testname-bind" &&
2024-08-07T20:01:38.2276915Z     sudo mount --bind "$MEDIA/$testname" "$MEDIA/$testname-bind" &&
2024-08-07T20:01:38.2277359Z     tt list $testname &&
2024-08-07T20:01:38.2277629Z     tt_close &&
2024-08-07T20:01:38.2277972Z     sudo rmdir "$MEDIA/$testname-bind"
2024-08-07T20:01:38.2278282Z     
2024-08-07T20:01:38.2518803Z tomb [D] Identified caller: runner (1001:127)
2024-08-07T20:01:38.2559303Z tomb [D] Updating HOME to match user's: /home/runner (was /tmp/tomb/sharness/trash directory.sharness)
2024-08-07T20:01:38.2573355Z tomb [D] Tomb command: open /tmp/tomb/test.tomb
2024-08-07T20:01:38.2587466Z tomb [D] Caller: uid[1001], gid[127], tty[::3 tty::].
2024-08-07T20:01:38.2602716Z tomb [D] Temporary directory: /tmp
2024-08-07T20:01:38.2616658Z tomb  .  Commanded to open tomb /tmp/tomb/test.tomb
2024-08-07T20:01:38.2631791Z tomb [D] is_valid_tomb /tmp/tomb/test.tomb
2024-08-07T20:01:38.2645680Z tomb [D] tomb file is readable
2024-08-07T20:01:38.2659964Z tomb [D] tomb file is a regular file
2024-08-07T20:01:38.2674249Z tomb [D] tomb file is not empty
2024-08-07T20:01:38.2786290Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:38.2834122Z tomb [D] Mapper: tomb.test.ccffcb34977c2f4aad5a9405f6b9c77d909cf6ca53d9c8783bb6985a36f9b78a.loop3
2024-08-07T20:01:38.2847839Z tomb [D] tomb file is not currently in use
2024-08-07T20:01:38.2861997Z tomb  .  Valid tomb file found: /tmp/tomb/test.tomb
2024-08-07T20:01:38.2898183Z tomb [D] load_key argument: /tmp/tomb/test.tomb.key
2024-08-07T20:01:38.2927505Z tomb [D] load_key: /tmp/tomb/test.tomb.key
2024-08-07T20:01:38.2941480Z tomb [D] is_valid_key
2024-08-07T20:01:38.3007493Z tomb  .  Key is valid.
2024-08-07T20:01:38.3021944Z tomb  .  Mountpoint not specified, using default: /media/test
2024-08-07T20:01:38.3037058Z tomb (*) Opening test on /media/test
2024-08-07T20:01:38.3080762Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:38.3123233Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:38.3167550Z tomb  .  This tomb is a valid LUKS encrypted device.
2024-08-07T20:01:38.3200982Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:38.3320563Z tomb  .  Cipher is "aes" mode "xts-plain64" hash "sha512"
2024-08-07T20:01:38.3360154Z tomb [D] Tomb key: /tmp/tomb/test.tomb.key
2024-08-07T20:01:38.3375246Z tomb [D] Tomb name: test (to be engraved)
2024-08-07T20:01:38.3395384Z tomb [D] tomb-pwd = test
2024-08-07T20:01:38.3410050Z tomb  .  A password is required to use key /tmp/tomb/test.tomb.key
2024-08-07T20:01:38.3424110Z tomb [D] ask_key_password with tombpass: test
2024-08-07T20:01:38.3438927Z tomb [D] get_lukskey
2024-08-07T20:01:38.3539487Z tomb [D] Created tempfile: /tmp/9762168003013221744
2024-08-07T20:01:38.7983073Z tomb [D] gpg: AES256 encrypted data
2024-08-07T20:01:38.7997942Z tomb [D] [GNUPG:] NEED_PASSPHRASE_SYM 9 3 2
2024-08-07T20:01:38.8012758Z tomb [D] gpg: encrypted with 1 passphrase
2024-08-07T20:01:38.8027631Z tomb [D] [GNUPG:] BEGIN_DECRYPTION
2024-08-07T20:01:38.8042629Z tomb [D] [GNUPG:] DECRYPTION_COMPLIANCE_MODE 23
2024-08-07T20:01:38.8057082Z tomb [D] [GNUPG:] DECRYPTION_INFO 2 9
2024-08-07T20:01:38.8071215Z tomb [D] [GNUPG:] PLAINTEXT 62 1723060891 
2024-08-07T20:01:38.8086161Z tomb [D] [GNUPG:] DECRYPTION_OKAY
2024-08-07T20:01:38.8100950Z tomb [D] [GNUPG:] GOODMDC
2024-08-07T20:01:38.8115076Z tomb [D] [GNUPG:] END_DECRYPTION
2024-08-07T20:01:38.8129313Z tomb [D] get_lukskey returns 0
2024-08-07T20:01:38.8143298Z tomb  .  Password OK.
2024-08-07T20:01:38.8175826Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:41.0070308Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:41.0116879Z tomb (*) Success unlocking tomb test
2024-08-07T20:01:41.0131636Z tomb [D] Key size is 512 for cipher aes-xts-plain64
2024-08-07T20:01:41.0149726Z tomb [D] detecting filesystem of /dev/mapper/tomb.test.ccffcb34977c2f4aad5a9405f6b9c77d909cf6ca53d9c8783bb6985a36f9b78a.loop3
2024-08-07T20:01:41.0187970Z tomb  .  Filesystem detected: ext4
2024-08-07T20:01:41.0202664Z tomb [D] Tomb engraved as test
2024-08-07T20:01:41.0217615Z tomb  .  Checking filesystem via /dev/loop3
2024-08-07T20:01:41.0248627Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:41.0260325Z fsck from util-linux 2.34
2024-08-07T20:01:41.0309206Z test: clean, 19/4608 files, 3745/7168 blocks
2024-08-07T20:01:41.0354146Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:41.0421015Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:41.0481378Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:41.0561504Z tomb (*) Success opening test.tomb on /media/test
2024-08-07T20:01:41.0600795Z cat: /media/test/.tty: No such file or directory
2024-08-07T20:01:41.0683983Z tomb  .  Last visit by runner(1001) from fv-az1053-478 on ::4 host::
2024-08-07T20:01:41.0697786Z tomb  .  on date Wed Aug  7 20:01:37 2024
2024-08-07T20:01:41.0728787Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:41.0768664Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:41.0798966Z tomb [D] updated control file /media/test/.uid = 1001
2024-08-07T20:01:41.0842069Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:41.0879954Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:41.0908108Z tomb [D] updated control file /media/test/.host = fv-az1053-478
2024-08-07T20:01:41.0950457Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:41.0990132Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:41.1018728Z tomb [D] updated control file /media/test/.last = 1723060901
2024-08-07T20:01:41.1036126Z tomb [D] bind-hook found: dyne-tomb-bind-test-24905 -> dyne-tomb-bind-test-24905
2024-08-07T20:01:41.1051314Z tomb [W] bind-hook target not existent, skipping /home/runner/dyne-tomb-bind-test-24905
2024-08-07T20:01:41.1082346Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:41.1113449Z tomb [D] Restoring access and modification time for /tmp/tomb/test.tomb.key
2024-08-07T20:01:41.1145544Z tomb [D] Restoring access and modification time for /tmp/tomb/test.tomb
2024-08-07T20:01:41.1403138Z loop device usage change to 4
2024-08-07T20:01:41.1403737Z      Tomb command returns 0
2024-08-07T20:01:41.1919725Z tomb [D] Identified caller: runner (1001:127)
2024-08-07T20:01:41.1961394Z tomb [D] Updating HOME to match user's: /home/runner (was /tmp/tomb/sharness/trash directory.sharness)
2024-08-07T20:01:41.1975240Z tomb [D] Tomb command: list test
2024-08-07T20:01:41.1989394Z tomb [D] Caller: uid[1001], gid[127], tty[::3 tty::].
2024-08-07T20:01:41.2003698Z tomb [D] Temporary directory: /tmp
2024-08-07T20:01:41.2087834Z tomb  .  [test] open on /media/test using (rw,nodev,noatime)
2024-08-07T20:01:41.2101334Z tomb [D] [test] attached to /dev/loop3 device
2024-08-07T20:01:41.2115732Z tomb  .  [test] open since ::2 tombsince::
2024-08-07T20:01:41.2130297Z tomb  .  [test] size 24M of which 11M (47%) is used: 12M free 
2024-08-07T20:01:41.2172489Z tomb  .  [test] hooks /media/test-bind
2024-08-07T20:01:41.2263269Z      Tomb command returns 0
2024-08-07T20:01:41.2509537Z tomb [D] Identified caller: runner (1001:127)
2024-08-07T20:01:41.2550589Z tomb [D] Updating HOME to match user's: /home/runner (was /tmp/tomb/sharness/trash directory.sharness)
2024-08-07T20:01:41.2565710Z tomb [D] Tomb command: close test
2024-08-07T20:01:41.2580423Z tomb [D] Caller: uid[1001], gid[127], tty[::3 tty::].
2024-08-07T20:01:41.2594990Z tomb [D] Temporary directory: /tmp
2024-08-07T20:01:41.2654555Z tomb [D] Name: [test]
2024-08-07T20:01:41.2668110Z tomb [D] Mount: /media/test
2024-08-07T20:01:41.2682292Z tomb [D] Loop: loop3
2024-08-07T20:01:41.2696513Z tomb [D] Mapper: tomb.test.ccffcb34977c2f4aad5a9405f6b9c77d909cf6ca53d9c8783bb6985a36f9b78a.loop3
2024-08-07T20:01:41.2710802Z tomb  .  Closing tomb [test] mounted on /media/test
2024-08-07T20:01:41.2754919Z tomb  .  Closing tomb bind hook: /media/test-bind
2024-08-07T20:01:41.2788864Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:41.2819030Z tomb [D] Performing umount of /media/test
2024-08-07T20:01:41.2861021Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:41.2946700Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:41.2985224Z tomb [D] Super user execution skipped (SUID caller)
2024-08-07T20:01:41.3386914Z tomb (*) Tomb [test] closed: your bones will rest in peace.
2024-08-07T20:01:41.3476735Z loop device usage change to 3
2024-08-07T20:01:41.3477383Z      Tomb command returns 0
2024-08-07T20:01:41.3534620Z ok 2 - Testing outside bind mounts
2024-08-07T20:01:41.3535067Z 
2024-08-07T20:01:41.3556596Z # passed all 2 test(s)

Was later aborted due to the first failing? 2024-08-07T20:01:46.0410841Z ##[error]The operation was canceled.

jaromil commented 1 week ago

I just gave the tests a rerun and is now passing, perhaps some hiccup.

I think this is an excellent PR! and has priority over others to be merged.

I will also look into raising your privileges so that you can trigger reruns of the CI tests.

Again many thanks Narrat, feels a bit like we are working side by side, still at different time and places 😃✌🏽

Narrat commented 1 week ago

Thank you very much for the kind words :) I'm glad, that I can give something back. And indeed it does feel like that. IMO how OSS development should be ideally :D