Receive Alerts On SSH or SFTP Logins with Papertrail

papertrail

Frustration-free log management, plus a lot more

I’ve been a huge fan of Papertrail ever since I discovered it, probably about a year ago or so. I use it mostly to monitor server logs. I currently have two servers setup to send syslog messages to Papertrail.

The Papertrail Events dashboard can be a bit overwhelming at first, but the provided search is powerful and allows you to finely control which log messages you see and which you don’t.

You can even setup saved searches to fire when a specific event occurs. For example, I have a saved search that searches for the following:
Accepted publickey for tyler

When that message shows up in Papertrail, it means that I logged in, or that someone else has logged in using my SSH key. This can be quite handy, especially if you’re a one man shop like me and are usually the only person that has SSH or SFTP access to a server.

Getting a DigitalOcean VPS added to Papertrail, especially if it’s running Debian or Ubuntu, is super easy. It just requires that you modify /etc/rsyslog.conf and add a line to the end of the file that will send a copy of the system logs to Papertrail.

Papertrail can monitor application logs, too, such as Apache httpd logs and MySQL server logs, although that takes a bit more configuration to get working properly.

If nothing else, it’s just nice having system logs aggregated in one central place, where everything is easy to search through, making it easy to find exactly what you’re looking for. If you’re an admin for one server or hundreds of servers, Papertrail could turn out to be one of your favorite tools. It’s definitely one of my favorites.

I suggest you give Papertrail a try, can’t hurt, they even have a plan that’s free forever. It’s definitely a great service for monitoring server logs.

Copy.com Referrals Give Crazy Amounts of Free Cloud Storage Space

copy_bonuses

Lots of free cloud storage, 5GB for every referral :)

I use Copy a lot. I still maintain a Dropbox account for sharing files with friends who still use it, which is most of them honestly. But, I have such a crazy amount of free storage at Copy that I use it for absolutely everything.

All of my photos and video go there from my Nexus 4. On top of that, when my Nexus 4 gets full, I’ll just archive it to Copy, so I essentially have two of every photo and video in Copy. Dropbox holds just one copy of all videos and photos, I only have about 20GB of storage there, so that stuff eventually gets brought down to a local drive. Which I should probably just bring it local right off the bat and just skip Dropbox all together for that stuff. But I digress…

I’m currently using about 19GB out of 185GB available to me. It’s all due to this post I made back in August of 2013. It resulted in a bunch of referral signups, which gave me an additional 5GB each. I started out with 15GB of storage.

If you’re a blogger and want some decent amounts of free cloud storage, check out Copy. Drop your referral link in relevant posts and you’ll slowly start building up referrals and gaining additional storage.

Copy has clients for Android, iOS, Linux, Windows, MacOS, and probably others. Just visit their download page. I’ve been very impressed with Copy and have been using them for nearly a year. They’re run by Barracuda Networks.

I dig Copy’s Fair Storage concept, which they explain like this:

We believe in a simple concept of fairness. Everyone paying for the same data they are sharing doesn’t work for us. We think that’s like going to dinner together and everyone having to pay the entire bill. People sharing content should equally divide the amount of storage being used. With Copy, you can split the bill. So a 12 GB folder shared between 3 people only counts as 4 GB per person.

Unless I’m missing something, that sounds as lot better than what Dropbox does. With Dropbox, if someone shares a 4GB folder with me, that’s 4GB taken away from my available storage, plus the other persons. So both of us ending up getting the 4GB taken from our accounts. Fucked, but that’s a topic for another post.

I still think you should check out Copy. I seriously recommend it, and that’s after I’ve been using it constantly for nearly the last year. I’ve a couple minor gripes about the Linux client, but I can deal with them.

Affiliate links are rampant throughout this post. If you don’t want to help me out, here’s a non-affiliate link for Copy, and here’s a non-affiliate link for Dropbox. Pretty sure you get extra space if you sign up from an affiliate link though, so, your call. Here’s the affiliate Copy signup link and the affiliate Dropbox signup link. :)

How-To: Install lolcommits On Ubuntu

lolcommits

Lolcat-style photos as you commit

I’ve always had problems installing lolcommits on Xubuntu and other Ubuntu-based Linux distributions.

The installation instructions are very simple. Only requiring you to run two commands, sudo apt-get install mplayer imagemagick libmagickwand-dev and then sudo gem install lolcommits (need sudo for linux). Pretty simple.

The gem install lolcommits command is where things usually go bad for me. I typically see something like this:

