vendredi 7 octobre 2016

Home network SMTP MUA setup

MUA - mail user agent - setup for home

As an alternative to my (non-working) attempts from 2008, I now use an MTA setup and talk directly to the SMTP server outside my home network in order to send emails.  This includes posting to Flickr, using their email upload facility.  Here's the setup about SMTP only, the Flickr stuff would be for a followup article.  This setup is based on mutt formatting the outgoing emails then talking to msmtp in order to actually send them.

Mail User Agent

Don't sweat it.  Install mutt.  It's perfect for scripting, attaching files, specifying addresses and so on.

sudo apt update
sudo apt upgrade
sudo apt install mutt

Configure mutt to use msmtp

Edit ~/.muttrc:
set sendmail="/usr/bin/msmtp"
set from=your@email.com
set realname = "Luc Moreau"
set use_from = "yes"
set envelope_from = "yes"

SMTP Gateway

Install msmtp

sudo apt install msmtp

Configure msmtp

Edit ~/.msmtprc, for example sending to gmail:
 # Google account
account    gmail
host    smtp.gmail.com
port    587
from    someaddress@gmail.com
user    someuser
password somepassword
The address above should be an email address.  The user/password are whatever google requires to login to that account interactively.  "someuser" might be the same as "someaddress".

vendredi 24 juin 2016

The great home network

Again, some changes

[Provider router]
  • wi-fi
  • eth1 - free
  • eth0 - blue cable downlink to switch BR604
  •  [Switch B4R 604]
    • Downlink towards permanently connected Desktop computer
    • Daisy Chain to Alcatel Speedtouch 510v4
      • Setup as Bridged, will be used as a dumb hub/switch
      • Disabled DHCP
      • Disabled DNS
      • Downlinks towards 3 unused RJ45 cables in two bedrooms and TV room
    • Daisy Chain to Wifi AP Dlink towards the back of the house
      • DHCP disabled
      • DNS Disabled? 
      • Wifi enabled WPA2
      • Downlink to backup server in same room
      • Downlink to Wifi AP Sitecom towards the garden
        • Sitecom Wifi AP
          • Fixed IP 192.168.3.1
          • DHCP enabled, range restricted 3.100...3.200
          •  No further RJ45 downlinks
Equipment removed: Dlink DI614+ due to no support for WPA2 and couldn't get it to work anymore.  Kept the power adapter and Wifi antenna.

mercredi 15 juin 2016

Switching backuppc from SMB to rsyncd on Windows

SMB performance was poor so I figured I'd try the rsyncd method like I do on linux clients.  That turned out to be a little bit hairy so here are some notes;
  • This is based on https://doc.ubuntu-fr.org/backuppc#sauvegarder_des_postes_windows_via_rsyncd
  • Installed cygwin-rsyncd from Sourceforge
  • Tweaked rsyncd.conf to allow access to the cDrive module from my backup host only and for the backuppc user only.  Also calling this module "Users" and pointing it to C:\Users
  • Added backuppc to rsyncd.secrets
  • Took some time to find out how to stop/start the rsyncserver service (cmd must be started as administrator for this to work)
  • Open port 873 with a new rule in Windows Firewall (or any other FW software running).
  • Tweaked my client configuration in backuppc using the GUI (use rsync, point to the correct module, etc...)
  • Now a full backup is running.  If that works I know I'll probably still need to tweak the include/exclude stuff

lundi 13 juin 2016

New backuppc host - using SMB


  • Created new local Windows user for backuppc (admin, set a password)
  • Add the new host to backuppc server using the web GUI
  • Share c:\users on Windows level.  Authorize only backuppc (full control)
  • Test with smbclient from the backup server: 
    • /usr/bin/smbclient \\\\run12\\Users -Ubackuppc  -E -d 1 -c tarmode\ full -Tc -
  • Changed some global XFER options (name of SMB share=Users)
  • Changed permissions on Windows level to give Administrators "full control" on the share.  That seems to cure the NT_STATUS_ACCESS_DENIED errors on all kinds of directories.


New laptop

Today I bought a new (used) laptop -- Dell Latitude E6220 with 6GB RAM, 500GB HD, Windows 7 Pro 64bits, Core i-5 2520M @ 2.50 GHz and I can't see an SSD in there.
Installed Windows Security Essentials, Windows Live ID.
The plan is to split the disk and install Xubuntu in dualboot anytime soon.

