how to set-up SSL on google app engine (custom domain name ) - google-app-engine

Google just announced SSL support for custom domain but I can't understand how it can be set-up as there is no way to generate Certificate Signing Request (CSR) on GAE ?!
http://support.google.com/a/bin/answer.py?hl=en&hlrm=en&answer=2644386
Am I missing something ?

To expand on the above:
The following three steps should be sufficient to generate a private key and a self-signed certificate suitable for testing SSL on GAE on a linux box:
openssl genrsa -out yourdomain.com.key 1024
openssl req -new -key yourdomain.com.key -out yourdomain.com.csr
openssl x509 -req -days 365 -in yourdomain.com.csr -signkey yourdomain.com.key -out yourdomain.com.crt
Disclaimer: It works but I do not know what I'm doing

Various programs exist to create a Certificate Signing Request (CSR.) I used 'openssl' on a linux machine to generate the Key and CSR.
1) I generated an Unencrypted PEM encoded RSA private key as specified by Google's SSL for a Custom Domain (https://cloud.google.com/appengine/docs/ssl)
cd $HOME
openssl genrsa -out rsa_private_key.key 2048
2) Use the 'rsa_private_key.key' to generate the required Certificate Signing Request (CSR) file.
openssl req -new -key rsa_private_key.key -out request.csr
You will be asked the following questions:
Country Name (2 letter code) [AU]: US
State or Province Name (full name) [Some-State]: Illinois
Locality Name (eg, city) []: Chicago
Organization Name (eg, company) [Internet Widgits Pty Ltd]: Chicago Company, Ltd.
Organizational Unit Name (eg, section) []: IT
Common Name (eg, YOUR name) []: checkout.customedomain.com
Email Address []:
I ignored two additional questions and everything worked fine. The 'request.csr' located on your home directory ($HOME) is the CSR file needed by the Certificate Authority provider to generate your certificate(s). Again, it doesn't have to be openssl: Many tools for various platforms are supported by providers. Just keep in mind Google's requirements.
A side note regarding Custom Domains:
Make sure your CUSTOM DOMAIN includes a subdomain or 'Full Qualified Domain Name.' The 'www.' is considered a subdomain and it's ALWAYS required for ssl in Google Appengine (10/2014.) So in my example if I wanted SSL at customedomain.com I would add 'www.customedomain.com' You can re-direct your naked domain to your Full Qualified Domain Name.
Google Appengine DOES NOT provide SSL support for naked domains like: https://customedomain.com

This is reposted from my answer at:
How to get .pem file from .key and .crt files?
I was trying to go from godaddy to app engine. What did the trick was using this line in the terminal (mac) to generate the the key and csr:
openssl req -new -newkey rsa:2048 -nodes -keyout name.unencrypted.priv.key -out name.csr
Exactly as is, but replacing name with my domain name (not that it really even mattered)
Also, what follows that is a bunch of questions and I answered all the questions pertaining to common name / organization as www.name.com , and I skipped the pass code and company name by just pressing enter
Then I opened the .csr file, copied it, pasted it in go daddy's csr form, waited for godaddy to approve it, then downloaded it, unzipped it, navigated to the unzipped folder in the terminal and entered:
cat otherfilegodaddygivesyou.crt gd_bundle-g2-g1.crt > name.crt
Then I used these instructions from the post Trouble with Google Apps Custom Domain SSL, which were:
openssl rsa -in privateKey.key -text > private.pem
openssl x509 -inform PEM -in www_mydomain_com.crt > public.pem
exactly as is, except instead of privateKey.key I used name.unencrypted.priv.key, and instead of www_mydomain_com.crt, I used name.crt
Then I uploaded the public.pem to the admin console for the "PEM encoded X.509 certificate",
and uploaded the private.pem for the "Unencrypted PEM encoded RSA private key"..
.. And that finally worked.

You need to generate a certificate with a CA and upload it. They aren't offering certificate creation as a service.

Related

How do I provide correctly formatted certificate files to AppEngine?

