Archive
Posts from 2017
Using VirtualBox host networks with vagrant
I have a few VirtualBox VMs that I use to test clustering, Gluster, Ceph and various other technologies. These hosts have a NAT interface as well as a host network for internal communications. This week I revamped several of my Vagrantfiles to use a host network and learned a few things in the process. To get a machine to 'vagrant up' and connect to an existing VirtualBox host network I first had to install the vbguest plug-in: Once this plugin was installed I added a "private_network" stanza similar to the following to each Vagrantfile: Then I ran 'vagrant up' and my machines could see the host networks my VirtualBox VMs reside on…
$ read more →Using fail2ban to lock out unwanted visitors to your SSH daemon
I have a number of digital ocean droplets and AWS instances that I use for personal projects. For convenience I leave SSH open to the world so I can access these systems wherever I'm at. This DEFINITELY isn't a best practice but my personal instances don't contain anything sensitive and can be rebuilt in minutes with ansible. A wide open TCP port 22 doesn't come without issues though…
$ read more →What are bash return codes > 128?
I like to keep PS1 pretty simple. I like to see the host I'm working on, the directory I'm in, the user I'm currently logged in as and the return code from the last command I executed. This is easy to cobble together with bash escape s equences: The other day I was testing some new ansible playbooks and saw a return code of 130. Several years ago I read learning the bash shell and recalled something about the magic number 128…
$ read more →Having fun in the shell with cowsay and fortune
Last weekend while I was waiting for several ansible playbooks to apply I thought it would be fun to play around with cowsay and fortune. If you aren't familiar with these tools cowsay gives you an ASCII cow which says whatever is passed to it as an argument. Here is a example: To have a cowtastic time each time I open a shell I added the following to my bashrc: I guess the old saying is right. All work and no play makes an admin mooooooooo…
$ read more →Automatically updating your .bashrc when you log into a server
I am a long time bash user and have found numerous aliases and shell functions that allow me to be more productive at the prompt. Depending on how you manage (configuration management, NFS mounted home directories, etc.) ${HOME} making sure your bashrc gets updated when you find a cool new feature can be a pain. I was tinkering around last weekend and thought about adding a block of code to my bashrc to run curl to grab the latest version of my bashrc from github. The following short code block works for my needs: If a new version is available (a VERSION variable tracks the release #) I get the following output when I log in: If github is unavailable due to a service issue or a firewall won't let me out the script will let me know: How are you keeping your shell profiles up to date…
$ read more →