To fix this, you need to install a newer ruby-dev package:

You can now try to install the lolcommits gem again. It’ll actually install this time:

A GitHub user documented this solution in issue #54. Another user suggests that the installation guide should be updated to make a note of this, but I haven’t seen it noted anywhere but in issue #54.

It’d sure save me a bit of time if it was noted somewhere, that’s partly why I’m writing this post.

After you’ve got lolocommits installed, see the README on GitHub for usage instructions and examples.

I usually run lolcommits --enable --delay=2 --fork when enabling lolcommits. That will capture a photo in a forked process, after a 2 second delay. I like this method because you’re not left waiting for the photo before being able to type into your terminal again.

Lolcommits is kinda cool, but not really useful in a practical sense. I do use it pretty much everywhere though, and have the default storage location linked to Copy. That way all my images are in the same place, no matter which machine I’m using at home.

If nothing else, it’s something kinda neat to be able to offer to your clients.

tyler-hat-lolcommits

I no longer smoke. ;)

Remove SSH Login Message After DigitalOcean WordPress One-Click Install

do

After creating a new Droplet using the pre-built WordPress image provided by DigitalOcean, you’re presented with a very helpful message after logging in via SSH:

To finish installing WordPress, navigate to your droplet’s IP: http://xxx.xxx.xxx.xxx
Make sure to specify hostname from DO panel to your droplet before creating it (for example: ‘blog.mydomain.com’ or ‘myblog.com’)
This will create necessary Apache configs based on hostname and Apache will respond based on hostname.
Server will also respond to its IP address, so if you finish installation from http://IP then
you will need to change hostname from WordPress Settings later (from http://IP to http://hostname)

It’s a really helpful message, especially if you’re new to DigitalOcean and even more so if you’re new to hosting stuff on your own (ie: unmanaged hosting). However, the message isn’t really helpful after the first login, maybe two logins.

There’s a great article on how to get setup after using the One-Click WordPress install, but removing the message is never mentioned.

It’s just a message of the day, the configuration for which can be found in /etc/motd. Delete line 2, and you should be good to go.

Poor Man’s VPN With a Cheap VPS

SONY DSC

sshuttle is what makes me love the Internet

It really is awesome, sshuttle basically allows you to browse the web via your VPS, in my case, a DigitalOcean VPS. It works on Linux and MacOS.

The GitHub repo explains it better than I can.

Transparent proxy server that works as a poor man’s VPN. Forwards over ssh. Doesn’t require admin. Works with Linux and MacOS. Supports DNS tunneling.

It hasn’t been updated in two years, but, no need to fix or change something that doesn’t need fixing or changing.

So, Why? What’s the point?

I run some Tor relays, one out of my house, thanks Mediacom! ;)

Because of this, many websites block my. Kohl’s, Best Buy, no posting on 4Chan (understandable), even healthcare.gov is blocked. I don’t want to pay for one of the many VPN services. Here’s the message I get at healthcare.gov without sshuttle.

Access Denied

You don’t have permission to access “http://www.healthcare.gov/” on this server.
Reference #18.22ea4d17.1397361569.6bb6afe

VPN’s even provide vital Internet access to those facing government censorship, and worse.

Options

Setting up a secure VPN server on a linux box can be a pain, and definitely takes longer than 5 minutes. sshuttle takes about that, maybe, if you type really slow.

So, for me, when I found sshuttle, my heart was set, the other options didn’t matter.

Setting Up sshuttle On Ubuntu Flavors

Doesn’t get any easier than this. Run the following in a terminal:

Now, we’re basically going to SSH to our VPS/server. Again, run this in the terminal:

After running sshuttle -r [email protected] 0/0 -vv you’ll be asked for the root password. And sometimes, for whatever reason, it dies immediately after running the sshuttle command.

If sshuttle doesn’t work after running it the first time, run it again! It should work the second time. It could be something with the system I’m on, so hopefully this is isolated to me. :)

Setting Up sshuttle On MacOS

When someone donates me a new Macbook Pro 15″, I’ll start writing this stuff. :)
Update: April 21, 2014 Have a look at this post for using sshuttle with MacOS. Comes courtesy of Aaron Bull Schaefer in the comments.

And if I need a VPS?

You can find a VPS easily with Google. DigitalOcean has them for $5/month, which will be plenty sufficient to use specifically for sshuttle.

Other Options

Lots of other options have been mentioned in the thread at Hacker News. Check em out. Some really good suggestions that are sometimes even cheaper!