httpd: (98)Address already in use

After configuring an Apache server on a CentOS 7.5 server, I tried to start the service but I got this error in return:

systemd[1]: Starting The Apache HTTP Server...
httpd[47662]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:443
systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE

I was pretty sure that nothing was using port 443 but I did a quick check with netstat -tulpn

I double checked my config files, just to be sure that I wasn’t declaring Listen 443 twice:

# grep -ir listen
conf/httpd.conf:Listen 80
conf.d/ssl.conf:# When we also provide SSL we have to listen to the
conf.d/ssl.conf:Listen 443 https
conf.d/custom.conf:Listen 443

That’s it! I forgot to comment the directive in ssl.conf file (in this case). After this tiny fix I was able to start httpd without errors.

Adding a secondary IP address (CentOS, Fedora, RHEL)

You will not need a secondary NIC but you’ll create virtual adapters as the secondary IP will be routing through the primary.

Network configurations are stored in /etc/sysconfig/network-scripts

network-scripts$ ls -l | grep ifcfg
-rw-r--r--. 1 root root 304 Nov 11 19:04 ifcfg-eth0
-rw-r--r--. 1 root root 254 May 25 2017 ifcfg-lo

You have to name the virtual adapter in a sequential order, e.g., ifcfg-eth0:1, ifcfg-eth0:2 etc.

Copy the physical adapter configuration file:

cp ifcfg-eth0 ifcfg-eth0:1

and configure it to include these parameters:

DEVICE=<device name>
IPADDR=<IP address>
NETMASK=<netmask>

There is no need to configure a MAC address or a default gateway.

To activate the interface you can restart the entire network server (if you can do it) or use:

ifup eth0:1

Nagios plugin: monitor a systemd service

Here’s a tiny plugin to check if a systemd service is running:

#!/bin/bash
#
# машины
# 
# Check a if a systemd service is running
# 
# Usage: $0 
#
#Nagios exit codes
OK=0
WARNING=1
CRITICAL=2
UNKNOWN=3

SERVICE=$1

# Check service status

systemctl -q is-active $SERVICE
if [[ $? -ne 0 ]]; then
    echo "ERROR: service $SERVICE is not running"
    exit $CRITICAL
fi

echo "OK: service $SERVICE is running"
exit $OK

Changing sender’s email address in Nagios

By default settings, Nagios will send email notifications as nagios@localhost, identified by $ADMINEMAIL$ macro.

If you want to change this behavior, you need to set the email address you want to use in the nagios.cfg file:

# ADMINISTRATOR EMAIL/PAGER ADDRESSES
# The email and pager address of a global administrator (likely you).
# Nagios never uses these values itself, but you can access them by
# using the $ADMINEMAIL$ and $ADMINPAGER$ macros in your notification
# commands.
admin_email=nagios@localhost
admin_pager=pagenagios@localhost

Continue reading

VMware Remote Console 10.0.1 on Fedora 26

Welcome back to my (almost) daily appointment with “What’s wrong with Fedora today?”.

At work, our servers are VMs on a VMware vSphere; we access them using SSH of course, but sometimes we need to use the remote console from the vSphere Web Client (that is a vmrc link). I upgraded my kernel (and many libraries) last week but since I don’t use vSphere that often, I didn’t noticed anything until a couple of days ago, when a RAM stick failed and our machines crashed, rebooting in emergency mode.

Usually you login, select your VM, click on Launch Remote Console and you’re done. Unfortunately I got this:

reason       appLoader killed by signal 11
cmdline      /usr/lib/vmware/bin/vmrc
executable   /usr/lib/vmware/bin/appLoader
[...]
os_release   Fedora release 26 (Twenty Six)
kernel       4.12.11-300.fc26.x86_64

Continue reading

Fedora 26 and HTML5 video codecs

I upgraded to Fedora 26 weeks ago but I realize only today that I was having issues playing videos in Firefox, while I was trying to attend an online course.

At first I thought it was Flash Player’s fault: I always forget to have it and I always forget to update it. It was indeed out-of-date but the annoying “The media could not be played” error message was still there.

After a quick research and a little help from HTML5test, I noticed that few codecs were missing. I prefer not to install a bunch of codecs that I don’t even know what they’re for; if I am missing something I’m pretty sure it’ll come out! Continue reading

Using fingerprint authentication on Fedora 26

I’ve never ever had any problem using fingerprint authentication on openSUSE 42.1, it worked just out of the box, but when I switched back to Fedora (again), I had some issues configuring it.

On Fedora 26, by default, fingerprint authentication works only for logins but not for sudo. To enable this:

authconfig --enablefingerprint --update

If you’re using an older version of Fedora you can also use:

authconfig-tui

Continue reading