Category Archives: Computers

Everything that has to do with, guess what, computers. :-)

A deep-dive into UEFI Booting

[According to my own standards, this post about “UEFI booting” was only like 70% “ready” — I had it pending in “draft” state for many months, because I was lacking the time to finish it… I now decided to release it in its current state, simply because I believe it will still be very useful to many people interested in the topic…]

Before we actually dive deep into how UEFI booting works, a short and simple introduction is due.

Introduction

What is UEFI, anyway?

UEFI could be called the successor of the old BIOS concept. It is a unified version and successor of “EFI”, which was an architecture for a platform firmware used to boot operating systems (in the following abbreviated as “OS”), and the corresponding interface to interact with the firmware and the operating system.

The advantages of UEFI over the traditional BIOS are, among others, the following:

  • Boot disks with large partitions (over 2 TB), using GUID partitioning (GPT),
  • network capabilities already in pre-OS phase, and
  • modular design.

Boot Mechanism

So, how does booting with UEFI work?

When you enter your UEFI, you will find a user interface that shows all devices that have been detected, and that support booting. Usually that includes all your hard drives.

You can freely define a desired boot order (regardless of hardware paths, i.e. the way your drives are connected, be it via an SATA port, be it via an NVME slot), i. e. the primary OS that should be booted, if that fails the next OS that should be tried, etc. That’s called your “boot configuration”, and it resides in your motherboard’s NVRAM. (a concept that’s basically the successor of what used to be called “CMOS” in the old days of the BIOS). More specifically, we speak about “UEFI Variables“, which allow the OS and the firmware to interact.

When UEFI’s Firmware Boot Manager wants to boot an OS, it first needs to load something called the OS “Boot Manager.” Common OS boot managers are:

  • BOOTMGFW.EFI used to load Windows, or
  • SHIMX64.EFI used to load Linux

The OS boot manager is located on the “EFI system partition” (ESP). This is a small partition (usually only a few 100 M) at the start of your hard drive, formatted with basically a FAT filesystem. FAT is a very simple filesystem, so that the code to parse it and load files from it can be reasonably small and fit into a boot firmware.

A typical disk layout for a Windows installation may look as follows:

UEFI /EFI System Partition as seen under Windows

The first partition is the ESP, then comes the Windows boot and system drive (with a drive letter of C:), and then comes the recovery partition.

Apart from boot loaders, the ESP can contain kernel images or (device) drivers, e. g. to support hardware that must be initialized prior to the start of the OS, or to give access to a complex filesystem that holds the actual OS to be booted.

Depending on which OS you want to boot, the OS boot manager then loads

  • in the case of Linux: the OS kernel, and the kernel in turn loads the OS, or
  • in the case of Windows: the Windows Boot Loader (\Windows\system32\winload.efi)

Boot Configuration Details

Now that we got a good overview of the mechanism as a whole, let’s dive into the details. Let’s look at the boot configuration of my machine. To do so, invoke the below command (I did it under Ubuntu 23.04, but it should work the same under any reasonably current Linux distro where the tool is installed):

# efibootmgr -v
BootCurrent: 0003
Timeout: 1 seconds
BootOrder: 0000,0002,0003
Boot0000* Windows Boot Manager    HD(1,GPT,a39d5736-7aaf-4be0-b6b6-0852ba2f7803,0x800,0x32000)/File(\EFI\MICROSOFT\BOOT\BOOTMGFW.EFI)WINDOWS………x…B.C.D.O.B.J.E.C.T.=.{.9.d.e.a.8.6.2.c.-.5.c.d.d.-.4.e.7.0.-.a.c.c.1.-.f.3.2.b.3.4.4.d.4.7.9.5.}…R…………….
Boot0002* ubuntu    HD(1,GPT,280ea55d-c182-5242-bb52-a2b40812190c,0x800,0x219800)/File(\EFI\UBUNTU\SHIMX64.EFI)..BO
Boot0003* ubuntu    HD(1,GPT,91b56f9f-3526-404b-b681-1c684551ec4f,0x800,0xd87be)/File(\EFI\UBUNTU\SHIMX64.EFI)..BO

