diff --git a/.gitignore b/.gitignore index 97a9ecf7..7b1dfa53 100644 --- a/.gitignore +++ b/.gitignore @@ -18,7 +18,7 @@ app/tests/coverage/ # MEAN.js app and assets # ====================== -config/sslcert/*.pem +config/sslcerts/*.pem access.log # Sublime editor diff --git a/README.md b/README.md index 5561c4fb..0c85e062 100644 --- a/README.md +++ b/README.md @@ -104,10 +104,10 @@ $ docker run -p 3000:3000 -p 35729:35729 -v /Users/mdl/workspace/mean-stack/mean ## Running in a secure environment To run your application in a secure manner you'll need to use OpenSSL and generate a set of self-signed certificates. Unix-based users can use the following commnad: ``` -$ sh generate-ssl-certs.sh +$ sh ./scripts/generate-ssl-certs.sh ``` Windows users can follow instructions found [here](http://www.websense.com/support/article/kbarticle/How-to-use-OpenSSL-and-Microsoft-Certification-Authority) -To generate the key and certificate and place them in the *config/sslcert* folder. +To generate the key and certificate and place them in the *config/sslcerts* folder. ## Getting Started With MEAN.JS You have your application running but there is a lot of stuff to understand, we recommend you'll go over the [Official Documentation](http://meanjs.org/docs.html). diff --git a/config/env/secure.js b/config/env/secure.js index ee2b270a..8ce09a50 100644 --- a/config/env/secure.js +++ b/config/env/secure.js @@ -1,7 +1,7 @@ 'use strict'; module.exports = { - port: 443, + port: 8443, db: process.env.MONGOHQ_URL || process.env.MONGOLAB_URI || 'mongodb://localhost/mean', log: { // Can specify one of 'combined', 'common', 'dev', 'short', 'tiny' diff --git a/generate-ssl-certs.sh b/scripts/generate-ssl-certs.sh similarity index 59% rename from generate-ssl-certs.sh rename to scripts/generate-ssl-certs.sh index fda44bb0..5caaaa9a 100644 --- a/generate-ssl-certs.sh +++ b/scripts/generate-ssl-certs.sh @@ -1,5 +1,15 @@ #!/bin/bash + +if [ ! -e server.js ] +then + echo "Error: could not find main application server.js file" + echo "You should run the generate-ssl-certs.sh script from the main MEAN application root directory" + echo "i.e: bash scripts/generate-ssl-cers.sh" + exit -1 +fi + echo "Generating self-signed certificates..." +mkdir -p ./config/sslcerts openssl genrsa -out ./config/sslcerts/key.pem -aes256 1024 openssl req -new -key ./config/sslcerts/key.pem -out ./config/sslcerts/csr.pem openssl x509 -req -days 9999 -in ./config/sslcerts/csr.pem -signkey ./config/sslcerts/key.pem -out ./config/sslcerts/cert.pem