Fix message framing for protobuf parsing

Add buffered reading and parsing of protobufs when the log level is set
to debug or silly. The response path always uses this mode as it is not
performance sensitive. The request path retains direct byte passthrough
behavior for high performance if the log level is lower than debug.

Change-Id: I1596eb8db08b220add98dd4ec7eb073a1903777f
Increase strength of session token generation

Previously used the uid2 package to create session tokens. The last
patch of uid2, in its infinite wisdom, replaced using
crypto.randomBytes with crypto.pseudoRandomBytes completely destroying
the security value of the ids it generates.

Replace use of the uid2 module with our own code that directly uses
crypto.randomBytes. Also handles the case where randomBytes returns
an error indicating there wasn't enough entropy in the pool to generate
a full length token.

Change-Id: I1a75297254f4bcf9e1257b954d5e46fdb0e43ccc
Specify strong TLS cipher list

* Add list of strong ciphers to use for TLS. Not all are usable in
  Node 0.10.x.
* The secureProtocols options does not allow mandating TLS 1.2 only in
  Node 0.10.x either. But it does prefer 1.2 over 1.1 over 1.0.
* Make including the PAM module optional based on the use_pam config
  file options. Won't crash now if the module didn't install correctly.
* Change test cert generation script to 2048-bit keys

Change-Id: I8f73f657a7a24ea63a43fd348a55a539c12afadd
Added volume create support to CLI

Note changes in package.json to use custom pkgcloud as well as new
config for vm/volume creation

Change-Id: Ic6727ff8a9de209d538a8d2abec2378a38092f69
User data volume management and start of auto VM creation

* Uses promises in more places
* White space cleanups in several files

Change-Id: Ie956591b8bc353f4ab1c16e4b195cd3c4ca8ff50
Destroy idle VMs after some period of time

NOTE: If you have an existing database, you need to discard the TTL
index; the easiest way is to drop the 'sessionmodels' collection.

Fixed issue with proxy sockets that sometimes caused client socket
to stay open when it should close.
Changed how proxy handles and removes sessions (no longer uses
MongoDB TTL index).
Now session 'lastAction' state is used to determine VM idle time.
Added interval to terminate expired VMs (those that have been idle
for too long), remove the associated session, and remove the user's
VM information.

Change-Id: I7fd8487957a8c83d8a7d2a60436a25b71fb22f96
Complete automatic VM creation on login

* Finished post-login process
* Error handling improvements
* Documented many functions
* Code cleanups & dead code removal

Change-Id: I6582db00793a4884357a3dd82dfafdd4797ce660
Added flavors to cli and fixed console error

Now the cli returns all the flavors available
Fix missing require in setupuser

Change-Id: I065111932e9282df47d1b534204d929c5d082a88
Update package.json

* Change package name to svmp-server
* Add some additional data fields
* Make authenticate-pam an optional dependency

Change-Id: Ied09427799c2416ae317d03fe2f708cf3b1ee9b5
Added device_type support for users and images

Changed users module to require a device type when creating a user.
Changed cli module to require a device type when creating a user,
and added command to list supported device types.
Changed config schema and example file to use openstack.images
object to store device types and image IDs in key/value format.
Changed setupuser module to use image ID based on device type.
Changed user module and cli clear-vm-info command to set the user's
vm_ip and vm_id to undefined; they must be undefined for the
setupuser module to create a new VM when that user logs in.

Change-Id: I56a8b839410b8e479ceda06f74c88f78be1b1972
Updates for destroying VMs

Fixed error in openstack destroyVM function to refer to the
correct client, which was updated elsewhere in a previous commit.
Changed users removeUserVM function to fail on users that have no
vm_id defined, those are users whose vm_ip was manually assigned.

Change-Id: I22d0813bc759cd3f891c74c82ad9bde8c39a723b
Updates for automatic VM creation

Separated automatic VM creation from authentication (now happens
during VMREADY_WAIT state in proxy).
Updated setupuser module to prevent creating VMs for users who
have a manually assigned vm_ip.
Updated openstack module to use correct private address field, and
to clean up (destroy) a VM if a creation resulted in an error.

Change-Id: I06b175f07a60c60ae682517f50437de10a56c6ae
Update our fork of pkgcloud

Changed package.json to point to updated fork of pkgcloud.
Updated example config and schema to require the
settings.openstack.region option, pkgcloud now throws an error if
it is not defined.

Change-Id: Ie26021cb1b3d827f7914f34f87218347aa11ee00
Updated pkgcloud branch name

SVMP pkgcloud branch has a new name that makes more sense.

Change-Id: I3b7bf2cb6f22d8b793b645719d456c336dd11d0c
Fixed users.removeUserVM bug

Fixed bug where expired VMs would not be removed properly.
Added VM IP to result object from removeUserVM function.
Changed flow when destroying expired VMs

Updated users.destroyVM function, removed portion that finds a
user and is now used in conjunction with users.findUser.
Changed flow when creating VMs

Added failsafe to destroy VM if volume attachment errors out.
Changed flow to save user info after VM creation subtasks are
completed.
Added configuration option to use floating IPs

If enabled, the server will attempt to allocate and assign a
floating IP to each VM it creates.
Otherwise, the server will use the VMs fixed IP address instead
(used only if the server is running within OpenStack).
Changed example config file and schema file.
Updated VM creation flow to allocate and assign a floating IP after
volume attachment.
Updated VM deletion flow to de-allocate a floating IP after VM
deletion.
Updated VM creation check for fixed IP; now checks for either
private IP or public IP.
Changed flow when destroying VMs again

Updated openstack.destroyVM to include floating IP de-allocation.
Added verbose log messages throughout openstack module.
Abstracted VM destruction/promise rejection process.
Updated proxy.js to reflect openstack simplification.