Ever heard of inodes? You need lots of them.

Ran into a situation on a customer’s CentOS server the other day where a service wasn’t working. Symptoms and error messages indicated the disk was full. However ‘$ df -h’ was showing ample free space. What the heck? Turned out the maximum number of files on the disk had been consumed. Technically speaking, the limiting factor was the number of inodes allocated to the volume. An inode is taken up for each file, directory and link on the file system. Inodes act like a database for the files on a file system and contain pointers to the actual information.

When a partition is created the maximum number of inodes is established, rather set in stone. There is no way to re-partition the number of inodes on the fly. In this particular case the volume was 75GB with 23GB free, but only 1,000,000 inodes were allocated to it. The temporary solution was to remove old files that were not needed to get the total number of files on the partition safely back below 1M. As soon as that was taken care of the system started working again.

Unix/Linux (and Mac of course) have the inode concept built into their file systems. To check out the inode status run ‘$ df -i’ to make sure you are not at risk of running out of those precious inodes.

user@host.com [~]# df -i
Filesystem            Inodes   IUsed   IFree IUse% Mounted on
/dev/sda             49152000 8771724 40380276   18% /

inode related commands:

‘$ ls -i’ it will output the inode ids for each file / directory.

user@host.com [~]# ls -i1
 1725516 access-logs@
 1721190 backups/
 1720340 dead.letter
 1720652 etc/
 2173459 logs/
 1720654 mail/
 1720648 public_html/
41845314 python@
 1729306 ssl/
 1720653 tmp/
 1720660 www@

The stat command will tell more details about the particular file / inode.

