Security


I don’t actually go on site to visit customers as much as 10 years ago, but do work out of the house still relatively regularly. My laptops all have Bitlocker or LUKS encryption each with a unique passphrase, so physical laptop loss would be a financial issue, not a data issue, but the laptops are joined to a domain with multiple users, and I want to REALLY lock down who can get on them once they’re booted, especially when connected into the lab network via VPN, so I install libpam-u2f and add an additional layer of protection to the logon process by requiring my Yubikey to be plugged in to complete authentication.

The old method of doing this required libpam-yubico, which is deprecated, and defaulted to only online checks of the Yubikey. U2F works both online and offline, which is super important for a laptop, and Yubikey’s full documentation for this on Ubuntu at https://support.yubico.com/s/article/Ubuntu-Linux-login-guide-U2F is very good.

The problem in my case is two-fold: first that I have privileged access management solutions in place – the root account is managed by BeyondTrust Password Safe. Logging in with that user, or having the password manager test its password will fail, because that account can’t tap the Yubikey. So we have to add an extra layer of configuration for the PAM/PIM management solution, in the form of pam_succeed_if.so. The second problem becomes clear once you’re installed – I want U2F to be *2nd* factor.

Once libpam-u2f is installed, a file is created by the package at /usr/share/pam-configs/pam-u2f – this is the “pam-auth-update” rule file that controls your PAM configuration in /etc/pam.d/. The Yubikey documentation mentions editing individual files in /etc/pam.d directly to finish the configuration, but the holistic Ubuntu answer is to work with these rules files. The default looks like:
Name: FIDO2/U2F authentication using pam-u2f
Default: no
Priority: 384
Auth-Type: Primary
Auth:
       [success=end default=ignore]    pam_u2f.so      cue
Auth-Initial:
       [success=end default=ignore]    pam_u2f.so      cue

My goal here is that the password-manager-protected accounts like root (and other directory accounts that are managed by the vault, since my systems are AD-joined) will NOT have to be Yubikey authenticated, but any account where the human knows the password WILL require MFA. The vault requires MFA to get into it, so effectively, all vault managed accounts are MFA protected. It is setting those passwords to 50+ character CSPRNG-created passwords, so I’m not worried about stuffing or brute force attacks.

Because that /usr/share/pam-configs/pam-u2f file is package-owned, if we edit it, we’ll get overwritten later. Also, in this case we don’t want the success=end because that will jump past pam_lsass.so (or pam_sss.so if we’re using SSSD for the directory connection) and pam_unix.so, making the U2F a single factor, not a second. So instead we create a new /usr/share/pam-configs/u2f-vault file with this content:
Name: FIDO2/U2F second factor (exempt: pbps-protected)
Default: no
Priority: 384
Auth-Type: Additional
Auth:
[success=1 default=ignore] pam_succeed_if.so user ingroup pbps-protected quiet
required pam_u2f.so cue

and then we can run pam-auth-update to choose our auth modules, as shown in this screenshot:

You can also run via the CLI: sudo pam-auth-update --enable u2f-vault to add the new module in the correct location, but for a manual change like this the first time, I like to review the options in the curses interface first.

The resulting authentication looks like…
rob-laptop login: rob
Password:
Please touch the FIDO authenticator.
Welcome to Ubuntu 24.04.5 LTS (GNU/Linux 6.17.0-1033-oem x86_64)

* Documentation:  https://help.ubuntu.com
* Management:     https://landscape.canonical.com
* Support:        https://ubuntu.com/pro

Expanded Security Maintenance for Applications is enabled.

5 updates can be applied immediately.
2 of these updates are standard security updates.
To see these additional updates run: apt list --upgradable

New release '26.04.1 LTS' available.
Run 'do-release-upgrade' to upgrade to it.

09:25 rob@rob-laptop:~$

And it works in the GUI – you type your password, and once that’s successful, you’ll get a message “Please touch the FIDO authenticator” and the logon screen waits for that 2nd auth before continuing.

Signing RPMs is supposed to be easy:

