Nice :)
It's a great learning experience doing this stuff.
cryptsetup and initramfs had gotten really friendly. I only find it a slight issue when distros rip out the initramfs generation hook scripts on things like Raspbian but that's easily fixed.
Yes you can, but since you are concerned about performance overheads I suggest you run your own bench marking before doing anything. Just use a USB drive and create a LUKS partition and bench it with something like:
The conv makes a difference, so read up on it. I like fdatasync as that is the most close to real life and I'm not bothered about edge cases.
Then recreate the same drive as a LUKS/LVM and rerun the test. That will give you an idea if all the work you are about to do is worth it or not.
The trick is to use chroot as you will need to regenerate your initramfs with the new /etc/crypttab and /etc/fstab settings.
It will also involve copying off your data since you want to get rid of LVM, so the actual work involved it will be more simple to back up your data and reinstall.
But if you did want to mangle your box and get rid of LVM the rough steps would be to do:
Backup / and home to an external device (make sure it can support your file permissions, so fat and ntfs off the cards, best stick to what ever you are already using). For example if you mounted your backup device to /mnt you would do:
rsync -axv / /mnt
rsync -axv /home /mnt/home
Note: I'm lasy so I can't be bothered with excludes and use the -x flag to stop other devices (such as dev, sys, proc, etc) being synced.
The above example merges / and /home together for you.
Boot up to a live disk and mount the LUKS part with something like (sdXY as an example):
cryptsetup luksOpen /dev/sdX sdXY_crypt
At this point if you type lvdisplay it will show all your existing LVM logical volumes, but we are going to blow them away...So make sure your back up is good!!!!!!
You might need to install cryptsetup into the live environment (can't remember for arch tbh).
You should see that the above command has created a device mapper entry of:
/dev/mapper/sdXY_crypt
You will also see all the LVM devices here (depends on the live disk you are using, some you need to poke LVM to get it to populate)
Blow away your previous data with the following, using ext4 as an example (only do this if you are sure):
mkfs.ext4 /dev/mapper/sdXY_crypt
Mount the newly formatted LUKS part and your backup and rsync the backed up data to it.
Now here is where it gets interesting. Lets say that your LUKS partition is mounted to /mnt and your boot device is /dev/sda1
mount /dev/sda1 /mnt/boot
mount -o bind /dev /mnt/dev
mount -o bind /sys /mnt/sys
mount -t proc proc /mnt/proc
Now chroot to it:
chroot /mnt /bin/bash
Now you can update your fstab to mount the plain old LUKS partition as root.
You will need to comment out the two mount points for / and /home which should be pointing at the old logical volumes.
Add in the mount point for the new root. Just copy the existing / line and replace the first bit with /dev/mapper/sdX_crypt, for example it might look like:
You shouldn't need to change /etc/crypttab since you are reusing your existing crypted device, but check it anyway. It should contain:
###Example for SSD
sdXY_crypt UUID=xxx-xxxx-xxxx none luks,discard
###Example for Normal HDD
sdXY_crypt UUID=xxx-xxxx-xxxx none luks
###Example for "what you are trusting your devices to the whims of rando name assignment???"
sdXY_crypt /dev/sdXY none luks,discard
Needless to say the first column of crypttab has to match the last bit of the first column of fstab.
Now regenerate your initramfs with:
update-initramfs -u -k all
You should get NO errors! After it has successfully run exit the chroot, umount everything and reboot and fingers crossed it should ask you for your password and then mount your new root device.
Well if you are going to move back to Windows I recommend hanging back until they release the mega patch to fix all the issues in 2004. A lot of my friends have dropped Windows and moved to Linux for gaming due to the 2004 update (well on top of every other major update breaking something....). It just took one of us to take the leap and the rest of us followed quite quickly.
I have to say that first time Windows to Linux users seem to be a bit like first time vegans. They can't stop going on about it :p
I'm actually in the process of migrating my gaming rig right now. Funny story LM20 took maybe 1/10 the time to fully install and to a point that I'm typing this on my gaming rig in a sandboxed account then it did to install the 2004 update xD
Also my steam library drive just seems to work, but I'm going to copy it over to a luks ext4 drive as I don't like the ntfs overhead.
Discovery, automation and all that stuff should just be tools to make our lives easier.
When people design things to replace us it becomes an issue.
A good sign of a system designed to replace us is something that does things for us in a black box because it assumes we are too stupid to understand otherwise.
Somewhat outside of the box in regards to your request, but one thing you could do is convert it to virtual machine (P2V).
That way you can move it around easily and make multiple copies of it (well depends on how much data you have...).
You would keep your laptop and desktop really simple and clean with just the virtualisation software on on (I like KVM, but VirtualBox is good and free too).
Keep the complexity on the VM which can easily be backed up, and you can take snapshots before doing anything dodgy.
Just a tip, for doing CUDA and other stuff like that. Don't manually move bins as its a pain in the butt to remember for future updates/maint. Instead symlink them, or use your environment path variables.
Remember that the paths closest to the left are used before those on the right so you can have multiple versions of something, for example if you have ~/bin/foo and that will be used before /bin/foo (for a default PATH)
This is especially useful to know for CUDA or any resource where there are multiple versions. You don't want to get into the situation of needing to install/uninstall different versions for different projects (especially on multi-user environments).
I recommend install all the different versions required and using modules to set the required environment.
Run anything that touches the internet, or that you are not too sure of as separate "sandboxed" users.
This example is for the user called username and runs Firefox as a different sandboxed user (username_web). I've tested it for MATE, but I can't see why it won't work for anything with .Xauthority...
Allow your user to edit and do stuff to the sandbox user's home directory. You may need to run this again in the future if something moves a file into the home directory as facl's only inherit on create. I personally using inotify (via incrontab) to monitor a "download" directory and do a clamscan, set rights etc.
The file command is a utility native to most Linux installs. So if you have WP running on a Linux box, you should be able run the command file <blah> from a shell (or terminal).
It just lets you check what the file actually is. You can change the extension of the file, but most well programmed applications will ignore what's in the file name and check the "electronic file extension".
So the things to check are:
Make sure that the files is actually a swf file and not something else that has its extension changed.
Sometimes if a file type has different versions (see the above example is version 9), the mime type might not be correctly setup. For MediaWiki I had to add the extension to the correct section in the mime.types file. This might be a red herring as they are different applications.
Are you uploading it to allow people to download it, or to include it into a page?
EDIT
There seems to be plugins that allow you to upload unsafe file types. If you check out this post:
Car-speakers-590x90.swf: Macromedia Flash data (compressed), version 9
\EDIT
I haven't encountered this problem with WP before, but had something similar with MediaWiki. It was yonks ago so I might be mis-remembering, but I think I had to edit the mime.types file to get it working.
With mutt one of my fave functions is bulk selecting by date using T and then moving it to a folder.
The T function allows you to bulk tag stuff then you can do stuff to the tagged stuff. You can delete, move it, etc based on your preferred workflow.
So how you normally use it is:
T
in the search box you might want to search for all the *beep* from twitter so search for:
info@twitter.com
Then press semi colon (;), followed by the command you want to run. So if you want to delete all the tagged messages press d.
Also you can move all the stuff you tagged by pressing semi colon (;) followed by s, then press ? to bring up the folder selector and you can move messages to a folder.
So to search by date, after pressing T if you enter in the following for messages older than 90 days:
~d >90d
Change 90 to what ever days you want. Also you can change this to weeks, months, years or even a date format.
Then I move that to an archive folder.
So my full workflow is to:
Delete stuff I don't want
Archive stuff I want to keep for records into separate folders
Archive my main inbox into a yearly inbox archive folder (I only keep 90 days there). I have a dumping folders called ./Archive/YYYY/Inbox ./Sent and so on.
Also I delete stuff older than a certain amount of days in the separate folders. This is different based on the folder. For example for monitoring alerts I don't keep more than 90 days.
Finally you can have some of those archive folders on non SSD storage. For example if you rarely use them. Of course I would recommend ensuring that the storage be it USB HDD, SD card, etc is encrypted!
Not updating is one of the biggest problems with any application.
Any updates to the code introduces a chance for error which is why testing in a PPE is a must.
Now consider that a lot of updates are to mitigate security vulnerabilities and attackers are getting better at it (be it access tools, the sheer number of them, or just experience). This creates a vicious cycle of updates being applied to try to keep ahead of them, but with each update other issues might be introduced as well. Also you have to factor in all the new (or old) vulnerabilities that come to light.
Keep in mind that the more fancy (aka functions) that an application is, the more chances of things going wrong. But even if you were using a basic web server serving out text files, you would still need to update the underlying application and OS which could also cause problems...
Nice :) It's a great learning experience doing this stuff. cryptsetup and initramfs had gotten really friendly. I only find it a slight issue when distros rip out the initramfs generation hook scripts on things like Raspbian but that's easily fixed.
Yes you can, but since you are concerned about performance overheads I suggest you run your own bench marking before doing anything. Just use a USB drive and create a LUKS partition and bench it with something like:
dd bs=1M count=1024 if=/dev/zero of=/path/to/test conv=fdatasyncThe conv makes a difference, so read up on it. I like fdatasync as that is the most close to real life and I'm not bothered about edge cases.
Then recreate the same drive as a LUKS/LVM and rerun the test. That will give you an idea if all the work you are about to do is worth it or not.
The trick is to use chroot as you will need to regenerate your initramfs with the new /etc/crypttab and /etc/fstab settings.
It will also involve copying off your data since you want to get rid of LVM, so the actual work involved it will be more simple to back up your data and reinstall.
But if you did want to mangle your box and get rid of LVM the rough steps would be to do:
rsync -axv / /mntrsync -axv /home /mnt/homeNote: I'm lasy so I can't be bothered with excludes and use the -x flag to stop other devices (such as dev, sys, proc, etc) being synced.
The above example merges / and /home together for you.
cryptsetup luksOpen /dev/sdX sdXY_cryptAt this point if you type lvdisplay it will show all your existing LVM logical volumes, but we are going to blow them away... So make sure your back up is good!!!!!!
You might need to install cryptsetup into the live environment (can't remember for arch tbh).
You should see that the above command has created a device mapper entry of:
/dev/mapper/sdXY_cryptYou will also see all the LVM devices here (depends on the live disk you are using, some you need to poke LVM to get it to populate)
mkfs.ext4 /dev/mapper/sdXY_cryptMount the newly formatted LUKS part and your backup and rsync the backed up data to it.
Now here is where it gets interesting. Lets say that your LUKS partition is mounted to /mnt and your boot device is /dev/sda1
mount /dev/sda1 /mnt/bootmount -o bind /dev /mnt/devmount -o bind /sys /mnt/sysmount -t proc proc /mnt/procNow chroot to it:
chroot /mnt /bin/bashYou will need to comment out the two mount points for / and /home which should be pointing at the old logical volumes.
Add in the mount point for the new root. Just copy the existing / line and replace the first bit with /dev/mapper/sdX_crypt, for example it might look like:
/dev/mapper/sdXY_crypt / ext4 errors=remount-ro 0 1You shouldn't need to change /etc/crypttab since you are reusing your existing crypted device, but check it anyway. It should contain:
###Example for SSD
sdXY_crypt UUID=xxx-xxxx-xxxx none luks,discard###Example for Normal HDD
sdXY_crypt UUID=xxx-xxxx-xxxx none luks###Example for "what you are trusting your devices to the whims of rando name assignment???"
sdXY_crypt /dev/sdXY none luks,discardNeedless to say the first column of crypttab has to match the last bit of the first column of fstab.
update-initramfs -u -k allYou should get NO errors! After it has successfully run exit the chroot, umount everything and reboot and fingers crossed it should ask you for your password and then mount your new root device.
Well if you are going to move back to Windows I recommend hanging back until they release the mega patch to fix all the issues in 2004. A lot of my friends have dropped Windows and moved to Linux for gaming due to the 2004 update (well on top of every other major update breaking something....). It just took one of us to take the leap and the rest of us followed quite quickly.
I have to say that first time Windows to Linux users seem to be a bit like first time vegans. They can't stop going on about it :p
I'm actually in the process of migrating my gaming rig right now. Funny story LM20 took maybe 1/10 the time to fully install and to a point that I'm typing this on my gaming rig in a sandboxed account then it did to install the 2004 update xD
Also my steam library drive just seems to work, but I'm going to copy it over to a luks ext4 drive as I don't like the ntfs overhead.
Discovery, automation and all that stuff should just be tools to make our lives easier.
When people design things to replace us it becomes an issue.
A good sign of a system designed to replace us is something that does things for us in a black box because it assumes we are too stupid to understand otherwise.
Somewhat outside of the box in regards to your request, but one thing you could do is convert it to virtual machine (P2V).
That way you can move it around easily and make multiple copies of it (well depends on how much data you have...).
You would keep your laptop and desktop really simple and clean with just the virtualisation software on on (I like KVM, but VirtualBox is good and free too).
Keep the complexity on the VM which can easily be backed up, and you can take snapshots before doing anything dodgy.
Best advice ever.
@OP - You always want to VM your test/dev environments because you want to be able to try stuff without the fear of it breaking your main box.
Also so nice to roll back to a working snapshot.
Don't be afraid to break stuff as breaking things means you know what breaks and can avoid it when it counts!
Is it a laptop or a ten keyless keyboard? If so check the status of the numlock
Just a tip, for doing CUDA and other stuff like that. Don't manually move bins as its a pain in the butt to remember for future updates/maint. Instead symlink them, or use your environment path variables.
Remember that the paths closest to the left are used before those on the right so you can have multiple versions of something, for example if you have ~/bin/foo and that will be used before /bin/foo (for a default PATH)
This is especially useful to know for CUDA or any resource where there are multiple versions. You don't want to get into the situation of needing to install/uninstall different versions for different projects (especially on multi-user environments).
I recommend install all the different versions required and using modules to set the required environment.
Run anything that touches the internet, or that you are not too sure of as separate "sandboxed" users.
This example is for the user called username and runs Firefox as a different sandboxed user (username_web). I've tested it for MATE, but I can't see why it won't work for anything with .Xauthority...
I based it off the following article:
http://www.la-samhna.de/library/firefox.html
Create your sandbox user with a free UID/GID (I always do my username with _function, so have username_web, username_notes, username_email etc):
sudo groupadd --gid 1012 username_websudo useradd -m --uid 1012 --gid 1012 -c "Sandbox - Web" username_web
Allow the sandbox user to enter your home directory and read your .Xauthority (I haven't seen the need to allow it to update it...):
sudo setfacl -m u:username_web:x /home/usernamesudo setfacl -m u:username_web:r /home/username/.Xauthority
Allow your user to edit and do stuff to the sandbox user's home directory. You may need to run this again in the future if something moves a file into the home directory as facl's only inherit on create. I personally using inotify (via incrontab) to monitor a "download" directory and do a clamscan, set rights etc.
sudo setfacl -R -m m:rwX /home/username_web/sudo setfacl -Rd -m m:rwX /home/username_web/sudo setfacl -R -m u:username:rwX /home/username_websudo setfacl -Rd -m u:username:rwX /home/username_websudo setfacl -Rd -m u:username_web:rwX /home/username_websudo setfacl -R -m u:username_web:rwX /home/username_web
Create a script to run Firefox as the sandboxed user:
sudo su -mkdir /usr/local/scriptsvi /usr/local/scripts/run-firefox.sh
Which contains:
#!/bin/bash
HOST=$(hostname)XAUTH=$(xauth -f "/home/${SUDO_USER}/.Xauthority" list | grep ${HOST} | tail -n 1)
su - ${SUDO_USER}_web -c "export DISPLAY=:0; xauth add ${XAUTH}; firefox"
Make it executable:
chmod +x /usr/local/scripts/run-firefox.sh
Allow your user to run the script as root (I just have all various sandbox scripts comma separated here):
sudo visudo -f /etc/sudoers.d/sandbox
Which contains:
username ALL = NOPASSWD: /usr/local/scripts/run-firefox.sh
Then as your normal user you can run Firefox with:
sudo /usr/local/scripts/run-firefox.shWhoops sorry to cause confusion.
The file command is a utility native to most Linux installs. So if you have WP running on a Linux box, you should be able run the command file <blah> from a shell (or terminal).
It just lets you check what the file actually is. You can change the extension of the file, but most well programmed applications will ignore what's in the file name and check the "electronic file extension".
So the things to check are:
Are you uploading it to allow people to download it, or to include it into a page?
EDIT
There seems to be plugins that allow you to upload unsafe file types. If you check out this post:
https://www.interserver.net/tips/kb/fix-wordpress-error-sorry-file-type-not-permitted-security-reasons/
/EDIT
It might also be the electionic file type which might not actually be a SWF file. You can check on a nix box with:
file <file to check>
EDIT (added example)
So I downloaded an example swf file from:
https://blog.bannersnack.com/2-sample-swfs-available-for-download/
Then the result shows:
Car-speakers-590x90.swf: Macromedia Flash data (compressed), version 9\EDIT
I haven't encountered this problem with WP before, but had something similar with MediaWiki. It was yonks ago so I might be mis-remembering, but I think I had to edit the mime.types file to get it working.
With mutt one of my fave functions is bulk selecting by date using
Tand then moving it to a folder.The
Tfunction allows you to bulk tag stuff then you can do stuff to the tagged stuff. You can delete, move it, etc based on your preferred workflow.So how you normally use it is:
Tin the search box you might want to search for all the *beep* from twitter so search for:
info@twitter.comThen press semi colon (
;), followed by the command you want to run. So if you want to delete all the tagged messages pressd.Also you can move all the stuff you tagged by pressing semi colon (
;) followed bys, then press?to bring up the folder selector and you can move messages to a folder.So to search by date, after pressing
Tif you enter in the following for messages older than 90 days:~d >90dChange 90 to what ever days you want. Also you can change this to weeks, months, years or even a date format.
Then I move that to an archive folder.
So my full workflow is to:
Finally you can have some of those archive folders on non SSD storage. For example if you rarely use them. Of course I would recommend ensuring that the storage be it USB HDD, SD card, etc is encrypted!
Not updating is one of the biggest problems with any application.
Any updates to the code introduces a chance for error which is why testing in a PPE is a must.
Now consider that a lot of updates are to mitigate security vulnerabilities and attackers are getting better at it (be it access tools, the sheer number of them, or just experience). This creates a vicious cycle of updates being applied to try to keep ahead of them, but with each update other issues might be introduced as well. Also you have to factor in all the new (or old) vulnerabilities that come to light.
Keep in mind that the more fancy (aka functions) that an application is, the more chances of things going wrong. But even if you were using a basic web server serving out text files, you would still need to update the underlying application and OS which could also cause problems...
End of this list.
Back to top