user@host.com [~]# stat public_html
  File: `public_html'
  Size: 4096            Blocks: 8          IO Block: 4096   directory
Device: 800h/2048d      Inode: 1720648     Links: 13
Access: (0750/drwxr-x---)  Uid: ( 1058/user)   Gid: (   99/  nobody)
Access: 2011-12-04 16:29:56.000000000 -0500
Modify: 2014-04-20 03:19:04.000000000 -0400
Change: 2014-05-17 00:00:11.000000000 -0400

To get a count of the inodes per folder under the current directory:

user@host.com [~]# find . -type f -printf "%h\n" | cut -d/ -f-2 | sort | uniq -c | sort -rn
   5789 ./public_html
    557 ./mail
    555 ./tmp
    205 ./logs
     75 ./.cpanel
     43 ./etc
     25 .
     13 ./.sqmaildata
     10 ./.fontconfig
      6 ./.subversion
      6 ./.gnupg
      6 ./.fantasticodata
      5 ./.htpasswds
      3 ./backups
      2 ./.emacs.d
      1 ./.ssh
      1 ./public_ftp
      1 ./.cpan

This can take forever so you may want to direct the output to a file (assuming you can spare an inode):

user@host.com [~]# find . -type f -printf "%h\n" | cut -d/ -f-2 | sort | uniq -c | sort -rn > inode_count.txt

For more information:
http://www.linux.org/threads/intro-to-inodes.4130/

Posted in Sys Admin | Tagged , , | Comments Off

Grunt – for automating builds in Front End land

Grunt is a front end build tool I’ve used on the last several projects. It handles CSS / JavaScript minification, concatenation, and linting really well.  Some of my legacy projects use a combination of bash and Yahoo UI Compressor, which I’m now switching away from in favor of Grunt.

grunt
What I liked about Grunt from the start is, it is 100% command line based!  Never seen a front end tool that lives on the command line before. That alone got me excited, but it gets better. Grunt is versatile given its plugin architecture. There are over 2750 Grunt plugins at the time of this writing. For example, Grunt can be used to run unit tests, setup as a ‘watch’ to automatically build SASS while developing, and even run PHP, Ruby and Python tasks.

Grunt runs on Node.

Grunt depends on node and npm (node package manager). It is very simple to get started.

$ npm install -g grunt-cli

Then you drop a Gruntfile.js into the root of your project and start configuring.

Here is a sample Grunt  script.

This script combines the web app’s JavaScript and CSS files into production ready files. This is in accordance with the YSlow recommendations for limiting the number of .js and .css files a web application downloads the first time it loads. It also has a task for running jslint, which checks the JavaScript I wrote for obvious problems and stylistic errors.

To kick it off:

$ grunt minify

Results in the built JavaScript and CSS files in the /build/ folder.

To run the lint task (powered by jshint in this case):

$ grunt lint

If opening an extra terminal window gets annoying, there is a plugin available for Sublime Text: sublime-grunt.

For those of you coming from the Java world:

Grunt works a lot like Ant. It does the same things in terms of automating the build process, compilation (well in this case minification), cleaning the build folder, and running unit tests.

There is a companion tool called Bower which reminds me of Maven in the way it resolves dependencies. A second companion tool called Yeoman works similar to Maven archetypes in that it provides pre-built projects with the scaffolding setup.

The trifecta – Grunt, Yoeman, and Bower:

Grunt by itself is just a build system, but combined with Yeoman ‘yo’ for short, and Bower it gets a lot more powerful.  Descriptions of each from the Yeoman website:

  • yo scaffolds out a new application, writing your Grunt configuration and pulling in relevant Grunt tasks and Bower dependencies that you might need for your build.”
  • Grunt is used to build, preview and test your project, thanks to help from tasks curated by the Yeoman team and grunt-contrib.”
  • Bower is used for dependency management, so that you no longer have to manually download and manage your scripts.”


Other thoughts:

At the moment, NPM is a bit like the wild west meets woodstock. The progressive free love that is the npm echo system continues to crank out new packages and interwoven dependencies at a staggering rate. No one person or company is in control of the endless supply of new packages and plugins that are available. That makes it great. It also makes it unstable and insecure.  See my post on Software Ghettos for some thoughts on using open source projects of all shapes and sizes as dependencies.

On rare occasions it is frustrating when something goes wrong with Grunt. If you are lucky it is due to a version mismatch in the local environment and ‘$ npm cache clean‘ might fix it. The error messages can be vague and misleading. I have ran into situations where a fix was available but not ported into the main npm tree or even merged into the plugin’s repo. In these cases I had to override the version manually or do some other hacky fix to get going again.  I have also noticed subtle differences between Windows / Mac / Ubuntu in the way the CSS / SASS related plugins operate. In these cases I deferred to building on Mac. (I really should have documented the issue and made a blog post about it. I wrote it off at the time as a fluke so take that last observation with a grain of salt.)

All in all Grunt is a great tool.  I use it, my life is better, my clients benefit, and releases proceed as planned.

 

Posted in Application Development, Code | Tagged , , , , | Comments Off

Wolfram Alpha Language Coming Soon

Wolfram Alpha has always been a interesting if not quirky ‘intelligent search engine’. It can do things like:

Now its creator, Stephen Wolfram, has announced a ‘language’ that bolts on top of the curated data Wolfram Alpha uses.  It looks like Mathematica on steroids hooked to the cloud. This preview video is well worth watching:

From the video the Worlfram Language appears to be more like a high level collection of functions that fit nicely together to process data vs a ‘language’. The annoying part is, I don’t see a way to get my hands dirty and play with it at the moment.

More information:

Posted in Science and Math | Tagged , , , , | Comments Off

ReCaptcha getting hard to read, found streamlined substitute in FatFree

Recently implemented a Captcha field on a signup page.  So, to start with I looked around for a good plugin to handle this. ReCaptcha was the first one that popped up. ReCaptcha does support themeing, which is nice since the default red and yellow is a bit loud.  The problem I came across is it renders hard to read images a good 20% of the time. See example below.

recaptcha

Can the average user be expected to get past this hurdle? I seriously doubt it.  We don’t want to deter users from succeeding at signing up. We especially don’t want to make them feel stupid because of some clunky but well intended gadget on the page.

So for now instead of ReCaptcha I went with the PHP FatFree Captcha plugin. It doesn’t have the audio component, nor the refresh or help button, but I think it is a lot cleaner. I wish the ReCaptcha library had configuration options for this, and a ‘difficulty’ level.

fatfree_captcha

Here is a code example of using PHP FatFree (F3) to display a captcha image inline in a form. You supply the ttf font on your own.

<? // use FatFree's captcha feature to build a 7 letter captcha image
$img = new Image();
$img->captcha('./library/fonts/Arial.ttf',16,7,'SESSION.captcha_code');
?>

<img src="data:image/png;base64,<?= base64_encode($img->dump()); ?>" />

<? 
// the correct answer is stored in:
// $_SESSION['captcha_code'];
?>

 

Other thoughts about blocking spammy signups:

We could go without a captcha field, but at the same time, we want to cut down on spam. A good trick, which compliments a captcha, is to add a hidden form field which must be left empty for the submission to succeed. A human never sees this field so it is no problem for that use case. However, greedy spam robots will normally fill out every single form field they find in the HTML. The robots are too dumb to recognize they are tipping their hand, and the submission fails.

 

Posted in Code | Tagged , , | Comments Off

On Pluggers, Rockstars, Ninjas, and other fun labels for developers – which are you?

My first boss taught me there are two types of programmers: pluggers and rock stars. It was the late 90’s, and programming talent was in high demand. I was the young gun they brought in.  A plugger would not have worked out they told me. There was just too much opportunity to be had!  We went on to attempt our own web based online auction system hosted with Windows NT 4.0 powered by a Pentium 100 chip using a FoxPro backend… You can guess the outcome, but that is another story.

As I’ve thought about it over the years there are many categories, or rather stereotypes for programmers beyond the garden variety plugger and rock star.  In general stereotypes are negative, politically incorrect, and ignorant. At the same time, stereotypes help us survive in the wild and make for humorous but sometimes hurtful labels.

Pluggers, or better Samurai Coders

samurai

Pluggers are the ultimate katana / keyboard wielding soldier.  A plugger comes into work on time everyday and reliably gets their work done without stirring things up. Like Samurai, they are willing to sacrifice themselves for the cause, following the rules and the spec without question.  Work gets done, but at best it is average, since the average programmer is probably a plugger / samurai anyway.

The Joke about Samurai Coders:
Too bad swords are obsolete and so is their skillset.
Harsh but true, programmers who get in a comfortable rut are going backwards in the ever changing software job market.

Where Samurai Coders can improve:
Generally, I’ve noticed Samurai Coders are not very interested in learning new things unless forced.  My recommendation is to join a software book club, attend local meetups, or at the very least watch a tutorial video with lunch everyday for a week. Then share what was learned with the team.  Also, don’t forget to try and poke holes in the spec.

 

Rockstar aka Diva

rockstar

The opposite of a plugger, rockstars crave attention, challenge, and accomplishment. They can work well on teams, provided there are not too many of them in one area of the system (or they fight). Rockstars have an insatiable hunger to take on projects WAY beyond their abilities.  They may just get away with it too.

The Joke about Rockstars:
Fashionably dressed in their own mind. Some rockstars are so cool they wear the same clothes everyday.
When managing a rockstar – don’t forget to schedule a bug fix release, just tell them it’s an encore.

Where Rockstars can improve:
The best performers know their limitations. A rock star needs to understand their own limitations and especially the limitations of the frameworks and tools they rely on.  I would encourage a ‘junior’ rockstar who only knows one programming language to learn a second and somewhat different programming language from their first.  Rock stars should also learn to pass on their good energy and experience by being everyday leaders and mentors.

Some Rockstars are really just Divas who rock the boat whenever they don’t get their way. Divas think their code is perfect and can’t listen.

 

And now for something completely different…

Humorous stereotypes for developers including Ninjas, Do Alls, Hackers, Acronym Guy/Gal, Barnacles, and Mercenaries.

 

Ninja

ninja

JavaScript Ninjas, DevOps Ninjas, and all other sorts of Ruby/Python/PHP/iOS Ninjas are running around out there. Some job postings even request Ninja’s by title.

Ninja coders work in stealth, and leave no trace. Similarly, their code must be kept quiet. No logging statements… no comments… just an odd tingling sensation on the back of the neck that something might be wrong.  A Ninja’s code is so concise, nobody, not even their future selves will be able to decipher it.

Ninjas fix bugs like lightening. Warning: may require multiple strikes to close the ticket. Warning 2: these ‘lightening’ strikes may start fires elsewhere.

 

Do All

ned

You may have encountered the software team member equivalent of ‘Ned Flanders’ once or twice your career. It is easy to recognize the okily-dokily Do All.

The Do All volunteers to work evenings and weekends to make sure the features that ‘have’ to ship do.  They might get some of the cooler tasks, but they also volunteer for the stuff that is ‘too hard’ for everybody else.  A sure sign of a Do All is they have absolutely no interests outside the current sprint.

The Joke about the Do All:
Calculate their actual take home pay on an hourly basis and you’ll feel sorry for them.

 

Hacker

hacker

To a hacker, their code is such a masterpiece, why would it need testing or documentation?

Hacker Behavior:

  • Runs port scans and network sniffers on co-workers machines.
  • Attempts to install malware on co-workers machines.
  • Thinks more code is always the solution, especially when it comes to bug fixes.
  • Attempts to sneak non-business compatible licensed libraries into the code base.
  • Runs a really screwy build of Linux so they don’t have to join WebEx meetings and avoid platform testing.

The Joke about Hackers:
They are probably really just a script bunny.

 

Acronym Guy/Gal

acronym

You may have witnessed this breed, common to the Enterprise Java and .NET stacks. When Acronym Guy/Gal announces themselves, they proudly rattle off the acronyms associated with the stack they work on. Their resume is covered with acronyms. They may have a habit of reciting acronym chains. An Acronym Guy/Gal often recommends building new features using acronyms they know nothing about because they have yet to pad their resume with them.

The Joke about Acronym Guy/Gal:
Acronym Guy/Gal fails to realize how fast today’s acronyms go from popular buzzwords to yesterday’s maintenance project, or fade into nothingness.

 

Barnacle

barnacle

Barnacles have been at the company way too long and are VERY intent on staying. When threatened the typical barnacle defense mechanism is to bring up ‘how things used to be done’ based on a self serving oral history of the organization. A barnacle argues against upgrading anything, kicking and screaming their way out of a meeting that proposes even the slightest degree of change.

The joke about barnacles:
Over the years, barnacles have walled themselves off with so much bad code they believe they are indispensable. (Yeah, keep believing that barnacle). Hence, one of the least productive people on the team. Their co-workers notice this and shake their heads ‘ahh, what a silly barnacle…’.

 

Mercenary

merc

A hired gun. The mercenary’s mantra: “Identify the problem and prolong it.”

Mercenaries are very, very good about bringing up schedule problems… but only 2 weeks before their contract ends.  A mercenary’s agenda usually involves scope creep if not wholesale re-writes. Mercenaries are fun to talk to at the water cooler because they have seen more of the outside world, have interesting stories, and have a different emotional take on the situation.

The joke about mercenaries:
When invited to irrelevant meetings, a mercenary is the only person in the room smiling (except the Do All who arrived early and has the eagerness of a puppy to get the meeting started).

 

The End

Don’t be offended if you see yourself somewhere in this article.

I’ve been several of these over the years at different times, perhaps multiple categories at once, usually without realizing it. The challenge is to step outside yourself and analyze your own behavior, like you might debug a program. What makes you tick? How you can transcend a label? My goal is to deliver value on a daily basis to my team, my code base, and my customer/employer. Stereotypes for that sort of individual might be: team player, a full stack developer, but I think it is best described as simply: software professional.

Photo credits:

Samurai Photo from indi.ca, CC-License Rockstar Photo from LUIS BLANCO PRESS PHOTOGRAPHER CC-License Ninja Photo from Lachlan HardyCC-License  (cropped) Do All Photo from Popculturegeek CC-License Hacker photo from sfslim  CC-License Acronym photo from mraible CC-License Barnacle photo from mscheltgen CC-License Mercenary photo from xJason.Rogersx's CC-License

Posted in Fun Nerdy, Work | Tagged , , | Comments Off

Software Development Heaven – sit stand desk and Herman Miller chair

This year I joined the sit-stand work environment revolution and I love it! When it comes to being a successful software professional, investing in the right tools is important. Many of us overlook ergonomics, especially our desk and chair. In terms of productivity, I would argue our desk and chair are just as important as our workstation/laptop, keyboard, IDE, and even wifi connection.  An internet connection is now suddenly much less useful to me when it doesn’t come with an ergonomically designed sit-stand workstation.

Unfortunately most employers are cheap when it comes to providing good desks and chairs for their people. Thankfully this is changing. In 2006 Joel Spolsky pointed out a top of the line chair helps with staff retention and productivity. When averaged out over the life of the furniture, per day it costs less than toilet paper! Think about that the next time you use the bathroom.

I have gone through 4 chairs from big box stores in the past 6 years. Some for $75, one $200! This time around I did some research and have hopefully fixed the issue once and for all. This time I went all out and invested in the best chair I could find. That means skipping the big box stores completely. Only boutique furniture stores that specialize in ergonomics have the right stuff. I also opted for a motorized sit-stand desk, allowing me to stand for part my work day further improving my posture.

BEFORE – sit down only, chair from big box store:

AFTER – sit stand motorized desk with Herman Miller Embody chair:

sit stand desk software
Sitting configuration.

sit stand desk, standing mode

Standing configuration with anti-fatigue mat.

I use an anti-fatigue mat when in standing mode. I spent about $40 on a good one from Amazon. My rug is pretty thin on top of hard wood floors. After an hour I do notice my feet start to ache without the mat. When standing I make sure not to lock my knees. I shift my weight between feet or adjust my posture every few minutes. At first it is a little strange standing up and programming. It puts me in a different kind of mental zone where I feel an urgency to get things knocked out.  Feels like ‘the meter is running’, so I need to get more done when I’m standing. I stand 2-3 hours at most in a day. The difference at the end of the day is noticeable!

I am overjoyed with this setup. My productivity is way up and I feel great!

This entire setup was $1,850 including freight shipping. That is less than a new 15” MacBook Pro! It should last 10-12+ years, much longer than your average development laptop. Doing the math, if this setup lasts just 10 years the cost is ~$0.50 per day.  Seems like a no brainer. Plus it makes a nice tax deduction, which are few and far between in the software business.

How to buy an ergonomic desk and chair – shop in person if possible:

When shopping for a desk and chair, I didn’t want to order it blindly off the internet, especially the chair. I recommend going to a showroom that carries Herman Miller chairs. Pacific Furnishings in Portland, Oregon carries the entire Herman Miller line. They have a huge selection of high end office furniture. It is a fun place to visit. I sat in the Embody model for about 10 minutes and noticed it improved my posture right away. The Embody makes it hard to slouch, but also has a nice rocking mode when in a conference call or watching a presentation. I also tried the Aeron and Mirra models, but I didn’t like them. The Embody was the chair for me. All Herman Miller chairs get great reviews but each model is unique and suits a particular body style.

herman miller embody for software professional

I just love the exoskeleton design of the Embody:

herman miller embody for software professional

Finding a good sit stand desk:

Sit stand desks may be harder to test out locally. Thankfully ErgoDepot has an office in Portland. The cheaper sit stand desks are way more wobbly when in standing mode. I considered the crank style desks because they are cheaper, but the crank takes FOREVER. So I went for the motorized version.

Motorized sit stand desk switch

The switch on the left is to power the motor, the switch on the right raises and lowers the desk.

If you are on a budget, a do it yourself (DIY) standing desk is not that hard to make. Here is the ghetto one I built temporarily. I considered building a second standing desk just for my laptop. That takes up extra floor space and switching machines would break my train of thought.

DIY standing desk

I recommend rigging something temporary just to see if you like standing while working.

Taking it to extremes:

If you really want to take ergonomics in the workplace to an extreme, ErgoDepot has desks hooked up to treadmills! I’m pretty sure coding while walking would be an interesting skill to master, perhaps someday an Olympic sport. Interviewer: For this next interview question we’d like you to implement the bubble sort routine in C while jogging on a treadmill. Ready, set, go!

They say spend good money on anything that separates you from the ground – your bed, your tires, your shoes. Now I include my computer chair and desk in that list and I hope you do too!

Posted in Business, Work | Tagged , , , | Comments Off

AngularJS Review – A Sweet Client Side JavaScript Framework

AngularJS makes everything else look obsolete. I’m looking at you Backbone and Ember… It is one of those things where in hindsight the approach appears obvious because it is so elegant. However it took the web a good 15 years to arrive at this point. It makes jQuery look like VHS ;)

AngularJS-large

AngularJS’s biggest strength is how it automatically binds form data and DOM state in an intuitive spot called $scope. It keeps track of populating everything, firing events, showing/hiding blocks, even looping, sorting and filtering of arrays. It just works.

A short LIVE demo with code samples:

AngularJS Demo - Client Side CRUD Prototype

An example of backing a page with JSON, allowing local additions, local sorting, local filtering by name, and AngularjS form validation. Note - this demo works with AngularJS 1.1.5.

Name Filter:
Name Category
{{tree.name}} {{tree.category}}
Name required. Category required.
The Script:

The HTML5 - note the "ng-*" directives, those make the AngularJS wiring happen:

 

Other things I like about AngularJS:

  • Change a variable in the $scope in one spot and it is reflected in the DOM and everywhere else that variable is referenced. This works for variables used programmatically, including pagination, search filters, etc. Very slick.
  • Works great with JSON.
  • Supports dependency injection.
  • Unit test friendly.
  • Has its own rendering syntax, which is denoted by {{ some.data }}, which starts with just enough power but allows you to extend. That aspect of it reminded me quite a bit of Django.
  • Nothing is stopping you from using as many frameworks as you like along side it. There’s often no point in doing much with jQuery, but you can if you like.
  • It is flexible in terms of which modules you choose to utilize. AngularJS may be used as a single page app, or stand alone in a more traditional full-page-load-per-request style app.
  • It is easy to get started. The first few minutes of looking at it is a mind bender. However, after watching a 1 hour intro video I was pretty well oriented. You need to understand $scope, $routes, and how the app and its controllers fit together. After a day with it, and some pointers from a colleague who had done a couple apps in it, I was knocking out features at a good clip, perhaps even faster than I could with jQuery.

Like any software it has its weaknesses. What I don’t like about AngularJS:

  • Still a little quirky. The docs don’t always line up with the version you may be using. I started with 1.0.8 then switched up to 1.1.5, which helped a lot.
  • In terms of keeping legacy AngularJS apps updated, it would be painful to take a fully debugged 1.0.3 app that works in production and upgrade it to 1.2.x. There is just too much is going on under the hood. Note that I have not done that, but it is just the sense I get from working with it and seeing what kinds of stuff people are running into on StackOverflow.
  • AngularJS is asynchronous in nature which can be tricky to program against, especially when dealing with security in a single page app.
  • If you want to use an outside plugin, like a UI widget, be prepared for issues. It is up to you to make sure the widget events get applied to the scope, since it won’t know about them until you manually wire them in.
Posted in Application Development | Tagged , , , , | Comments Off

Using MySQL with Encrypted SSL Connections

MySQL offers native support for connecting via SSL. By default this is available in AWS RDS MySQL instances. Using this connection method effectively encrypts all data going back and forth between the client and the server. This prevents eavesdropping (aka packet sniffing). This is especially important in relation to cloud hosting, where traffic sniffing may be possible by other customers. There are other ways to protect the traffic (ssh tunnels, VPN), and I discuss the pro’s and con’s of these below.

I wanted to find out how much of a performance hit MySQL’s SSL mode caused so I did a benchmark which you can read about here.  The performance penalty is pretty high – 20% and up, OUCH!

Documentation for using SSL natively with MySQL:

Application Layer Changes:

Connecting to MySQL in SSL mode requires extra connection options. On the command line this is as simple as adding the –ssl_ca option which points to the *.pem file. In the case of X.509 certificates, –ssl_cert and –ssl_key are also required. Note that RDS does not currently support X590 client certs for connecting.

This translates into minor application level code changes. In addition the SSL cert files will need to be stored on the application server.

Some documentation links:

For more information: Using SSL with MySQL

Changes to GRANT statements:

MySQL supports a GRANT statement modifier ‘REQUIRE SSL‘ which will need to be applied to the application layer database accounts. This requires the appuser account to connect with SSL.

GRANT SELECT, INSERT, UPDATE, DELETE
ON database.* TO 'appuser'@'appserver'IDENTIFIED BY '****'
REQUIRE SSL;

Similarly to require the client to have a valid certificate, the ‘REQUIRE X509′ statement can be used:

GRANT SELECT, INSERT, UPDATE, DELETE
ON database.* TO 'appuser'@'appserver'IDENTIFIED BY '****'
REQUIRE X509;

Alternate Methods of Securing Data Transport:

Protecting data transport between the db server and the app server can also be done using ssh tunneling with something like autossh or a VPN. While ssh tunnels are a little ghetto, a VPN is really the best option. Both these approaches delegate the encryption to the network layer making it transparent to the application layer. This sort of work is handled by the dev ops / networking / sys admin team.  Setting up a secured connection correctly so it is highly available takes skill and is not cheap. This is data security we are talking about, something to take very seriously!

With AWS RDS, ssh tunnels and a VPN are not feasible since MySQL is provided as a service. With RDS the underlying network and platform details are not accessible. It is not clear if the AWS Virtual Private Cloud (VPC) solution offers protection against traffic sniffing in relation to an EC2 app server connecting to an RDS database. With the 20% minimum performance hit from enabling SSL, that gives your team a lot to consider.

Why care about encrypting traffic between the app server the db server?

In many cases, the connection between the application server and the database server can be unencyrpted.

The most common starter case is an application connecting to localhost for its database. No need to worry about encryption there since everything is on the same box.

Going to a two tier or n-tier model where the application servers and the database servers reside on different hosts, the traffic may or may not need to be encrypted between them. If the hosts are all in the same rack sharing the same secured switch, or the traffic is on a trusted network, then there is no threat of packet sniffing.

This all changes the second you deploy to AWS or other cloud provider. Traffic between hosts goes across the cloud provider’s internal network. A cloud provider’s network is something you as a customer do not control, and in fact share with every other customer. When the underlying network is a shared resource, traffic sent between your servers should always be encrypted since you don’t know who might be listening.

It could be argued that unimportant data like system logs or metrics can be sent unencrypted. I agree, but it should be evaluated on a case by case basis.  Customer names, email addresses, account numbers, or other personally identifying information (passwords?!) do end up in log messages from time to time.

 

 

Posted in Sys Admin | Tagged , , , , | Comments Off