So, what does the above tell us? First, we see that “(Boot)0003” is the boot entry used to start the currently running system. Secondly, the order in which boot is tried is 0000, 0002, and then 0003. So by default, Windows (by the “Windows Boot Manager”) will be booted. Then we see the three boot entries. The star/asterisk (*) after the boot entry shows that all these entries are “active.”

What about the remaining info in the above command output? Immediately after the boot entry, we see the names that are also displayed on screen by the Firmware Boot Manager (“Windows Boot Manager” and two times “ubuntu”). We then see references to the ESPs used to boot these OS.

HD obviously means “hard drive”, then we see a 1 which refers to the first partition on the respective drive, then we see GPT which refers to the partitioning table format, and then we see a UUID. To find the respective partitions, we can use the below command:

# blkid --match-token TYPE=vfat
/dev/nvme0n1p1: LABEL="UBUNTU_TEMP" UUID="EC76-8E7F" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="280ea55d-c182-5242-bb52-a2b40812190c"
/dev/nvme1n1p1: SEC_TYPE="msdos" LABEL_FATBOOT="UBUNTU_MAIN" LABEL="UBUNTU_MAIN" UUID="8140-E4C0" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="EFI" PARTUUID="91b56f9f-3526-404b-b681-1c684551ec4f"
/dev/sda1: UUID="40AD-1127" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="a39d5736-7aaf-4be0-b6b6-0852ba2f7803"

The PARTUUID values in the above output match the UUIDs in the boot configuration as shown by efibootmgr. So, the ESPs are located by searching for the partitions’ UUIDs. That means that you can replug your drives to different ports, or even copy partitions to different drives, and the UEFI boot mechanism will still find them. That’s a nice and very stable design.

UEFI User Interface

Now, let’s enter the UEFI and look at some of the details there. My PC’s motherboard is an MSI, and to enter the UEFI I need to press “F2” after the beep when powering on the PC (from “off” state, not when suspended to RAM, i.e. “sleeping”!) or restarting it.

# lspci
[...]
21:00.0 Non-Volatile memory controller: Sandisk Corp WD Blue SN570 NVMe SSD 1TB
2b:00.0 Non-Volatile memory controller: Sandisk Corp WD Blue SN570 NVMe SSD 1TB

Wie man (physische) Netzwerkprobleme spielend leicht lokalisieren kann

Kürzlich habe ich endlich etwas “angepackt”, was ich schon seit einigen Jahren tun wollte: Ich habe das LAN in meinem Haus “logisch segmentiert” durch die Verwendung von VLANs, um unterschiedlichen Traffic auf jeweils einem einzigen Kabel transportieren zu können.

Wozu braucht man sowas? Ganz einfach, z. B. um ein Gästenetzwerk vernünftig implementieren zu können, wenn man mehr als nur einen WiFi-Access Point in seinem Netz hat. Anbieter wie Ubiquity haben sowas bestimmt so implementiert, dass auch technisch weniger bewanderte Personen es nutzen können, aber mir ist Ubiquiti einfach zu teuer in dem Ausmaß, in dem ich deren Hardware bräuchte. Außerdem macht es ja auch schlicht Spaß, sich sowas auf Open Source-Basis selbst zu bauen… 😉

Ich habe bei mir also auf OpenWrt-Basis ein (für ein Einfamilienhaus) relativ komplexes Netzwerk aufgebaut. Folgende Komponenten sind u. a. enthalten:

Jetzt hatte ich kürzlich ein Problem, an dem ich wirklich hart zu “knacken” hatte. Irgendwann kam ich zu dem Schluss, dass es nicht auf Layer 2 (Ethernet) oder höher (IP) liegen müsse, sondern eher auf Layer 1 (physikalische Ebene, also Verkabelung).

Ich habe mir also für sage und schreibe 10,99 EUR einen deleyCON Netzwerk-Kabeltester bestellt. Selbst für eine einmalige Anwendung (aber dabei bleibt’s ja nicht…) war mir der Preis akzeptabel.

Und siehe da, ich hatte tatsächlich ein Verkabelungsproblem in meinem Netzwerk. An einer Netzwerkdose war das Kabel nicht vernünftig aufgelegt.

