Wednesday 7 April 2021

Linux CentOS 7 PHP mail() function SMTP Settings

Had some changes in email setup and security levels. Since setting up OAuth2.0 is a little tricky decided to set up a separate Gmail account for sending mail from this server. 

Took my an hour to figure out how this was set up on this machine so this time decided to write it down here.

The PHP script uses "mail($email_address,$subject,$body, $header)", on our system this meant that means it uses the Linux mail binary. The SMTP settings for this are located here: /etc/mail/authinfo/casmtp-auth

I changed the one line in this file with this syntax:

AuthInfo: "U:root" "I:email@address.com" "P:password"

That was not all, next was:

makemap -r hash smtp-auth.db < smtp-auth

Then:

systemctl restart sendmail

Thursday 1 April 2021

Fixing MacOS Time Machine Restore

Had a Macbook Pro 2014 model acting up and finally no longer booting. Booting the Mac in recovery mode but could not even run any first aid on the SSD. Took out the SSD and put it in an external thunderbolt enclosure, same problem.

Ordered a new SSD and installed it in the machine. Tried to recover the machine using Time Machine backups that were kept on a local Qnap NAS. Whatever I tried I could net see any backups. I could see the server and was asked for username/password to access the backups. When pressing ok I simply returned to the first screen, no error nothing, but also no backups.

After many hours of messing around and trying stuff with the server and with other Macs I noticed something. Two Macs, both 10.15 Catalina created a directory (sparsebundle) on the Qnap with: "<machinename>.backupbundle". I had a Mac Mini with MacOS 11 Big Sur and in all the testing had this starting to make backups to the same Qnap. Here I noticed that this created a directory called  "<machinename>.sparsebundle". I noticed that the file-setup and directory structure inside both directories looked the same.

Then I did a new test by connecting the Macbook Pro in Recovery Mode to the Qnap again, and since now in the meantime the Mac Mini was creating a backup there (with the .sparsebundle name) This suddenly showed up as an option to recover from. 

After spending so much time debugging this problem I accessed the Qnap via SSH and simply renamed MacBookPro.backupbundle to MacBookPro.sparsebundle and now this was also available as a restore point! 


TL;DR: If you can't see any Time Machine backups on a NAS try renaming the directory from X.backupbundle to X.sparsebundle. But use with caution and make sure to have a backup of your backup first!!