Tag Cloud
Currently Reading
Latest Book Reviews
- Certified Kubernetes Application Developer (CKAD) Study Guide, 2nd Edition Posted on January 11, 2025
- Rancher Deep Dive Posted on March 31, 2023
- Leveraging Kustomize for Kubernetes Manifests Posted on March 24, 2023
- Automating Workflows with GitHub Actions Posted on October 13, 2022
- Deep-Dive Terraform on Azure Posted on August 30, 2022 All Book Reviews
Latest Posts
- Server Move and Upgrades! Posted on June 22, 2015
- Networking Quirk in CentOS 7 - Virtual IP not being assigned Posted on June 14, 2015
- Automated SSL certificate expiration check Posted on June 4, 2015
- Restoring access to Fedora after Ubuntu upgrade Posted on May 3, 2015
- Spell check from the command line Posted on April 25, 2015
June 22, 2015
Server Move and Upgrades!
by Alpha01
My little corner of the internet has a new home. My old $29.99 8GB RAM, 3.40GHz Intel Core i3 dedicated server was simply not enough to handle my server needs. Which apparently OVH doesn’t even provide that service anymore. So instead I hoped to their mid-tear dedicated service service branch they call So you Start. I opted with their $49.00 SYS-IP-2 service. Now my server’s specs is a follows:
- 2.66 GHz+ Intel Xeon W3520 (4 cores/ 8 threads)
- 32 GB ECC
- 2 x 2 TB SATA drives (Software RAID)
I would’ve love the drives to be SAS and the RAID to be hardware based, but it’s definitely not a deal breaker, and just $49.99 a month, it’s not much to complain about.
CentOS 6 to CentOS 7 upgrade
My server migration was fairly straight forward for the most part. I opted to re-create the KVM hypervisor and its guests from scratch. Mainly because I wanted to upgrade all of guests and host from CentOS 6 to CentOS 7. This is where I encountered my first problem. Since I rely on custom nat PREROUTING
and POSTROUTING
iptables firewall rules for my VMs to properly be able to talk to each other and to the internet. I realized CentOS 7 defaults to firewalld, so instead of trying to rewrite my firewall rules to be compatible with firewalld, I decided to continue to use CentOS 6 on my host operating system, and only upgrade my guests VMs to CentOS 7.
On a side note, my previous guest VMs were originally using raw image format (default cache settings) for its storage, and by god what a hell of a difference it makes changing to use native block storage via LVM. I/O performance on my old server was terrible, the I/O wait percentage was roughly about 6%, now it’s less than 1%. Even with the software raid, I/O performance is much better on my new server.
PHP 5.3 to 5.6 upgrade
Since I don’t have anything heavily customized on any of sites, the PHP version upgrade was practically painless.
Apache 2.2 to 2.4 upgrade
Luckily, upgrading Apache wasn’t a big hassle. Anyone considering upgrading from 2.2 to 2.4, it’s definitely worth checking out the official upgrade documentation since dropping the old 2.2 configs in onto a 2.4 environment won’t work off the gecko. In my case all of my sites were returning 403 forbidden replies and non of my .htaccess files weren’t being read by Apache. The fix was really simple.
<Directory /www/path-to-webroot>
AllowOverride All
Require all granted
</Directory>
I must say, I really like Apache 2.4 new authorization syntax. What used to be a three line configuration is now a single line configuration, and much more human readable.
Future Upgrade Plans
I didn’t tackle this during the server migration, but I’ll definitely going to be upgrading to Varnish 4 and use PHP FastCGI via php-fpm
and mod_proxy_fcgi
.
kvm
php
centos
iptables
apache
]
June 14, 2015
Networking Quirk in CentOS 7 - Virtual IP not being assigned
by Alpha01
I just realized the order of which the IP configurations are set in the /etc/sysconfig/networking-scripts/ifcfg-*
file does matter. For example the following config was failing to assign the virtual IP 192.168.100.218 on one of my systems:
TYPE="Ethernet"
BOOTPROTO="static"
IPADDR=192.168.100.218
NETMASK=255.255.255.0
DEVICE="ens3:1"
NAME="ens3:1"
ONBOOT="yes
Systemd was spitting out the following errors:
Jun 14 01:04:19 webapps network: RTNETLINK answers: File exists
Jun 14 01:04:19 webapps network: RTNETLINK answers: File exists
Jun 14 01:04:19 webapps network: RTNETLINK answers: File exists
Jun 14 01:04:19 webapps network: RTNETLINK answers: File exists
Fix
It turns out that the DEVICE
and NAME
declaration needs to be assigned and specified before the networking information.
DEVICE="ens3:1"
TYPE="Ethernet"
NAME="ens3:1"
BOOTPROTO="static"
IPADDR=192.168.100.218
NETMASK=255.255.255.0
ONBOOT="yes"
centos
networking
]
June 4, 2015
Automated SSL certificate expiration check
by Alpha01
It is quite simple to automate checking for near expiring SSL certificates in CentOS. This is accomplished using the certwatch
tool. This tool is part of the crypto-utils
package.
yum install crypto-utils
``
Installing `crypto-utils`, will create the following cron job, `/etc/cron.daily/certwatch`. By default the `/etc/cron.daily/certwatch` script only checks for SSL certificates loaded by Apache (`httpd -t -DDUMP_CERTS`). So Apache users don't have to do any additional config changes to in order to automate the check of near expiring SSL certificates.
Since in https://www.rubysecurity.org I use Nginx as a SSL termination proxy for an Apache backend webapp on a different machine. I had to manually update the `/etc/cron.daily/certwatch` script to point to my SSL certificates directly.
```bash
#certs=`${httpd} ${OPTIONS} -t -DDUMP_CERTS 2>/dev/null | /bin/sort -u`
INCLUDE_CERTS='/etc/nginx/certs/*.crt'
certs=`ls $INCLUDE_CERTS 2>/dev/null`
Here is an example of an expired SSL certificate alert
[root@rubyninja certs]# certwatch /etc/nginx/certs/www.rubysecurity.org_2014/www.rubysecurity.org.crt
To: root
Subject: The certificate for www.rubysecurity.org has expired
################# SSL Certificate Warning ################
Certificate for hostname 'www.rubysecurity.org', in file (or by nickname):
/etc/nginx/certs/www.rubysecurity.org_2014/www.rubysecurity.org.crt
The certificate needs to be renewed; this can be done
using the 'genkey' program.
Browsers will not be able to correctly connect to this
web site using SSL until the certificate is renewed.
##########################################################
Generated by certwatch(1)
certwatch
is far from perfect. It doesn’t have any verbose output when doing a check, it solely relies on its exit status to verify if the check was successful. Excerpt from the man page is somewthat appalling.
DIAGNOSTICS
The exit code indicates the state of the certificate:
0
The certificate is outside its validity period, or approaching expiry
1
The certificate is inside its validity period, or could not be parsed
centos
monitoring
]
May 3, 2015
Restoring access to Fedora after Ubuntu upgrade
by Alpha01
I have a quadroboot OS installation environment on my Dell XPS laptop.
- Ubuntu (primary OS)
- Kali
- Fedora
- Windows 7
I decided to upgrade my Ubuntu installing to the latest 15.04. As soon the upgrade completed and rebooted, I noticed the GRUB menu was no longer displaying my Fedora 21 environment. The problem was because I had installed Fedora under an LVM partition, while the others weren’t.
Restoring boot access to Fedora was fairly simple.
First, I had install lvm2
package in Ubuntu so it’s able to view and configure the LVM
tony@alpha05:~$ sudo apt-get install lvm2
Then I had to activate the Volume Group.
tony@alpha05:~$ sudo vgchange -a y
After updating the Volume Group, using the os-prober
tool, I was able to verify that Ubuntu was able to see my Fedora 21 install.
tony@alpha05:~$ sudo os-prober
/dev/sda1:Windows 7 (loader):Windows:chain
/dev/sda6:Debian GNU/Linux (Kali Linux 1.0):Debian:linux
/dev/mapper/fedora-root:Fedora release 21 (Twenty One):Fedora:linux
So the last step was to generate a new grub config.
tony@alpha05:~$ sudo grub-mkconfig > /boot/grub/grub.cfg
ubuntu
fedora
lvm
]
April 25, 2015
Spell check from the command line
by Alpha01
I was pleasantly surprise to learn about a utility which lets you spell check text files or any string passed as standard input, directly from the command line. The name of this genius tool is spell
.
Examples
Example 1
tony@alpha05:~$ echo "What the fuc or what the fuck" | spell
fuc
Example 2
tony@alpha05:~$ cat test.txt
Fuck thi shit.
tony@alpha05:~$ spell test.txt
thi
bash
]