CIRCL / Circlean

USB key cleaner
https://www.circl.lu/projects/CIRCLean/
BSD 3-Clause "New" or "Revised" License
447 stars 70 forks source link

Formating files instead of sanitizing them #13

Closed NathanLeullieux closed 7 years ago

NathanLeullieux commented 9 years ago

Hi, I'm a very begginer in Unix environment, so please be tolerant :) I've set up Circlean for a normal use and it work well. But now I would like to change the scripts of it to make it format the untrusted key, instead of sanitizing them, so I could have 2 Raspberries, the first to clean the untrusted key, et the second to format it completly. But as I said earlier, I'm a begginer (and learning by myself) so I do not know which scripts to modify... Thanks in advance for you answers.

Rafiot commented 9 years ago

Hi,

I would do it in /opt/groomer/groomer.sh, in the loop on each partitions: https://github.com/CIRCL/Circlean/blob/master/fs/opt/groomer/groomer.sh#L75

Simply remove the whole content of the loop and replace it by /sbin/mkfs.ntfs ${partition} or /sbin/mkfs.fat ${partition}. This will format the source key.

To format the destination key, you will have to remove this whole block: https://github.com/CIRCL/Circlean/blob/master/fs/opt/groomer/groomer.sh#L53 and run /sbin/mkfs.ntfs ${DEV_DST} or /sbin/mkfs.fat ${DEV_DST} instead.

But you will have two problems:

  1. the script runs as an unprivileged user (unable to format a partition), so the fastest way to fix it will be to remove su ${USERNAME} -c there: https://github.com/CIRCL/Circlean/blob/master/fs/opt/groomer/init.sh#L27
  2. if you plug only one key, you will have to edit https://github.com/CIRCL/Circlean/blob/master/fs/etc/rc.local#L25 or the script will not run at all (and the rPi will shutdown immediately)

I'm not sure I cover all the possible issues you may have, but it is a good start. Do not hesitate to ask more questions if needed.

I hope this helps.

NathanLeullieux commented 9 years ago

I'm working on it, I will tell you back if it works.

Thanks

NathanLeullieux commented 9 years ago

It didn't work, i'm trying to see what goes wrong. Tell me if you have more information on what may be the problem.

Thanks.

Rafiot commented 9 years ago

Well, if you tell me what is not working, I can most probably help. I don't know what can possibly go wrong :/

NathanLeullieux commented 9 years ago

You're right, First, I deleted the block you told me, so, in groomer.sh after "if" line 79 to line 105, and replaced it by /sbin/mkfs.ntfs ${partition} I deleted the block from line 53 to 70 too. in init.sh i deleted : su ${USERNAME} -c And in rc.local i deleted : if [ -e /dev/sda ]; then

I think i'm not doing it right, but i don't know where... Thanks again

Rafiot commented 9 years ago

Would it be possible to connect a screen to the raspberry Pi? This way, you would see the output and what happens because right now, I have no idea.

Do not hesitate to fork the project and put your code there, so I can have a look directly.

NathanLeullieux commented 9 years ago

I do not have any HDMI screen around me... But I have forked the project. Thanks.

dputtick commented 7 years ago

@NathanLeullieux closing this issue, but please comment here or open a new issue if you have more questions about CIRCLean. :)