Backup daily WordPress Drupal Script

If you use Drupal or WordPress and you have a virtual Server with SSH Login you should set up a daily Backup Script to have a Snapshot of your Blogs if Hackers insert SQL Code Injections or hack PHP Sites. Cause you cant NEVER know every EXPLOIT of every used Plugin (here less plugins is more!)

Of course you can daily or hourly RESTORE AUTOMATIC by CRON your Blogs by OVERWRITE bad inserted STUFF!

Howto?

  • Article comming soon !!  .. sorry have current not enough time..

 

or read my Wiki for MYSQL and WordPress Help!

  • Daily or hourly restored Stuff makes it useless to hack your blog!
  • Mount /tmp and /var/tmp ALWAYS with option NOEXEC!!
  • disable user access to : find,wget,curl,fetch or other commands with chmod 000 (noexec)
  • at php.ini disable upload if not needed cause you use SCP to upload Files/Images
  • on Apache2 install mod_security2 to blog SQL Injections, Remark: Not all code is known by the plugin!

PDF/A: Setup Linux CUPS to Print Archive PDF/A

If you have a Office and you have to archive Documents and Prints over Years you should have heard that there is a special PDF Type called PDF/A which is set as default Archiving PDF File Type for decades.

Air Cooled Archive Raid Harddrives Low Noise Passive Cooled
Air Cooled Archive Raid Harddrives with Acoustic Decoupling (Zero Dollar) Solution

To use it you can use the Linux Print Server called CUPS to translate all digital Prints to PDF/A. This free Software Printer is known on all Linux Releases, and he can listen on USB and Network Interfaces on Documents. Also you can use Network Printers/Scanners like the Brother MFC-Series to Scan Documents and later to print them virtual as PDF/A (PDP Archive File)

The way the file is going on a Office:

Office PC -> Openoffice Writer-> Print to Cups->Linux OS -> Network -> Linux Office Server -> Linux OS -> CUPS -> CUPS Converter to PDF/A (Postscript Driver)-> Output Directory (perhaps Windows, FTP, Cloud Share)

Manual Cups Ubuntu

PDF/A Basics

Manual Windows Share Setup

Manual Cloud Share Setup

Manual FTPs Server Setup

Remark:

  • On the Data Share you can put single „Text“ (.txt) files for words like „holiday.txt, 2017.txt“ into different folders to describe the Documents and Media.
  • This offers a Timeless Search Solution, on Linux/Unix Console with the DEFAULT TOOLS like find, grep, cat or locate. Cause Text will be readable the next Decades!
  • Think easier is more helpful..
  • If you need no File Access Restrictions try to prevent the usage of modern CMS or databased Solutions!
  • Use Technics which are independent from the Operating Systems

..happy Archiving..

 

Ubuntu: Release Change

If you use Ubuntu on your Systems, you perhaps read last weeks about a new Release Version.

I am often asked, must i upgrade now?

My answere at first is not really, cause the new Versions are not cleaned up by all bugs and the User or Admin must recheck against the new advantages of the new Releases for production usage. I prefer to wait 3 Month after a Release by Ubuntu is published. But if you setup a very new Hardware your are often forced to take the LAST Release Version, cause it supports newest Hardware Chips by the latest Kernel (for example Laptop mixed Chips Wifi/Bluetooth/USB3.0).

Remark: You should read the „release notes“ of the Versions, cause this can prevent you from running into trouble or „black screens“.  DONT forget to Backup the old OS if you try to start the Upgrade. Fresh Setup’s are often smaller and more free of Bugs as „upgraded Systems“! Cause sometimes the old Configs are not all updated or replaced! (User-Homes). New Releases can allocate MORE Disk Space and offer new Call Home Sniffing Tools, RECHECK open Ports, running Processes and Privacy Settings!

On Companies you must always setup a „Lab PC“ for Testing the new Releases before rolling out the OS.

Print this Release Timeline out to be updated daily..

ubuntu releases timeline
ubuntu releases timeline

Amazon: Cloud Drive Sharing with NFS on Local Network as Photo Uploader Backup

Current the acd_cli tool for amazon drive mount offers no „fsid“ (device /dev) point, that you cant export and share the amazon drive at your home local network.