I'm trying to setup SSL for a custom domain on appengine. The app is presently working fine with http on the custom domain.
My certificate provider asked me to use openssl to do the following:
openssl req -nodes -newkey rsa:2048 -keyout newkey.key -out newcsr.csr
This produced two new files, a .key and a .csr
I used the .csr in the process of creating the certificate and I have seen references to comodo so I am presuming they have provided the signing. My provider now gives me the option to download the certificate and an intermediate certificate. When I download the certificate, it is saved as a .crt file by Google Chrome.
The .key file begins with -----BEGIN PRIVATE KEY-----
The .crt file begins with -----BEGIN CERTIFICATE-----
AppEngine requires a cert file and a key file. I have tried two upload the .crt file and the .key file but no slots are used.
I have tried to convert the .crt to a PEM with:
openssl x509 -in certificate-xxxxx.crt -out mycert.pem -outform PEM
That gives me a .pem but that also fails to be accepted.
I'd appreciate any comments as not being a security expert I am flying blind here.
UPDATE -----
It seems that both my certificate and key file ARE in .pem format.
I thought that there was an issue with the key file since it began with -----BEGIN PRIVATE KEY----- rather than -----BEGIN RSA PRIVATE KEY----- but I was being led astray by older pages - see https://www.globalsign.com/blog/ssl-with-google-app-engine.html.
It seems the difference is just traditional format rather than PKCS8 format - see Convert pem to key, SSL virtual host apache redhat aws
Interestingly, now when loading my cert file and key file, I get an error of 'Both the private key and SSL certificate should be in unencrypted PEM format'. I am wondering whether the issue is to to with being encrypted or whether as the certificate provider was not Comodo that I need to incorporate an interim certificate as well somehow.
RESOLVED ----
The key file was in PEM format but not RSA. I used:
openssl rsa -in newkey.key -out newkey.pem
and the files are now accepted by Google.
The newkey.pem file starts with -----BEGIN RSA PRIVATE KEY----- so clearly you need this for it to be accepted by Google.
I followed a similar approach and succeeded.
The difference is my key file begins with:
-----BEGIN RSA PRIVATE KEY-----
I used this line to generate the key and csr:
openssl req -new -newkey rsa:2048 -nodes -out mydomain.com.csr -keyout mydomain.com.key -subj "/C=FR/ST=Essonne/L=Paris/O=MyCompany/CN=mydomain.com"
I suppose you tried to import it on ? :
https://admin.google.com/yourdomain.com/AdminHome?fral=1#SecuritySettings:flyout=ssl
I hope that will help you.

Check if connection exists to a flat database in Matlab

I have used Postgres and love its way to handle the database connection.
I have to use now Matlab and Physionet's flat database system to retrieve data.
However, I do not understand the logic in some cases, like in ptbdb.
How can you check if a connection exists to a database in Matlab?
How can you monitor what the system is doing when connecting to the database?
It would be very nice to be able to ping the system or something like that to know what is the problem. I get no information now what is the problem.
My connection was disconnected continuously because it was not secure.
The topic is about secure connection between Matlab and PostgreSQL, which is undocumented widely, for instance, discussed here about Secure SSL connection between Matlab and PostgreSQL.
Summary of the blog post
Make appropriate changes in
Generate certificate for the server; diseserver.csr, root.crt; postgreSQL directry (diseserver.key, diseserver.crt, and root.crt); please see more precisely here
postgresql.conf
pg_hba.conf
generate client certificates
convert key to pkcs8 format
check correct version of JDBC driver
check client certificate
dbtest.m
Certificate for the server
$openssl req -out diseserver.csr -new -newkey rsa:2048 -nodes -keyout diseserver.key
postgresql.conf
ssl = on
ssl_cert_file = 'diseserver.crt' # (change requires restart)
ssl_key_file = 'diseserver.key' # (change requires restart)
ssl_ca_file = 'root.crt' # (change requires restart)
pg_hba.conf
hostnossl all all 0.0.0.0/0 reject
hostssl mytable all 0.0.0.0/0 cert map=ssl clientcert=1
Generate client certificates
$mkdir ~/.postgresql
$cd ~/.postgresql
$openssl req -out postgresql.csr -new -newkey rsa:2048 -nodes -keyout postgresql.key
Convert key to pkcs8 format
$openssl pkcs8 -topk8 -inform PEM -outform DER -in postgresql.key -out postgresql.pk8 -nocrypt
Check client certificate
jdbc:postgresql://diseserver.mydomain.org/mytable?ssl=true&sslfactory=org.postgresql.ssl.jdbc4.LibPQFactory&sslmode=verify-full&
dbtest.m matlab function
function dbtest
driver = 'org.postgresql.Driver';
[~,username] = system('whoami');
url = 'jdbc:postgresql://diseserver.mydomain.org/mytable?ssl=true&sslfactory=org.postgresql.ssl.jdbc4.LibPQFactory&sslmode=verify-full&';
myconn = database('mytable', username, '', driver, url);
if ~isempty(myconn.Message)
fprintf(2,'%s\n', myconn.Message);
else
fprintf(1, 'Connected!\n');
end
end

Trying to get an SSL certificate from Comodo to work for Google App Engine [duplicate]