The laptop itself is pretty nice, small 12" screen WXGA resolution, the battery humps on the back but should hopefully support the faster-than-average-for-its-era CPU.  The graphics are basic Intel HD 3000 or something.  Ports for HDMI, USB (2.0 only), eSATA, VGA, SD, eID and ExpressCard.  So far so good.  No SCSI, RS-232 or parallel port though? That's how I know it's recent enough for me :-)

Next step: Configure Backuppc for this.

lundi 18 avril 2016

New backup host pc-lili

  1. Add the new host using the web GUI
  2. On the new host:
    1. sudo apt-get install openssh-server
  3. On base (backuppc server) :
    1. sudo apt-get update
    2. sudo apt-get upgrad
    3. sudo -iu backuppc
    4. cd /etc/backupp
    5. sudo cp -p existinghost.pl newhost.pl
    6. ssh-copy-id luc@newhost
    7. ssh luc@newhost
    8. (confirm key ID)
    9. login should proceed without a password request
  4. On the new host
    1. sudo -i
    2. cat ~luc/.ssh/authorized_keys >> ~root/.ssh/authorized_keys
    3. chmod 750 ~root/.ssh/authorized_keys
  5. On the backuppc server:
    1. sudo -u backuppc ssh -l root newhost
    2. (confirm key ID)
    3. login should proceed without a password request
  6. Login to the web GUI and check the new host config (select rsync as the XFER method for example)
  7. Start full backup using the web GUI

mardi 9 février 2016

Bummer - libparm-gnome-keyring was missing

Finally found out that lubuntu doesn't install the required libpam-gnome-keyring package in order for Darktable (and others) to remember passwords for the online export services like Picasa/Google Flickr etc...
What a relief now...

vendredi 22 janvier 2016

Ooops involving backuppc

Tonight I wanted to remove postfix as I only need msmtp for sending email.  However this also accidentally removed the dependent package backuppc, including all configuration :-| as I had used "apt-get purge".

So I reinstalled backuppc (it also reinstalled postfix) and after setting up the htpasswd file then the localhost.pl file in /etc/backuppc (including the change to run tar under sudo) I was able to restore the previous /etc/backuppc/[hosts,*.pl] using backuppc itself.

I had to use "service backuppc restart" after rebooting kid2 as a test client before an incremental backup started OK.  Otherwise this looks fine.  No logs or backups seem to have been lost in the adventure.  This program is indeed more robust and foolproof than what I had thought.

I then restarted a full backup on f****-pc (I had previously given control to the backuppc user on this host to the user directory that needed backup).

If apache were also purged, the following is required on a blank Ubuntu/Apache2 install:
/etc/apache2/envvars:  run as backuppc as this is a dedicated apache2
/etc/apache2/sites-enabled/000-default.conf:    #ServerName www.example.com
/etc/apache2/mods-enabled$ sudo ln -s ../mods-available/cgi.load

mardi 12 janvier 2016

Hardware Refresh, next steps

Hardware Refresh, next steps

kid2 recovery

kid2 didn't want to boot anymore (black screen) so I fiddled a little bit with HDD cabling until I could get into the BIOS setup.  The case still has 2GB PC2-6400 RAM (2x512Mb unbranded + 1x1GB Kingston with cooler).  One DIMM slot is still free so maybe I could add some more RAM in there.  This is a Gigabyte motherboard and I should still have the manual lying around somewhere.