On the latest raspberry pi OS (jessie) you can use a small workaround to get a NFS Shared Amazon Cloud Backup Uploader (needs python3.4 !)

  • install acd_cli tools, create the auth file (read) and  run $ sudo acd_cli mount /amazoncloud
  • now create a second Folder /sendtoamazon
  • install nfs-kernel-Server and share this Folder with NFS exports to your LAN
  • on the raspberrypi you can use a cron „move“ Job running every 10 Minutes:
    #crontab -e
    */10 * * * * mv /sendtoamazon/* /amazoncloud
    

If you now put files on the /sendtoamazon nfs share from a PC,  the raspberry pi will grab and push it into the cloud via the „acd_cli mount“ a python3 script, remark 10 minutes is ok for small files! on bigger files use over „40“ minutes between pushes. If acd_cli fails check for correct python version! and last python modules!!! (python3-appdirs python3-dateutil python3-requests python3-sqlalchemy python3-pip pip3)

If you have a SMALL BANDWITH for upload you can use „rsync -avz“ instead mv (move) with „throttle“ option to upload files slowly!!

Links:

Howto acd_cli for amazon mount on git

Openwrt : Openwrt 15.XX loses settings if the ROM Root Filesystem is full

On openwrt 15.XX i have seen if you installed additional Sofware via opkg and the /overlay path is nearby full you can’t save any settings via Luci Webinterface (blue Info box right upper corner) or the Router reboots hard automatic into failsave mode (lost all settings / factory reset)

Workaround:

  • You can install a external usb stick on most routers and move the „/overlay“ folder to it
  • You should always Download the „backup-settings.tgz“ from Software Menu to get the Router easy  and fast online again on last working state.
  • If the rootfs (root filesystem and overlay path) is nearby full, YOU CANT remove installed packages by „opkg“ packet manager, cause the ROM is readonly! For this reset the router and restore easy from „backup-settings.tgz“.
  • If the external USB Drive loses connect to the Router (Power failure) and you use Samba as NAS Server the /overlay path can run full too!! and the Router can crash and reset too!! This shows openwrt should NEVER be used for secure routing jobs AND NAS Operations ! Cause it can you lock out!

Result: openwrt is a nice opensource router os which allows you to control and active monitor your internet connections with realtime graphs (WebUI+Console) and blocking rules. It should always be used behind a black boxed ISP router of your provider to get a private area!

Ubuntu: Create USB Live System Stick for Live Mode or Emergency Help

For all Users, especially Newbies its VERY helpful to have a Rescue System on a USB Stick if a Major Update/Release Change fails or break the System. To this the Ubuntu-ON-RAM Live System is very useful at public shared PCs for Online Banking etc., cause after every reboot all old Firefox Data are safe deleted!!

How to create this VERY helpful Tool Stick for free?
All you need is the latest Ubuntu-ISO file (AMD64-15.04 – 64bit) a new 4/8GB USB Stick (take a good Brand! to get a high quality tool).

Howto:

  • Burn the ISO to DVD/CD (NON-Linux-PC)
  • Boot your PC on this DVD/CD
  • Plugin the USB Stick
  • Open a Gnome-Terminal
  • Change to root/admin User enter $ sudo -s
  • To cleanup the NEW Stick enter $ dd if=/dev/zero of=/dev/sdb bs=1M count=10
  • Create new Partition Type Primary set to Format „FAT32“ with Partition Tool „Gparted“ do $ gparted /dev/sdb
  • Exit gparted
  • Re-Plugin the Stick
  • On the Gnome-Terminal enter  to umount the auto mounted Stick by Filemanager „Nautilus“ $ umount /dev/sdb1
  • Open Firefox download latest Ubuntu-ISO to this Live System (Downloads)
  • Run now the Start-Disk-Creator and create the Emergency Stick with „SELECTED NON PERMANENT FILESYSTEM“!!! (last Option) select the Stick and the ISO-File
  • After this Process ends, exit and reboot the PC on the USB stick for TESTING!
  • Language for the KEYBOARD can be set on „EN“ beside the CLOCK, touch with right Mouse Button to view the menu, select last point to add you Language!

You got:

  • Very secure USB System for Internet Access and Emergency Help to recover or Backup YOUR DATA!
  • Live Linux-On-RAM System with Firefox on Live Mode WITHOUT saving History or Trash!!
  • If used on a Travel Laptop a very secure System for Traveling cause you can REMOVE the Harddrive!!
  • With this always working OS you can test your Hardware, fix Errors, find out why the installed System freezes, do full backups (mirroring to usb disk)
gparted-usb-stick
gparted-usb-stick

 

startdisk-creator
startdisk-creator

Ubuntu: Recover Data from old Luks Encrypted HDD to new HDD

If you prefer to use encrypted Devices you ran into a problem if you try to move, migrate or recover the files from the old luks protected home. As normal User you should know that luks is used with LVM2 Logicial Volume Manager, which manages the partitions „named based“. Major Info! Ubuntu prename the volume group with the Setup-DVD all time to the same VG_NAME called „ubuntu-vg“!!!

vg name volume group

So what do you need to migrate or recover?

  • Download the ubuntu DVD and burn it to a disc
  • Insert the new HDD to the Sata1 Port
  • Plugin the ubuntu DVD for Setup and boot the PC on DVD to „Live Mode“
  • Do not run a standard SETUP by pressing the Setup Link on the Desktop, select LVM+Crypted, and go on Setup, on end reboot.
  • Now the PC boots on the first HDD, if the new OS Setup is ok, shutdown to insert the old HDD on Sata2 Port.
  • Boot the PC on the DVD again to have a „LIVE MODE“ (readonly OS) again.
  • Now open a Gnome Terminal and enter „$sudo cryptsetup luksopen /dev/sdb3 crypt“ and enter the passoword to unlock the old HDD
  • Here you enter $vgdisplay to read out the UUID of the old „vg-Volumegroup! Name is same like on the new HDD!! Thats the problem!
  • Copy the UUID with the mouse and do a „$sudo vgrename oldUUID NEWVGNAME“ this forces the OS to set a other VG_NAME, by default named as „ubuntu–vg“. YOU CANT MOUNT and HANDLE two different „Volume-Groups“ with SAME VG_NAME!!!
  • Now you can run „$sudo vgscan –mknodes“ and then „$sudo vgchange -ay“ to activate all Volume Groups of all HDD’s
  • After that you will find the new mountpoint at /dev/mapper/… here you can do „$mount /dev/mapper/NEWVGNAME–vg-root /mnt“
  • do now backup your files from old to new HDD.. then reboot again to remove the old HDD..

Need more details? LVM Luks Handling Recovery Backup (external)

 

 

Backup your PC with Linux Full Disk Snapshot Free Tool with Diskdump

Today a User is forced to Update daily his System or change anything to try new Software.

But here mostly the Users run into very BAD PROBLEMS. I got often Calls that Users lose the control of the PC after Updates, Software Setups, Software Removal’s ..

For this Linux offers a default Backup Tool, called Diskdump („dd“ command) which is on every Setup/Recover CD and Installation.

Before any Changes do allways a Backup to USB Drives, Sticks or Second SATA Disk! This will save you TIME, Money, DATA and Nerves!

Backup :

Mount the Disk 2 on Path /mnt as „root/sudo“ user (must have free Space like Disk 1 better more!)

mount disk

then start Backup Disk 1 everything to Disk 2 as IMG Image, bs set the speed disk to disk 10MB/s is a secure value!

dd disk dump backup

Restore :

To Restore a damaged PC, plug your second Disk into the PC, boot from Setup CD, Press ALT-CTRL-F1 (or open Gnome-Terminal)

Mount the second Disk again on /mnt with „root/sudo“ User

mount disk

and start the restore with dd from Disk 2 – IMG – Imagefile to Disk 1, enjoy a long coffee break…

restore disk linux dd

After Command close without Errors or other Messages, reboot and go on working…

 

Remark: This is a Block to Block Backup and Restore, with Snapshots. These IMG Snapshots can be saved on Disks, moved over Network, burned to DVD or mounted like a DVD on other Linux Systems to access the Files for emergency!