I'm currently inside the 30-day free trial for Google Apps for business (billing set up, so will start non-free trial soon). I'm attempting to set up SSL for a custom domain for a Google App Engine app, but am a bit of a noob at this stuff and the files I've accumulated aren't accepted by the Apps submission form.
I went through the following process:
openssl req -out CSR.csr -new -newkey rsa:2048 -nodes -keyout privateKey.key
After filling in the cert. request information (with name www.mydomain.com), I had the two files CSR.csr and privateKey.key.
I used an SSL provider CheapSSLs.com to provide me with a certificate off this CSR.csr, and they've responded with a cert www_mydomain_com.crt.
However, on going through Google Apps Dashboard -> Security -> SSL for Custom Domains and uploading www_mydomain_com.crt and privateKey.key I'm given the error:
Both the private key and SSL certificate should be in unencrypted PEM format.
Any help? As far as I can tell, they are in that format: the private Key looks like:
-----BEGIN PRIVATE KEY-----
MIIEv...
...
...CftTU=
-----END PRIVATE KEY-----
and the .crt file looks like:
-----BEGIN CERTIFICATE-----
MIIFy...
...
...WJjk=
-----END CERTIFICATE-----
This was answered by a friendly member of the community and then immediately deleted (not sure why...) but not before I spotted his answer and used it, to great effect :)
openssl rsa -in privateKey.key -text > private.pem
openssl x509 -inform PEM -in www_mydomain_com.crt > public.pem
The above two commands produce private.pem and public.pem, which are accepted fine by Google Apps dashboard.
Thank you!
For me, it was because my private.key was in the wrong format.
If your key starts with ---BEGIN PRIVATE KEY--- then you need to convert it to an RSA key.
openssl rsa -in private.key -out private_rsa.key
Then you should see ---BEGIN RSA PRIVATE KEY--- at the beginning of the private_rsa.key which you use with GAE.
Generate a new 2048-bit RSA key:
openssl genrsa -out myServer.key 2048
Convert an existing key to RSA:
openssl rsa -in myServer.key -out myServer-rsa.key

Trouble with Google Apps Custom Domain SSL

I'm currently inside the 30-day free trial for Google Apps for business (billing set up, so will start non-free trial soon). I'm attempting to set up SSL for a custom domain for a Google App Engine app, but am a bit of a noob at this stuff and the files I've accumulated aren't accepted by the Apps submission form.
I went through the following process:
openssl req -out CSR.csr -new -newkey rsa:2048 -nodes -keyout privateKey.key
After filling in the cert. request information (with name www.mydomain.com), I had the two files CSR.csr and privateKey.key.
I used an SSL provider CheapSSLs.com to provide me with a certificate off this CSR.csr, and they've responded with a cert www_mydomain_com.crt.
However, on going through Google Apps Dashboard -> Security -> SSL for Custom Domains and uploading www_mydomain_com.crt and privateKey.key I'm given the error:
Both the private key and SSL certificate should be in unencrypted PEM format.
Any help? As far as I can tell, they are in that format: the private Key looks like:
-----BEGIN PRIVATE KEY-----
MIIEv...
...
...CftTU=
-----END PRIVATE KEY-----
and the .crt file looks like:
-----BEGIN CERTIFICATE-----
MIIFy...
...
...WJjk=
-----END CERTIFICATE-----
This was answered by a friendly member of the community and then immediately deleted (not sure why...) but not before I spotted his answer and used it, to great effect :)
openssl rsa -in privateKey.key -text > private.pem
openssl x509 -inform PEM -in www_mydomain_com.crt > public.pem
The above two commands produce private.pem and public.pem, which are accepted fine by Google Apps dashboard.
Thank you!
For me, it was because my private.key was in the wrong format.
If your key starts with ---BEGIN PRIVATE KEY--- then you need to convert it to an RSA key.
openssl rsa -in private.key -out private_rsa.key
Then you should see ---BEGIN RSA PRIVATE KEY--- at the beginning of the private_rsa.key which you use with GAE.
Generate a new 2048-bit RSA key:
openssl genrsa -out myServer.key 2048
Convert an existing key to RSA:
openssl rsa -in myServer.key -out myServer-rsa.key

SSL google app engine

In order to enable SSL in Appengine.
I try to enable SSL for my custom domain
So far I found this article:
setup SSL on AppEngine... Assigned URLs "empty"
openssl genrsa -out rsaprivkey.pem 1024
openssl req -new -x509 -key rsaprivkey.pem -out dsacert.pem
then I uploaded the generated .pem to google app SSL setting page
dsacert.pem > PEM encoded X.509 certificate
rsaprivkey.pem > Unencrypted PEM encoded RSA private key
However, I got this error message after Upload.
What should I do next?
Domain name in certificate should only contain allowed characters (RFC
1034).
Solve!
It this article
setup SSL on AppEngine... Assigned URLs "empty"
when open ssl asks you questions for your app's name, make sure to
include the entire url as in your answer, www.abc.com to secure
https://www.abc.com
But I didn't find any place to enter my app's name during the openssl pem generation at first.
finally I find out the domain should be filled in organization and common name fields.
http://www.rackspace.com/knowledge_center/article/generate-a-csr-with-openssl
Organization Name (eg, company) [Internet Widgits Pty Ltd]: > example.com
Common Name (eg, YOUR name) > *.example.com

Resources