Monday, November 13, 2017

SSMTP and Authenticated SMTP

Related to my previous post, this page has an excellent (and short) write up of how to deal with Comcast (or any other authenticated SMTP provider) email forwarding, using a smarthost.

As recommended, I installed ssmtp (and mailx) onto Raspbian with the following:
sudo apt-get install ssmtp sudo apt-get install bsd-mailx
I edited /etc/ssmtp/ssmtp.conf, to include the following settings:
# comcast
mailhub=smtp.comcast.net:587
UseSTARTTLS=YES
UseTLS=YES
AuthUser=<username>@comcast.net
AuthPass=<plaintext password>
rewritedomain=<fqdn>
FromLineOverride=YES
hostname=<hostname + fqdn>
This was a heck of a lot easier than the alternatives, using exim4, that are documented in other places.

Monday, November 6, 2017

Manual Testing of Mail with SMTP and TLS

If you're anything like me, you've used the telnet method to verify SMTP connectivity many times, over the years:

$ telnet smtp.mail.com
EHLO domain.com
MAIL FROM: alex@mydomain
RCPT TO: alex@someotherdomain
DATA
Subject: This is a test email
This is a test email.
.

In the modern era of TLS encrypted email connectivity, this no longer works.  However, there is a similar method, only requiring Perl or BASH, and OpenSSL.  Thanks to https://www.saotn.org/test-smtp-authentication-starttls/ for the details.

First, you need to create an authentication string that the remote mail server will accept.  With Perl, do this:

$ perl -MMIME::Base64 -e 'print encode_base64("\000username\@example.com\000password")'
AHVzZXJuYW1lQGV4YW1wbGUuY29tAHBhc3N3b3Jk

With BASH, do this:

$ echo -ne '\0username@example.com\0password' | base64
AHVzZXJuYW1lQGV4YW1wbGUuY29tAHBhc3N3b3Jk

Then, you can make your test connection to the mail server, using the handy "s_client" functionality of OpenSSL:

$ openssl s_client -connect smtp.gmail.com:587 -starttls smtp
CONNECTED(00000003)
<removed all the certificate junk>
---
250 SMTPUTF8
EHLO there
250-smtp.gmail.com at your service, [73.213.115.193]
250-SIZE 35882577
250-8BITMIME
250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-CHUNKING
250 SMTPUTF8
AUTH PLAIN AHVzZXJuYW1lQGV4YW1wbGUuY29tAHBhc3N3b3Jk235 2.7.0 Accepted

See, it really wasn't very hard, was it?

Thursday, September 14, 2017

Mounting Ubiquiti UniFi AC Access Points

I recently had my new house wired, so that I could install my long-serving Ubiquiti AC access points onto the ceiling, with no visible wiring.  I noticed, after I hired an electrician to install ceiling boxes, that Ubiquiti's rotary mount has 2 significant flaws:


  1. The holes provided for wall/ceiling mounting do not match either the US 2-3/4" or 3-1/2" ceiling box mounting holes.
  2. The rotary mounting plate has a release lever that is almost impossible to access, once it is mounted on the ceiling, as the level is almost flush with the bottom of the access point.
I created, based on the work of several other folks, a US ceiling mount adapter, with a 20mm relief height, and posted it on Thingiverse:


This is a simple part, created in OpenSCAD, but I am inordinately proud of it, as it is the first 3D printed part that I have created, without any outside assistance.

I'll probably talk more about 3D printing, in the future.  I recently acquired a used Prusa i3 Mk2 printer, and have been highly satisfied with it.

Tuesday, September 12, 2017

Scrolling and screen

I've been using screen for a heck of a long time now, and it has always bugged me that scrolling back through history isn't the easiest.  However, I just ran into a great little bit of termcap data that you can add to your .screenrc:

# Enable mouse scrolling and scroll bar history scrolling
termcapinfo xterm* ti@:te@

With that line added, you can use mouse scrolling, which makes my screening that much happier!

Tuesday, July 25, 2017

