Skip to content

Commit

Permalink
Make the sample server use SSL.
Browse files Browse the repository at this point in the history
There's one problem: the sample wget --post-file command hangs.
  • Loading branch information
mgedmin committed Sep 4, 2008
1 parent 7997552 commit f6aa225
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 3 deletions.
8 changes: 5 additions & 3 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ To get started do::
The server will come up on port 8080. You can create a new key encrypting key
using::

$ wget http://localhost:8080/new -O kek.dat
$ wget https://localhost:8080/new -O kek.dat --ca-certificate sample.pem

The data encryption key can now be retrieved by posting the KEK to another
URL::

$ wget http://localhost:8080/key --post-file kek.dat -O datakey.dat
$ wget https://localhost:8080/key --post-file kek.dat -O datakey.dat --ca-certificate sample.pem

Note: To be compliant, the server must use an encrypted communication channel
of course.
of course. The ``--ca-certificate`` tells wget to trust the sample self-signed
certificate included in the keas.kmi distribution; you'll want to generate a
new SSL certificate for production use.
1 change: 1 addition & 0 deletions buildout.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ recipe = zc.recipe.egg
eggs = Paste
PasteScript
PasteDeploy
pyOpenSSL
zope.app.component
zope.app.publication
zope.app.publisher
Expand Down
6 changes: 6 additions & 0 deletions generate-sample-cert.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
openssl genrsa 1024 > sample.key
openssl req -new -x509 -nodes -sha1 -days 3650 -key sample.key > sample.cert
cat sample.cert sample.key > sample.pem
rm sample.key sample.cert

31 changes: 31 additions & 0 deletions sample.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
-----BEGIN CERTIFICATE-----
MIICcTCCAdqgAwIBAgIJAMvA30EY1rKtMA0GCSqGSIb3DQEBBQUAMDAxCzAJBgNV
BAYTAlVTMQ0wCwYDVQQKEwRLZWFzMRIwEAYDVQQDEwlsb2NhbGhvc3QwHhcNMDgw
OTA0MTU1MTU5WhcNMTgwOTAyMTU1MTU5WjAwMQswCQY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mOUlD5M48xTROJXteDQ0TECQQDuDM9pmQdqkGIp
dvbIviS8donYn0kJ0TKS14pMtb/C63lcld513rHS43ru3FRY9baR/q5vV9vW5RhH
S7w4cYvVAkEA2iNLsFEAkY88oZJYbdyybeKxZdReyes1/zPe4RYzRdbDHRNAa+zk
mZIZDI820E0Y+DeoT+q3nXkXiiOS/iRNDQJBAKdAvOH2sO1AcJetjArS/cCkkIlw
sMKDB0OAyRzIfekXxPc2HU03oD0Jsy/sAh9W1GWTST/VvRIpeHtvTNljfdkCQF5T
UuBcNoW6zXoEYU6oV1Oi6hjhW1eu6PuAv4jPY754XoiNEZdZqYQqo8BFkWtDW1/C
GXrtQRbMDPzD40UYB2UCQQCmJpJp+u2lHj7zuZikHIHQBNyXyoGnzgNs6XUj1Bs6
Y4vjue8w6RkRLZ1YGP+xqsngVqb9IRygyLDpEgwEnOT4
-----END RSA PRIVATE KEY-----
1 change: 1 addition & 0 deletions server.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ conf=zope.conf
use = egg:Paste#http
host = 0.0.0.0
port = 8080
ssl_pem = sample.pem

0 comments on commit f6aa225

Please sign in to comment.