Overview
Currently we are using node.js 0.4.9 and Openssl. You may need to download and install openssl.
Installation of Required Software
- Download the node.js 0.4.9 tar file, unpack it. Running a newer version? Here is how to downgrade.
- Navigate to the download folder to make and install node.
- ./configure
- make
- sudo make install
Certificate Installation
These certificates are used to proxy to the test server using your credentials.
- Go to Firefox/Preferences/Advanced/Encryption/View Certificates and click on your certificate and click the Backup button. In the Save Dialog box, save your certificate as a pks12 (.p12) file in your server directory (neatest if you save it in a cert subdirectory).
- Using your terminal, CD to the cert subdirectory.
- Create a .pem file: openssl pkcs12 -nodes -in yourcert.p12 -out yourcert.pem
Now remove the password from your .pem file this way: openssl rsa -in yourcert.pem -out yourcertNoPassword.pem
From the Authorities tab in FF, e
xport and save the "MIT Certification Authority..." certification to a file name mitCA.pem in /zend_framework/public/server
/certs folder
.
- If using the older proxy only, {{put the correct paths to your certs in the proxy.js file (roughly lines 21-23 / see example below).}}Proxy.js example:
var KEY = fs.readFileSync('./certs/yourcert.pem').toString(); var CERT = fs.readFileSync('./certs/yourcertNoPassword.pem').toString(); var CA = fs.readFileSync('./certs/mitCA.pem').toString();
Install Required Node Module Dependencies
- Navigate to /zend_framework/public/server/
- Execute npm (node package manager) which will read the package.json file and install the listed dependencies.
- npm install
Configure auth.json
Old Method:
Create /zend_framework/public/server/auth.json with your username and password in the following format, substituting your actual credentials:
{ "username": "jresig", "password": "jQuery2006" }
New Method:
Edit /zend_framework/public/server/auth_yours.json and rename this file to auth_me.json or whatever you like:
{ "what_do_I_do_with_this_file": "Rename this file to auth_me.json or whatever you like then reference it on the command line with the '-a' parameter", "keyFile": ".pem file containing your key", "certsFile": ".pem file containing your cert with password removed", "caFile": "certs/mitCA.pem" }
Testing The Local Server
Old Method:
- Navigate to zend_framework/public/server
- Start the server via command ./bin/mitserv
New Method:
- Navigate to zend_framework/public/server
- Start the server via command node bin/mitserv.js -a auth_me.json
Possible Issues
- Issue:
- Proxy starting but never returning
- Fix:
- Make sure you're connecting using either the MIT N or MIT SECURE N wireless network
- Issue:
- Seeing GET http://localhost:8080/rest/v1/user/auth 403 (Forbidden)
- With body content including: "SyntaxError: Unexpected token ILLEGAL"
- Fix: The Apache server needs to include the username
- Issue:
- Error: EBADF, Bad file descriptor './certs/hij1nx.pem'
- Fix:
- The certs are missing and/or misconfigured. See the section on installing certificates.
1 Comment
Unknown User (tomservo@mit.edu)
The line:
throws an exception:
Error opening Private Key yourcertNoPassword.pem
3572:error:02001002:system library:fopen:No such file or directory:.\crypto\bio\bss_file.c:398:fopen('yourcertNoPassword
.pem','rb')
3572:error:20074002:BIO routines:FILE_CTRL:system lib:.\crypto\bio\bss_file.c:400:
unable to load Private Key
I think this is because the -in and -out need to be reversed.
When I fixed this the key was generated correctly.