linux

A 6-post collection

Solving Fail2Ban not banning IPs on Ubuntu 16.04

I recently installed Fail2Ban on my personal mail/web host as the number of "bad actors" has climbed a lot in recent years and I no longer felt comfortable just allowing them to pummel my server. I'm writing up another blog post shortly on everything I did and how it all works; however, I had one issue that kept cropping up: Running fail2ban-client status recidive returned the following: Status for the jail: recidive |- Filter | |- Currently failed: 158 | |- Total failed: 741 | `- File list: /var/log/fail2ban.log `- Actions |- Currently banned: 8 |- Total banned: 8 `- Banned IP list: 185.127.19.155 203.87.129.135 80.82.77.203 94.102....

Triple Boot MacBook Pro (macOS, Windows 10, Linux)

I recently decided to run Kali Linux on my MacBook. I originally thought I'd just build it into a Virtual Machine (using Parallels), but was concerned that I might not have the control over the hardware that I'd need in order to make Kali effective as a learning environment. So, I set about working on a dual-boot scenario. Needless to say, I failed miserably when I opted to have Kali install Grub and it overwrote my primary Boot Manager on the Mac and rendered the system unbootable (and eventually unrecoverable). Thank goodness for good backups... WARNING: Do not proceed with any of these steps unless you have the ability to restore a bare-metal backup. Everything I'm doing has the potential...

Setting up Automatic Updates for Ubuntu

Keeping your system up to date is the single most important way to prevent security and malware issues.  Ubuntu provides nice tools for maintaining your system, but if you manage it via a command line you may be used to seeing: 1 2 3 packages can be updated. 3 updates are security updates. This is the Ubuntu system notifying you that it noticed there are 3 packages that have updates available.  This check is enabled by default and is part of the **update-motd** system.  Some background on how this works will provide insight into the workings of Ubuntu and then we’ll talk about automating those updates. Background update-motd is a system program introduced in Ubuntu that allows for the...

Create a Startup / Boot Script under Ubuntu

In managing Unix systems, you will often have occasion to have a process or action performed at boot time. There are several ways of accomplishing this goal, but the right way is to create an init script and configure it to run at the proper run levels. Here’s how to do that under Ubuntu. A valid LSB (Linux Standard Base) Init Script has 4 components: Provide, at least, the following actions: start, stop, restart, force-reload, and status (actually optional) Return proper exit status codes Document runtime dependencies Log messages using the Init.d functions: log_success_msg, log_failure_msg and log_warning_msg (optional) To document runtime dependencies you’ll have to define a header on your script....

MySQL Database Replication over an SSH Tunnel

SSH Tunnel Setup Create an SSH key (Version 2) to allow passwordless replication: $ ssh-keygen -t rsa Copy the SSH key to the Master (assumes same user account on Master and Slave): $ ssh-copy-id master.machine.dom Setup the SSH Tunnel from the Slave to the Master on Slave Port 3305: $ ssh -f master.machine.dom -L 3305:127.0.0.1:3306 -N Now local port 3305 is actually port 3306 on the Master. Test that you can access the Master Database from the Slave: $ mysql -h 127.0.0.1 -P 3305 -uUSER -p You must use 127.0.0.1, not localhost, because MySQL treats “localhost” differently. If you are able to get a MySQL connection and verify access...