After the fiddling, I tried booting the Vista partition (doesn't work, I knew that already) then the Vista recovery partition (did work but I cancelled the recovery as I want to backup data from the Windows partition first).

So I booted Xubuntu and did a local backup of the /windows/Users using tar --exclude .*<lots of unwanted stuff>.  The backup is too big for my biggest SD card so I need to put the PC back on the network somehow in order to transfer this.

kid3 backups

The full backup didn't complete last night due to /windows not being mounted.  The Linux partition was backed up though.  This results in a Partial full backup in backuppc.  Not good enough (even though there is currently no data on the Windows side).  I configured the NTFS partitions and permanently mounted the main one (that contains /windows/Users) then rescheduled the full backup for the next night.

kid3 Windows setup

I booted  Vista and logged in as the ACER (administrator) account with the password I had setup on the first boot.  Configured the network, refreshed Windows Defender, created 5 non-administrator accounts for the family (no passwords at this point).  My intention is to restore the Windows data from kid2 here before cleaning up kid2 and restoring Vista on kid2 (which likely will destroy that data).  I know I, for one, still have data on there and some family members have used kid2 in the past too, maybe under Vista.

kid3 Lubuntu setup

Did fiddle a little bit with a PCmanfm "action" or "custom command" so that the Upload2Flickr right-click will not start multiple instances when uploading several photos in one go.  This only involved using %F instead of %f but the fun part was to find where this *.desktop file was.
I urgently needed to work on *.chopro files and my scripts weren't working right anymore (some because of missing dependencies but then still some other problems including the need to recompile that old "chord" program.  I still had the necessary source package but I finally found out that a newer version had been developed and released as GPL and seems to be freshy maintained (under the name Chordii or chordii) so I just installed that from the repositories and tweaked my chordview script a little bit accordingly.  That worked fine.  I installed Libreoffice too to handle the lyrics output and found out that the recode latin1-utf8 seems to be useless now so I removed the call to recode.
Finally I had very little time left to test photo editing but I managed to edit and export 10 photos with a pretty good experience under Darktable 2.0.  The Lighttable is pretty fast when changing collections and scrolling (probably thanks to the additional RAM + the new cache in DT 2.0).  Exporting is still slowish but that's when it's OK to take a break from the editing so no problem.

lundi 11 janvier 2016

Hardware Refresh

Bought a new hardware as I was more and more pissed off by the slow kid2 when doing photo editing/retouching and stuff.  Too little RAM is my diagnostic, the processor doesn't seem to be the cause (except when heavy stuff is going on like exporting from Darktable).
So I bought a very cheap tower ready to go: ACER Aspire 3641-500Mb HDD-4Gb RAM-5.1 Soundcard-Graphics with Digital and Analog outputs-some room for growth (not RAM unfortunately, 4Gb seems to be the max).

Installed Lubuntu 15.10 yesterday.  Notes to self:
  • use makeusb not usb-creator to create the boot SD (at least with 15.10).  Others are buggy and won't boot
  • don't think you'll need the 32bit image when your CPU is Intel.  You still want the AMD64 architecture unless the PC is really old and has less than 2Gb RAM.
  • don't use the "reinstall" menu in the lubuntu installer.  It just doesn't work and fails silently, then requests you to reboot on an incompletely installed OS
  • buy a Wifi dongle if you don't have a cat5 cable available at some convenient place (I did the install/upgrade with the tower on the floor and the monitor and keyboad on a chair).  Action point taken, I ordered a cheap one from China today.
  • the PC came with a working Vista partition (+ recovery partition I think) + a "VIDEOS" empty NTFS partition.  I left the Vista Home Edition Premium on the HDD and another NTFS partition for data.  I then created a Logical partition and added the Linux Root and Swap inside that.  This is a 500Gb disk partitioned approximatively like this (from memory, probably incomplete as the total is not right).
    • ? Windows Recovery/Reset partition
    • 213 NTFS Windows Vista boot
    • 108 NTFS Data
    • 108 Linux root
    • 4 Linux Swap
  • Installed Darktable directly from the ppa in order to get 2.0 not the 1.6 from the distro
  • Added the new host (kid3) to backuppc host list -- will need to tweak that configuration to make it work too.  And add some ssh configuration too I guess.
My plan is to vgexport/vgimport the large SATA disk from kid2 (and come  back to a smaller /home disk on kid2).  Once working fine on kid3 I'll see if I can restore the Windows stuff on kid2 to make it a backup/alternate office PC maybe.

Backuppc new backup client on kid3

  1. Add the new host (kid3) using the web GUI
  2. On kid3 (the new host):
    1. sudo apt-get install openssh-server
  3. On base (backuppc server) :
    1. sudo apt-get update
    2. sudo apt-get upgrade
    3. cd /etc/backuppc
    4. sudo cp -p kid2.pl kid3.pl
    5. sudo ssh-copy-id luc@kid3
    6. ssh luc@kid3 
    7. (confirm key ID)
  4. On kid3 (the new host):
    1. cat ~luc/.ssh/authorized_keys >> ~root/.ssh/authorized_keys
    2. chmod 750 ~root/.ssh/authorized_keys
  5. On base (backuppc server) :
    1. sudo ssh luc@kid3 
    2. (confirm key ID)
  6.  Start full backup using the web GUI