Diesen Fehler hätte ich ohne den Kabeltester nicht gefunden. Der Tester ist wirklich auch von Personen, die keine ausgebildete Netzwerktechniker sind, sehr einfach zu nutzen. Signalgenerator ans eine Ende des Strangs hängen, “Abschluss-Stecker” ans andere, und schon werden die einzelnen Adern durchgetestet, und man kann durch LEDs sehen, wo der Fehler ist.

Ich kann dieses Gerät nur absolut weiterempfehlen. Für etwas mehr als einen Zehner kann man da nichts falsch machen…

Lasst mich gerne wissen, ob Ihr meine Meinung teilt, falls Ihr Euch auch dieses Gerät zulegen solltet…

How to manually rebuild your Windows BCD Store

I recently had a mishap where on a system that I had just upgraded from Windows 10 to Windows 11 the Windows BCD Store (Boot Configuration Data Store) was suddenly messed up, presumably by a patch update I had taken earlier:

Blue screen showing “Wiederherstellung: Der PC muss repariert werden.” (German for: “Recovery: The PC must be repaired.”), hinting to a problem with the Windows BCD Store.

Many people will recommend in that situation to boot to a Windows Recovery Environment (RE) and execute the following:

>bootrec /rebuildbcd

But what if the scan for all Windows installation turns out not to identify yours?! Like in the below photo?

Photo of a Windows RE session, failing to automatically rebuild the Windows BCD Store

Are you SOL then?

Don’t despair.

The solution is actually quite simple. Other than the above which is supposed to be fully automatic, it involves some manual tasks, but it should be quite easy if you are at least a bit tech-savvy.

Continue reading How to manually rebuild your Windows BCD Store

Mein Internet funktioniert nicht, was tun?!

Diesen Hilfeschrei hat bestimmt jeder schon oft gehört. Aber nur die wenigsten wissen, wie man heraus finden kann, wo genau das Problem liegt.

Ich versuche in diesem Blogpost einmal, eine auch für Laien verständliche bzw. leicht anwendbare Anleitung zu liefern, wie man bei Internetstörungen zu Hause dem Problem auf die Spur kommen kann…

Zunächst einmal ein paar (wenige) Grundlagen. Ohne diese geht es einfach nicht.

Egal, was Sie im Internet tun, alles passiert auf Basis sogenannter “IP-Pakete“. Jeglicher Datenverkehr wird “zerhackt” und in Form von kleinen “Häppchen”, eben dieser IP-Pakete übertragen. Alle Geräte, die am Internet teilnehmen, haben eine bestimmte Rolle. Ihr Handy, Laptop oder PC ist in der Regel ein sogenannter “Client“, also ein “Kunde”, die Dienste, die Sie in Anspruch nehmen, werden durch sogenannte “Server” (“Bediener”) erbracht. Wie findet nun Ihr Client den passenden Server? Das funktioniert über ein System namens “DNS“. Es übersetzt für den Menschen lesbare Adressen, wie z. B. “amazon.de“, in IP-Adressen, die Ihr Endgerät für die tatsächliche Kommunikation mit dem gewünschten Dienst benutzt.

Wie werden aber die IP-Pakete zwischen Ihrem Endgerät (Handy, Laptop, Tablet, PC) und den Servern im Internet übertragen? Zunächst muss Ihr Endgerät mit Ihrem eigenen lokalen Netzwerk (auch “LAN” genannt) bei sich zu Hause verbunden sein. Dies kann über WLAN (auch “WiFi” genannt) oder Netzwerkkabel (auch “Ethernet”-Kabel genannt) passieren. Von dort geht es über Ihren Router zu Ihrem Internetprovider, und dann von dort ins Internet. Welche physikalische Verbindungstechnik (Teilnehmeranschlussleitung) Sie zur Anbindung an Ihren Provider verwenden ist grundsätzlich egal: DSL, TV-Kabel, Glasfaser oder sogar Mobilfunk (z. B. über einen Vodafone GigaCube).

Continue reading Mein Internet funktioniert nicht, was tun?!