Fedora 26, High DPI Monitors, and nVidia Optimus

I spent most of yesterday attempting to upgrade my primary laptop, an MSI Stealth Pro GS63VR, from Fedora 25 to Fedora 26. This was my second attempt, as the first attempt ended in failure, due to my inability to get graphics working with any server beyond VESA/framebuffer mode.

First, I cleaned off the drive, and did a new initial installation of Fedora 26, and applied all updates. To get the installer to not freeze my laptop, I had to install in failback video mode. Once the laptop was installed and patched, I then proceeded to troubleshoot the issues that prevented me from getting either Nouveau or nVidia Xorg drivers working.  After quite a bit of trial and error, I determined that there are several main issues.  First, on Fedora 25, I had just ignored the Intel component of nVidia Optimus, and just installed the closed-source nVidia driver.  That seems to no longer be possible, on my hardware, with Fedora 26.  Second, there is an ACPI issue, with a number of laptops based on EFI versions of the AMI BIOS.  Third, the default for Bumblebee (the open source Optimus solution) is to disable kernel modesetting, but for me, this breaks EDID.

So, here is the solution that I came up with, to install Bumblebee:
  1. Set the default for systemd to multi-user instead of graphical
    1. # systemctl set-default multi-user.target 
  2. Update Fedora 26 to -current
    1. # dnf update
  3. Reboot
  4. Follow Bumblebee docs from https://fedoraproject.org/wiki/Bumblebee 
    1. Check laptop graphics hardware
      1. $ lspci | grep VGA
      2. 00:02.0 VGA compatible controller: Intel Corporation HD Graphics 530 (rev 06)
      3. 01:00.0 VGA compatible controller: NVIDIA Corporation GP106M [GeForce GTX 1060 Mobile] (rev ff)
    2. Add the main Bumblebee repo
      1. # dnf -y --nogpgcheck install http://install.linux.ncsu.edu/pub/yum/itecs/public/bumblebee/fedora$(rpm -E %fedora)/noarch/bumblebee-release-1.2-1.noarch.rpm
    3. Add the Bumblebee managed nVidia repo
      1. # dnf -y --nogpgcheck install http://install.linux.ncsu.edu/pub/yum/itecs/public/bumblebee-nonfree/fedora$(rpm -E %fedora)/noarch/bumblebee-nonfree-release-1.2-1.noarch.rpm
    4. Install the required Bumblebee packages (note that libglvnd-devel is needed, even though the docs don't mention it) 
      1. # dnf install bumblebee-nvidia bbswitch-dkms VirtualGL.x86_64 VirtualGL.i686 primus.x86_64 primus.i686 kernel-devel libglvnd-devel
    5. Reboot
After the system came up, I started Xorg with 'startx', and my laptop froze. After some sleuthing, I figured out that my laptop has an AMI BIOS, with a compatibility issue with bbswitch and Optimus, from the Troubleshooting section, in the Fedora Bumblebee docs:
https://fedoraproject.org/wiki/Bumblebee#Compatibility_with_recent_laptops_that_have_American_Megatrend_BIOSes

To fix this issue:
  1. Add "splash acpi_osi=! acpi_osi='Windows 2009'", after "quiet" to the /etc/sysconfig/grub GRUB_CMDLINE_LINUX entry
  2. Rebuild grub2 config
    1. # grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
After rebooting, I started Xorg successfully, but I noticed that my MSI GS63VR 4k was running Xorg @ 800x600, but 3D acceleration worked.

To fix the resolution problem:

  1. Remove "nomodeset", from the /etc/sysconfig/grub GRUB_CMDLINE_LINUX entry. I got the suggestion to remove "nomodeset" from https://forums.linuxmint.com/viewtopic.php?t=216235#p1131177
  2. Rebuild grub2 config
    1. # grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
  3. After this, everything worked in 4k, as espected, so I set the default target to graphical, again
    1. # systemctl set-default graphical.target
Comments and suggestions are welcome!