CentOS 8 End of Life: upgrade to CentOS Stream

CentOS 8 End of Life has been effective since January 31 2021, official mirrors do not provide any packages anymore. Here is how to upgrade to latest release of CentOS 8 and switch to Stream.

As always, prior to any system change, you should ensure you have a working recent backup.

Upgrade to latest CentOS 8

sed -i -e 's/mirrorlist/#mirrorlist/g' -e 's|#baseurl=http://mirror.centos.org|baseurl=https://vault.centos.org|g' /etc/yum.repos.d/*.repo

yum update

reboot

cat /etc/centos-release
CentOS Linux release 8.5.2111

Make sure everything is working as expected.

Switch to CentOS Stream

sed -i -e 's/mirrorlist/#mirrorlist/g' -e 's|#baseurl=http://mirror.centos.org|baseurl=https://vault.centos.org|g' /etc/yum.repos.d/*.repo

dnf install centos-release-stream

dnf swap centos-linux-repos centos-stream-repos

dnf distro-sync

reboot

cat /etc/centos-release
CentOS Stream release 8

Make sure everything is working as expected.

You’re done!

Posted in CentOS, Computer, Linux | Leave a comment

Elasticsearch in Docker: threat intelligence with filebeat

Goals:

  • collect observables from supported feeds
  • collect observables from unsupported feeds with elastic-tip
Continue reading
Posted in Computer, Docker, Linux, Networking, Security | Tagged , , , , , , , | Leave a comment

Elasticsearch in Docker: quick notes

Goals:

  • single node elasticsearch
  • single node kibana
  • password for all accounts
  • https between all components
  • behind traefik
  • future post: collect network logs (routers)
  • future post: collect application logs (web servers, dns servers, docker)
  • future post: collect application metrics
  • future post: correlate with threat intelligence
Continue reading
Posted in Computer, Docker, Linux, Networking | Tagged , , , , , , , | Leave a comment

Traefik reverse-proxy with ModSecurity

Traefik itself does not include WAF capabilities. If you want to add this capability, you can opt to replace Traefik with Apache httpd or nginx coupled with ModSecurity, however you loose the autoconfiguration of Traefik.

Fortunately, Alexis Couvreur has developed a ModSecurity plugin for Traefik to forward requests received by Traefik to another webserver (running ModSecurity) before actually forwarding the requests to the application server. If the ModSecurity webserver returns a code > 400, then Traefik will reject the request, otherwise it will forward it to the application server.

The suggested setup uses owasp/modsecurity-crs image for ModSecurity and since this can act as a reverse proxy, it uses the well known containous/whoami image as backend, since it is lightweight and always return a 200 status code.

The setup I decided to use is identical with the addition of SSL between the components, and multiple WAF containers depending on their intended use (paranoia level, detection only, different rules, etc.).

Continue reading
Posted in Computer, Docker, Linux | Tagged , , , , , , , , | Leave a comment

Backup gitea container

Gitea is great when you want a fast, light and yet user-friendly git repositories. Alternatives would be Gogs, Gitlab or even Github.

Gitea documentation tells you to use docker exec to perform a backup. However, this prevents you from using an additional volume to dump the backup into.

Instead, I prefer to use a similar command using docker run. Assuming the following:

  • the container network is called gitea_default, you only need this if you use an external database such as MySQL
  • the container is called gitea
  • the backup directory is in the current directory and named backups
docker run --rm -it --network gitea_default --volumes-from gitea --volume $(pwd)/backups:/backups --user git --workdir /backups --entrypoint '/app/gitea/gitea' gitea/gitea:1.15.10 dump -c /data/gitea/conf/app.ini

Posted in Computer, Linux | Tagged , , , , , | Leave a comment

Applying Audit Policies

If like me, you are trying to enable Audit Policies on Windows computers in a domain using Local Policies > Audit Policy, and it does not work, then you came to the right place.

Legacy Audit Policy: audit object access settings in Local Security Policy

The reason is: that is the legacy way to configure Audit Policies. Like Windows XP legacy.

You will find plenty of resources out there telling you this is because Advanced Audit Policy is enabled and you need to disable it by setting Local Policies > Security Options > Audit: Force audit policy subcategory settings to override audit policy category settings to Disabled to make it work. While it is true that disabling the Advanced Audit Policy will make it work, it will revert to the old, non-granular way of configuring Audit Policies.

You are now supposed to use Advanced Audit Policy Configuration. And by now, I mean since Vista.

Instead of setting Audit Object Access to Success and/or Failure, you can now granularly enable which object type you want to audit: file shares, file system, registry, …

In your GPO or Local Security Policy, scroll down at the bottom of the list and you will see a dedicated folder called Advanced Audit Policy Configuration with many categories, and in each of them, many settings you can now control independently.

Advanced Audit Policy: items in the Object Access category

Now if you apply it using gpupdate /force and you check it using auditpol /get /category:* , you should see a change in the individual items.

As a reminder, you can check which GPO is applying what setting using gpresult /h report.html . You need to be an Administrator to view the Computer configuration.

Posted in Computer, Microsoft | Tagged , , , , | Leave a comment

A Raspberry Pi, a UPS and a couple of ESXi servers walk into a bar

If you have the power of multiple servers connected to a UPS, you probably need to shut them down when the power goes down and before the UPS runs out of juice. Unless your UPS can be connected to the network, you usually can only connect a single device to it using good old serial or brand new USB. That single host now knows about the UPS status, but what about all the other systems? That’s when Network UPS Tools, aka NUT, comes into play.

NUT comes with a server and a client. You install the server on the device connected to the UPS using serial or USB (or even the network). You install the client on all the other devices.

We will install the server on the Raspberry Pi and the client on the ESXi servers.

Raspberry Pi

I will assume the connection is USB. On the raspberry pi, run the following as root:

apt-get install nut nut-client nut-server
nut-scanner -q -N -U > /etc/nut/ups.conf
echo "LISTEN 0.0.0.0 3493" > /etc/nut/upsd.conf
MONITOR nutdev1@localhost 1 master s3cr3tp4ssw0rd master

Write the following into /etc/nut/upsd.users:

[master]
    password = s3cr3tp4ssw0rd
    actions = SET
    instcmds = ALL
    upsmon master
 
[esxi]
    password = s3cr3tp4ssw0rd

Restart all services:

systemctl restart nut-driver
systemctl restart nut-server
systemctl restart nut-client
systemctl restart nut-monitor

ESXi hosts

Download the binaries from rene.margar.fr/2012/05/client-nut-pour-esxi-5-0/ and copy them to your ESXi host(s).

Configure the host to accept community packages: esxcli software acceptance set –level=CommunitySupported

Extract the file: tar -xzvf NutClient-ESXi-<version>.tar.gz

Install the package: ./upsmon-install.sh

Edit advanced system settings and set the following variables (at least):

  • /UserVars/NutUpsName : nutdev1@raspberrypi-ip-address
  • /UserVars/NutUser : esxi
  • /UserVars/NutPassword : s3cr3tp4ssw0rd

You also need to specify how long the ESXi host will wait before it shuts itself down with the following variable:

  • /UserVars/NutFinalDelay : 5 (default value)

If you want email alert, then configure the following variables as well:

Then, go to the services in the Web UI, edit the startup policy to “start and stop with the host” and start the service immediately.

Validate the setup

On the Raspberry Pi, use tcpdump to capture packets on port 3493, you should see your ESXi hosts talk with the NUT server asking for the UPS status, and the Raspberry Pi answering.

In addition, you should perform a real test by unplugging the power supply of the UPS and check that the ESXi hosts shut themselves down. You will probably want to tune the variable NutFinalDelay based on your UPS capacity and load.

Links

Posted in Computer, Linux, Networking | Tagged , , , , , | Leave a comment

Running a PKI using Smallstep certificates with Docker

Recently, I had to set up a new PKI. I was going to go with the good old OpenSSL but it’s 2021, there must be a more userfriendly and, more importantly, automated approach.

There are many open-source possibilities: EJBCA, cfssl, Hashicorp Vault, Smallstep Certificates. I chose to use Smallstep certificates because it has all the features I need and they are not behind a pay-wall:

  • lightweight: small Go binary, you can run it with a file-based database (similar to SQLite)
  • user friendly CLI: compared to openssl commands
  • ACME protocol: useful for Traefik reverse proxy
  • OIDC authentication
  • support: the guys are super friendly and available on their Discord channel
Continue reading
Posted in Computer, Linux, Uncategorized | Tagged , , , , | 4 Comments

Computer case: Antex NX800 mounting tips

If you plan to buy the Antec NX800 for your new build, you should be aware of a couple of things.

First, it is one of the cheap-ish cases that support a 280mm radiator at the top. This is the primary reason I bought this case.

Second, if you mount a radiator at the top, mount it last. Especially, mount it after you screwed the motherboard and plugged all cables (especially CPU power and fans). Accessing them with the radiator mounted will be difficult or even impossible.

Finally, while you can turn on/off the RGB LEDs on the fans with the push of a button, you cannot do the same with fan speed. Fans connected to the controller will run at max speed, and some may find it quite loud.

Apart from that, the case seems solid and will most likely survive many builds. Enjoy.

Posted in Computer, Hardware | Tagged , , , , , | Leave a comment

Tango Luxembourg using private IP addresses for Fiber internet access

When I moved in Luxembourg, I subscribed to Tango Luxembourg Fiber internet access. Back then, I got the usual dynamic public IP address “for free”. It was changing every 36 hours but at least it was a public one.

Recently, I changed my subscription to the 1 gigabit/s offer and soon after, I realized my VPNs and 6to4 tunnel was not working anymore.

After a brief troubleshooting session, I found out I was receiving a private IP address instead of the usual public 94.252.x.x .

A bit of googling later and I found out I was not the only one complaining about it:

Before I switched, I had read their service descriptions and I did not find any mention of it, in any document. Their offer page does not explicitly mention it, they even go as far as say:

No hidden conditions. Once you have chosen your connection speed, surf and download without limit.

Their service description however mentions that “dynamic public IP address” is optional, but you have to look for it.

Honestly, I have to say I am disappointed by such a poor customer service. I guess that is the world we live in now.

Anyway, new customers beware: if you want/need a public IP address, you will have to pay for it.

Posted in Computer, Luxembourg, Networking | Leave a comment