Netgear GS108Ev3 – Huge packet loss when pinging management IP

I have a quite complex infrastructure in my house, and I monitor everything.  Among others, I have SmokePing probes towards multiple destinations in my LAN, and also to my internet provider’s infrastructure, and even external hosts.

When I added a graph for the management IP of my Netgear GS108Ev3 8 Port Gigabit Ethernet Smart Managed Plus Switch, which is my “core” switch, I noticed that there is a huge packet loss, in the range of 4% average, about 40% max.

The strange thing is that other destinations in my LAN which can be reached via this switch, have absolutely zero packet loss. That means that the cabling itself is definitely ok, and also that the packet switching functionality of the switch is ok.

So I opened a ticket towards NetGear, and the response I got was quite surprising (but still somehow makes sense):

This is a known issue, and it is by design. The put the highest priority on the packets flowing thru the switch, while the management traffic has a lower priority, so that ICMP packets to the switch’s management IP may get lost, and in extreme cases the web UI may not be reachable at all.

It’s not a big issue for me, because in the end I wanted to create graphs that exhibit whether I have any internal packet loss. Whether the switch’s management interface has packet loss or not is not really important to me. As long as all my internal devices that I actively use, like my NAS devices or streaming boxes, are properly connected with no packet loss, all is well. 🙂

Das perfekte USB-C-Ladekabel zum Apple-Netzteil

Kürzlich habe ich ein neues MacBook Pro 13″ mit USB-C-Ladestecker erworben. Da ich das Netzteil nicht ständig zwischen Büro und Zuhause hin und her schleppen möchte, habe ich ein zusätzliches original Apple Netzteil bestellt. Zu meinem großen Ärger ist im Lieferumfang (bei einem Preis von immerhin 75 EUR!) nicht einmal das USB-C-Ladekabel enthalten… 🙁

Zugegeben, das war in der Angebotsbeschreibung so erläutert (wie ich dann hinterher feststellen musste), aber wer rechnet schon mit sowas und liest die Artikelbeschreibung für ein Netzteil bis ins letzte Detail durch???

Daher habe ich auf Amazon nach einem geeigneten 2 m USB-C-Kabel gesucht. Dabei bin ich auf dieses magnetische Kabel gestoßen, von dem ich total begeistert bin, so dass ich mittlerweile drei Stück davon besitze. 😉

Das tolle an dem Kabel ist die magnetische Kupplung, die ich schon bei den Magsafe-Netzteilen meiner vorigen MacBook Pros so geschätzt habe. Zieht man nämlich unabsichtlich am Kabel, z. B. weil jemand versehentlich in das Kabel hineintritt oder sich dort verheddert, so wird einfach die magnetische Kupplung des Kabels vom Laptop getrennt. Das Kabel reißt also nicht das teure Gerät vom Tisch oder Schoß herunter.

Continue reading Das perfekte USB-C-Ladekabel zum Apple-Netzteil

PayPal schränkt nach Disput Konto ein

Ich bin seit über 16 Jahren “Kunde” bei PayPal. Nach einem Disput mit PayPal selbst hat PayPal nun plötzlich meinen Account in einen “eingeschränkten Zustand” versetzt.

Als jemand, der beruflich im Bereich IT-Sicherheit unterwegs ist, liegt mir dieses Thema natürlich gerade auch bei einem Finanzdienstleister wie PayPal sehr am Herzen. Daher benutze ich seit Einführung bei PayPal einen “Sicherheitsschlüssel” (allgemein “Zwei-Faktor-Authentifizierung”, “two-factor authentication”, 2FA, TFA, MFA genannt) als zusätzliche Sicherung meines Accounts.  (Zu diesem Thema gibt es auch einige Artikel hier in meinem Blog!) Zunächst einen Hardware-Schlüssel in Form eines kleinen feuerzeuggroßen elektronischen Geräts, später dann einen Software-Schlüssel in Form einer Handy-App.