gpg --list-keys
cat > ~/.rpmmacros < <EOL
%_topdir /home/rob/rpmbuild
%debug_package %{nil}
%_signature gpg
%_gpg_name Rob A <me@totalnetsolutions.net>
%{__gpg} \
gpg --digest-algo=sha1 --batch --no-verbose --no-armor \
--force-v3-sigs --passphrase-fd 3 --no-secmem-warning -u "%{_gpg_name}" \
-sbo %{__signature_filename} %{__plaintext_filename}
EOL
rpm --resign

But there are a lot of caveats:

  1. If you run this on RHEL or CentOS or Scientific Linux 6.x and have an RSA, rather than a DSA, GPG key, any older systems (5.x or 4.x) won’t be able to properly decode the signatures. If you have a DSA key (and only v6+), the --force-v3-sigs is enough.
  2. If you run this on RHEL or CentOS 5.x, you need to remove the “–force-v3-sigs” option from the .rpmmacros line
  3. http://technosorcery.net/blog/2010/10/10/pitfalls-with-rpm-and-gpg/ is a bit wrong – RSA keys don’t always work, DSA do (there’s apparently a RHN KB article about this, if you have support and licenses to read it. I don’t right now).
  4. RHEL / CentOS / Scientific Linux 7 won’t accept (without warning) RPMs signed with weak keys (or weak digests, in some cases, like sha1)

So, based on the systems you’re trying to build your package for, ensure the signing key you’re using and the digest algorithm you’re using, are supported across all the versions you expect to support… or build multiple RPMs, and put them in separate repos for each OS version.

We ran into this bit of fun while setting up a NIS domain for testing in the lab today:
rob@rob-kubuntu3:~$ ypcat -d nisdom -h rhel5-64-2 passwd.byname
No such map passwd.byname. Reason: No such map in server's domain

It turns out this was a problem with the /var/yp/securenets file, but I’m still not sure what is wrong. The man page for ypserv shows:

A sample securenets file might look like this:

# allow connections from local host — necessary
host 127.0.0.1
# same as 255.255.255.255 127.0.0.1
#
# allow connections from any host
# on the 131.234.223.0 network
255.255.255.0 131.234.223.0

So we set up our securenets to look like this:

host 127.0.0.1
255.255.255.0 10.10.10.0

And tried to connect to the server:
rob@rob-kubuntu3:~$ ip addr show dev wlan0 |grep "inet "
inet 10.10.10.210/24 brd 10.10.10.255 scope global wlan0
rob@rob-kubuntu3:~$ ypcat -d nisdom -h rhel5-64-2 passwd.byname
No such map passwd.byname. Reason: No such map in server's domain
rob@rob-kubuntu3:~$ ping -c1 rhel5-64-2
PING rhel5-64-2 (10.10.10.213) 56(84) bytes of data.
64 bytes from rhel5-64-2 (10.10.10.213): icmp_req=1 ttl=64 time=0.823 ms

--- rhel5-64-2 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.823/0.823/0.823/0.000 ms

Removing the /var/yp/securenets file allowed us access, so it wasn’t firewall or rpc or portmap issues, to the best I can determine. Adding “host 10.10.10.210” also worked and allowed the client access. So what’s wrong with the format / man page?

Upgrading software – always required to keep things secure. Windows, WordPress, Mac OSx, Linux, Office, Firefox, etc. So I just finished upgrading TotalNetSolutions.net again. Hopefully I’ll be able to be better about this, now that WordPress does the automatic upgrades now.

I’ve been doing the automatic upgrades on one of my other sites since they came out. They’re easy, fast, and even more painless than the 3-step upgrade that works so well. So now, I should be able to keep TNS much further away from the “cobbler’s kids” syndrome so many small company’s systems suffer with.

As of today:

“Akismet has caught 347 spam for you since you first installed it.”

That’s since 11/29/2007. Akismet has YET to miscategorize a comment as spam, and it has missed a single spam comment. All I had to do was click “this is spam” and it’s cleaned up.

The only other anti-spam product I’ve seen to perform this well is the IronPort mail system at a client. 130,000 or so attempts / day, 1 spam / day in the entire company queue, and no users complaining about spam in 5 months.

Akismet, Ironport, my hat is off to you both.

Next Page »