Commit Graph

8 Commits

Author SHA1 Message Date
mpl c55c8602d3 server/camlistored: use Let's Encrypt
Or to be more precise, golang.org/x/crypto/acme/autocert

The default behaviour regarding HTTPS certificates changes as such:

1) If the high-level config does not specify a certificate, the
low-level config used to be generated with a default certificate path.
This is no longer the case.
2) If the low-level config does not specify a certificate, we used to
generate self-signed ones at the default path. This is no longer always
the case. We only do this if our hostname does not look like an FQDN,
otherwise we try Let's Encrypt.
3) As a result, if the high-level config does not specify a certificate,
and the hostname looks like an FQDN, it is no longer the case that we'll
generate a self-signed. Let's Encrypt will be tried instead.

To sum up, the new rules are:
If cert/key files are specified, and found, use them.
If cert/key files are specified, not found, and the default values,
generate them (self-signed CA used as a cert), and use them.
If cert/key files are not specified, use Let's Encrypt if we have an
FQDN, otherwise generate self-signed.

Regarding cert caching:

On non-GCE, store the autocert cache dir in
osutil.CamliConfigDir()/letsencrypt.cache
On GCE, store in /tmp/camli-letsencrypt.cache

Fixes #701
Fixes #859

Change-Id: Id78a9c6f113fa93e38d690033c10a749d1844ea6
2016-12-05 19:43:37 +01:00
mpl 65343d114d pkg/server/app: improve app handling
These improvements on the server app handler should help writing
and running stand-alone apps.

The two main goals are:
1) "simple" configurations should work automatically; the parameters for
the app are derived from the Listen and BaseURL of the Camlistore
server.
2) More advanced configurations, such as being behind a proxy, should be
easily configurable through the app's Listen, BackendURL, and ApiHost
parameters.

I had worked on them while doing the scanning cabinet app, and I am
backporting them now since we haven't landed the scanning cabinet yet,
and people have been having trouble setting up the publisher.

pkg/app/app_test.go is gone because app.ListenAddress is now dumb. The
hard work is done in pkg/server/app instead.

Fixes #818

Change-Id: Ice2610d6bac611b209cc3a928e67fa6093a41d3e
2016-07-04 22:21:16 +02:00
Brad Fitzpatrick 4fb9595587 netutil: add func ListenHostPort 2015-12-26 13:32:49 -08:00
Brad Fitzpatrick 76405b796c netutil: minor doc and style tweaks
Change-Id: I9c5706d62dc7c56785c95a444cc2bb3da1d8e571
2014-11-23 07:43:09 -08:00
Antonin Amand 87e6815d62 netutil additions
Adds ListenOnLocalRandomPort and make Localhost more robust.

Change-Id: Id6416f7ae5c35fb247035ecb0021f3978ff3480e
2014-11-09 11:53:47 +01:00
mpl 0a869ad067 netutil: add HostPort, serverinit: return app baseURL
Context: http://camlistore.org/issue/479

This patch allows camlistored to wait for all the apps to be serving,
before printing its own listening address.

Change-Id: I4035b115a03ef6a2a43177b83b5b65ebc50a2188
2014-08-01 00:01:27 +02:00
mpl 955cd34404 dockertest: skip test when DB in container not ready
http://camlistore.org/issue/474

Change-Id: Id65b3c35a2f38466c4d7370bad4c5f73a8cb22db
2014-07-17 18:09:02 +02:00
Brad Fitzpatrick dd03756f07 netutil: add little AwaitReachable func
Change-Id: I52af3add776cd57ca91c073e0ec563c50923d40f
2014-02-09 19:55:36 -08:00