Im Laufe der vielen Jahre der Nutzung von PayPal habe ich entsprechend oft einen neuen Sicherheitsschlüssel im PayPal-Account registriert, da ich diese Schlüssel jeweils auf meinen beiden (Privat- u. Dienst-) Handys benutze, und diese jeweils alle zwei Jahre durch neue Geräte ersetzt werden, so dass ich auch eine neue Schlüssel-App installieren und registrieren muss.

Dieser Fall war nun wieder eingetreten, und überraschenderweise konnte ich nicht mehr einen neuen Schlüssel registrieren. Der PayPal-Support teilte mir zunächst mit, diese Software-Schlüssel würden in Deutschland nicht mehr unterstützt, daher könne man keine neuen Schlüssel registrieren.

Nach längerem Hinundher fand ich jedoch heraus (u. a. durch Unterstützung von Lesern meines eigenen Blogs und eigene Untersuchungen), dass mir PayPal offensichtlich (bewusst!) die Unwahrheit gesagt hatte. Die wahre Ursache ist ein Problem auf Seiten von PayPal, nämlich eine willkürliche Beschränkung auf zehn Sicherheitsschlüssel. Man kann diese Schlüssel deaktivieren, z. B. wenn sie defekt sind oder verloren gingen, aber man kann sie nicht aus dem Account “löschen”. Erreicht man dadurch das Limit von zehn Schlüsseln, so kann man keine neuen Schlüssel registrieren.

Daher bat ich den Support, dass dieser die alten, bereits von mir deaktivierten Schlüssel löschen möge. Dazu verlangte der Support, dass ich dort anrufen möge. Warum, das wurde mir auch auf ausdrückliche Nachfrage bis heute nicht erklärt. Insbesondere hat PayPal durch meinen Anruf keine größere Gewissheit, dass es sich tatsächlich um meine Person handelt. Ich teilte PayPal mit, dass ich nach 20 min. in der Warteschleife aufgegeben habe, und dass ich ohnehin aus Beweisgründen eine Korrespondenz per Nachricht innerhalb meines PayPal-Accounts bevorzuge.

Nun hat PayPal plötzlich meinen Account in einen eingeschränkten Zustand versetzt und verlangt von mir, dass ich ein Ausweisdokument hochlade sowie ein Dokument, welches meine aktuelle Adresse belegt. Ich lehne das Hochladen meines Personalausweises grundsätzlich ab wegen der drohenden Missbrauchsgefahr (siehe der aktuelle “Mariott”-Skandal, wo Daten von 500 Mio. Kunden gestohlen wurden, u. a. Ausweisnummern!). Außerdem ist es mir unverständlich, wieso PayPal nun plötzlich — fast sieben Jahre nach meinem letzten Umzug — meine Adresse verifiziert haben möchte. Bei Umzügen habe ich bisher immer einfach meine Adresse in meinem Account geändert, damit war der Fall erledigt.

Ich kann mich PayPal gegenüber nach wie vor durch Einloggen in meinen Account authentifizieren, da ich noch über ein Handy verfüge, welches dort registriert ist. PayPal kann also keine ernsthaften Zweifel an meiner Identität haben. Sehr negativ aus Sicherheitsgesichtspunkten ist die Tatsache, dass PayPal es erlaubt, den Sicherheitsschlüssel durch die Beantwortung von zwei Fragen (“Geburtsname meiner Mutter” und “Wohnort als “Kind) zu ersetzen. Es gibt eine Reihe von Personen außer mir selbst, die diese Fragen beantworten können. Die Sicherheit meines Accounts wird also stark geschwächt, und das Verfahren des Sicherheitsschlüssels ad absurdum geführt.

Das Verhalten von PayPal — immerhin eine “Bank”, da das Unternehmen meines Wissens über nach eine Bankenlizenz verfügt! — finde ich unglaublich, geradezu “nach Gutsherrenart”. Daher werde ich mich nun bei diversen Organisationen des Verbraucherschutzes und der Finanzaufsicht über PayPal beschweren.

ntp running in chroot stopped working after Debian Stretch upgrade

Today I upgraded my root server from Jessie to Stretch, and suddenly ntp stopped working.

I found errors like follows in the log, which were obviously due to failures in name resolution:

2018-05-31T07:44:48.900756+00:00 myhost ntpd[22855]: giving up resolving host 1.debian.pool.ntp.org: Servname not supported for ai_socktype (-8)

The solution to make this work was to bind-mount some files and directories essential for name resolution into the chroot jail.

First create some directories and some dummy files:

# mkdir /var/lib/ntp/etc /var/lib/ntp/lib /var/lib/ntp/proc
# mkdir /var/lib/ntp/usr /var/lib/ntp/usr/lib
# touch /var/lib/ntp/etc/resolv.conf /var/lib/ntp/etc/services

Then update your /etc/fstab as follows:

...
#ntpd chroot mounts
/etc/resolv.conf  /var/lib/ntp/etc/resolv.conf none bind 0 0
/etc/services	  /var/lib/ntp/etc/services none bind 0 0
/lib		  /var/lib/ntp/lib none bind 0 0
/usr/lib	  /var/lib/ntp/usr/lib none bind 0 0
/proc		  /var/lib/ntp/proc none bind 0 0

Finally mount all these binds:

# mount -a

Thanks to the ArchLinux guys where I found this.

To check whether your ntp is working again, you can use the following command which shows a list of peers known to your ntp server:

# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 0.debian.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.000
 1.debian.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.000
 2.debian.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.000
 3.debian.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.000
*ptbtime1.ptb.de .PTB.            1 u   46   64  377   11.483   -0.411   0.201
+ptbtime2.ptb.de .PTB.            1 u   52   64  377   11.502   -0.533   1.069
+ptbtime3.ptb.de .PTB.            1 u   47   64  377   11.451   -0.510   3.866
#batleth.sapient 131.188.3.221    2 u   44   64  377    0.188    1.097   0.176
#5.199.135.170 ( 130.149.17.21    2 u   45   64  377   11.271    0.581   0.396
-mail.morbitzer. 193.175.73.151   2 u   47   64  377    2.760    0.556   0.278
#hotel.zq1.de    161.62.157.173   3 u   46   64  377    0.094    1.384   0.261
-ntp2.m-online.n 212.18.1.106     2 u   47   64  377    7.167   -0.333   0.190
#2a03:b0c0:3:d0: 81.94.123.16     3 u   49   64  377    6.288   -2.071   1.760
#touka.thehomeof 130.149.17.21    2 u   48   64  377    0.206    0.932   0.222
+maggo.info      124.216.164.14   2 u   42   64  377    0.278   -0.137   0.436
+weyoun4.cord.de 124.216.164.14   2 u   44   64  377    2.849   -0.255   0.409
+opnsense.sauff. 222.217.153.8    2 u   43   64  377    0.270   -0.617   0.167
-web1.sys.ccs-ba 192.53.103.104   2 u   35   64  377    0.173   -1.251   0.220
#uruz.org        122.227.206.195  3 u   49   64  377    0.216    1.694   0.309
#clients5.arcani 162.23.41.55     2 u   38   64  377    6.120   -1.500   0.130
+stratum2-1.NTP. 129.70.130.71    2 u   47   64  377   14.043    1.625   0.394

The following command confirms that your current time is actually correct (within certain limits, of course):

# ntpstat
synchronised to NTP server (192.53.103.108) at stratum 2
   time correct to within 15 ms
   polling server every 64 s

If this was helpful, I would be happy to hear from you.

Exim malware scanner issue after upgrade from Jessie to Stretch

Today I finally upgraded by personal root server from Debian Jessie to Stretch, thereby upgrading Exim from 4.84 to 4.89.

After the upgrade, I observed the following errors in mainlog:

2018-05-31 08:02:03 +0000 1fOIX5-0001rg-AM malware acl condition: cmdline  : scanner returned error code: 36096
2018-05-31 08:02:03 +0000 1fOIX5-0001rg-AM H=([IPv6:2a00:6020:1efc:ee20:8857:7824:6a49:8368]) [2a00:6020:1efc:ee20:8857:7824:6a49:8368]:48523 I=[2a01:4f8:141:429::2]:465 Warning: ACL "warn" statement skipped: condition test deferred
2018-05-31 08:02:04 +0000 1fOIX5-0001rg-AM malware acl condition: cmdline  : scanner returned error code: 13
2018-05-31 08:02:04 +0000 1fOIX5-0001rg-AM H=([IPv6:2a00:6020:1efc:ee20:8857:7824:6a49:8368]) [2a00:6020:1efc:ee20:8857:7824:6a49:8368]:48523 I=[2a01:4f8:141:429::2]:465 Warning: ACL "warn" statement skipped: condition test deferred
2018-05-31 08:02:05 +0000 1fOIX5-0001rg-AM malware acl condition: cmdline  : scanner returned error code: 13
2018-05-31 08:02:05 +0000 1fOIX5-0001rg-AM H=([IPv6:2a00:6020:1efc:ee20:8857:7824:6a49:8368]) [2a00:6020:1efc:ee20:8857:7824:6a49:8368]:48523 I=[2a01:4f8:141:429::2]:465 Warning: ACL "warn" statement skipped: condition test deferred

Each of the three cmdline scanners caused an error, as shown above.

It seems there was a change in Exim from upstream, as reported by another user. Somehow it seems that if you define a cmdline scanner that uses a chain of commands, when there was an error return code encountered in the middle of the chain, the whole chain is considered failed.

To “fix” this issue (or rather work-around it), I changed the three ACL clauses as follows:

   warn  message                = This message contains malware ($malware_name)
         set acl_m0      = cmdline:\
-                               /usr/lib/AntiVir/guard/avscan -s --batch --scan-mode=all %s; /bin/echo -e \N"\navira_retval $?"\N:\
+                               /usr/local/bin/avscan_wrapper %s:\
                                \N^avira_retval 1$\N:\
                                \N^.*ALERT::[ \t]+([^;]*)[ \t]+;.*$\N
         malware                = *

I created a “wrapper” that effectively hides error return codes, and forces a return code of 0. The above wrapper looks like this:

#!/bin/bash

ARG="$1"

/usr/lib/AntiVir/guard/avscan -s --batch --scan-mode=all "${ARG}"
/bin/echo -e "\navira_retval $?"

exit 0

To make sure I didn’t break the malware scanning by my changes, I downloaded the EICAR test virus and sent it to myself. Exim caught the “virus” and ditched it.

Get certificates for “internal” hosts from Let’s Encrypt

I have a pretty large internal IT “landscape” in my house, and as an IT pro I want everything to be clean and “safe.” So even internally I’m using official SSL (or I should say “TLS”, as SSL 2.0 or 3.0 is deprecated since many years…) certificates for my router, WiFi access points, NAS devices, intranet server, etc., using host names in my own domain. I host this domain DNS-wise myself on a root server I rent from Hetzner.

Before the StartSSL disaster I got my certs from them. Afterwards I switched to WOSign, but now that they had their scandal as well, what to do?!

Well, Let’s Encrypt, a free public CA, is something I’m using anyway for my root server since they started operating. But to verify ownership of a domain name you had to run a web server on that respective host — something I can’t easily do for my internal hosts, as they have private IP addresses only, and their host names are not even publicly visible (they don’t have  a public A record, only one visible in my internal LAN). Even for my router’s externally visible host name I can’t easily use an HTTP-based challenge, as for security reasons I don’t want to operate a web server there.

By chance I came across the dns challenge that is now available in Let’s Encrypt’s certbot. This challenge works by deploying a TXT record that certbot requests to be under this domain name. Once you did this, you tell Let’s Encrypt to check, and if they find the TXT record this proves that you have authority over the domain.

Using it is quite straight forward:

# certbot certonly --manual -d hostname.internal.bergs.biz --preferred-challenges "dns"
[...]
Please deploy a DNS TXT record under the name
_acme-challenge.hostname.internal.bergs.biz with the following value:

YrAE-fmu-Zjsdhsjhd328723hjdhjcjHJJHJhds

Once this is deployed,
-------------------------------------------------------------------------------
Press Enter to Continue

A few seconds later I had successfully received my certificate.

So now I will write a script that will run periodically on my intranet server, and that will retrieve the then-current certificates for my internal hosts from my root server, and deploy them internally.