Commit Graph

6314 Commits

Author SHA1 Message Date
mpl d96bdbdf41 misc/docker/go: go1.8rc2
Change-Id: I4086f506841722e085f302c9578d558c9a4fb2d9
2017-01-19 23:18:57 +01:00
Mathieu Lonjaret bb969d47ec Merge "publisher: support case when published top node is not a set" 2017-01-19 21:44:23 +00:00
Mathieu Lonjaret e6cb7e372e Merge "make: fix version check for go1.8beta and go1.8rc" 2017-01-19 16:39:30 +00:00
Tamás Gulácsi 6fe477614d make: fix version check for go1.8beta and go1.8rc
CAMLI_GOPHERJS_GOROOT has effect only if verifyGopherjsGoroot is called,
which only happened if go version was "devel".

This CL runs the verifyGopherjsGoroot check for go1.8rc and go1.8beta
versions too.

Change-Id: I7c80976d46ce8d69e394d226c685c8554176ea0f
2017-01-19 17:35:27 +01:00
mpl eba4897843 publisher: support case when published top node is not a set
In other words, when on the camliRoot node, there is an attribute such
as:

camliPath:foo = sha1-foo

Where sha1-foo is a permanode that is not a set (i.e. it does not have
camliMembers or camliPaths), and typically is a permanode with some
camliContent.

Change-Id: Ib827130bb2456c4c0d7bfb40e40a425515ee1bde
2017-01-19 16:47:23 +01:00
Mathieu Lonjaret 5cf7f95f7e Merge "publisher: change http status and message when serving root" 2017-01-19 15:01:47 +00:00
Attila Tajti 2763ac0371 publisher: change http status and message when serving root
Instead of reporting "404 not found" make it clear
publisher is working, but needs an explicit path.

Change-Id: Ic686b82335ba36e0649dd563831b1221a8579e0d
2017-01-19 05:11:28 +01:00
Mathieu Lonjaret 6c7d0d0478 Merge "doc: explain how publisher paths work with permanodes" 2017-01-18 22:17:47 +00:00
Mathieu Lonjaret f12b9fea60 Merge "pkg/deploy: no self-signed certs, name in camlistore.net" 2017-01-18 21:40:49 +00:00
Mathieu Lonjaret 8a17e7252b Merge "pkg/sorted/mysql: drop tables on reindex" 2017-01-18 18:14:06 +00:00
Attila Tajti c275aed960 doc: explain how publisher paths work with permanodes
Change-Id: I7ddf1c5f2bc93961fbadba978e65819c0bdf5b24
2017-01-18 18:51:08 +01:00
mpl 668ca69967 pkg/osutil: remove dependency on pkg/env
pkg/osutil started depending on pkg/env in
c55c8602d3 , when we added
DefaultLetsEncryptCache(), because it behaves differently whether we're
on GCE or not.

This in turn made pkg/osutil depend on
cloud.google.com/go/compute/metadata and a couple of others. This, in
itself, was not so bad since the main user of pkg/osutil,
server/camlistored already depends on all these same dependencies
anyway.

However, pkg/types/camtypes depends on pkg/osutil (although maybe it
shouldn't) because it calls osutil.UserClientConfigPath() for an error
message.

And finally, in app/publisher/js - which is some Go code meant as input
for gopherjs, so that it gets compiled into javascript that we include
in the publisher web page - we depend on pkg/types/camtypes for some
search query results.

So as of c55c8602d3, we "leaked" a couple
of additional and unnecessary dependencies into the gopherjs generated
code. That made the minified output unnoticeably grow, and apparently
had no other adverse effect, so we didn't notice.

That is, until we landed b0b6a0a89e, which
updated a ton of vendored dependencies, most of them in
cloud.google.com/go and google.golang.org/api. And interestingly, the
update made cloud.google.com/go/compute/metadata depend on a lot of
these other dependencies. This had two noticeable consequences:

1) The (unminified) generated js code grew from 6.1M to 8.2M, which in
itself is super bad already.

2) The js code actually stopped working. For some reason (that I can't
explain, and will probably leave to the GopherJS devs if they're
interested), the members/functions that we export to the javascript
namespace with gopherjs (typically with a
js.Global.Set("ExportedNameForFoo", FooFunc)), are not visible anymore,
which of course breaks everything.

Therefore, this CL fixes this issue by simply doing what we knew we
should have done from the start:

we now let pkg/osutil/gce (which already depends on pkg/env) itself
register a LetsEncryptCacheFunc into pkg/osutil, which removes the need
for pkg/osutil to depend on pkg/env.

Change-Id: Ie8f33e9cb873919dd1728068dd8a5d0170282f88
2017-01-18 01:23:34 +01:00
Mathieu Lonjaret abc6561c60 Merge "server: add missing defer in sync handler" 2017-01-16 21:08:41 +00:00
mpl 2b7a14d835 server: add missing defer in sync handler
Change-Id: I69a74f62d171dc413bb08065ea73af2c694cebcc
2017-01-16 22:07:17 +01:00
Mathieu Lonjaret 7e7046db6d Merge "app/publisher: do not show all published nodes at root" 2017-01-16 18:26:00 +00:00
mpl b11b301da5 app/publisher: do not show all published nodes at root
Also, trim request path suffix, so that /pics/foo/ is treated as
/pics/foo

Fixes #882

Change-Id: Ib943b1ab49dad3b463eea0157ad77d3df8515efa
2017-01-16 19:25:06 +01:00
mpl af77128123 pkg/sorted/mysql: drop tables on reindex
When reindexing on a (My)SQL based sorted.KeyValue, we should recreate
the database schema from scratch, which means dropping the tables.

However, index.Reindex just calls Wipe on the newly created
sorted.KeyValue, which only deletes the rows, and does not drop the
tables.

Therefore, this CL changes the implementation of Wipe in the MySQL case,
so that it takes care of dropping the tables, and doing everything that
needs to be done afterwards to set up the sorted.KeyValue.

In addition, with the introduction of the sorted.NeedWipeError, we detect
upon initialization of a sorted.KeyValue if it failed because it needed
a schema update. If that is the case, and we're in reindex mode, we can
fix the sorted.KeyValue with a Wipe and carry on.

Finally, we introduce the new sorted.NewKeyValueMaybeWipe function that
automatically wipes a KeyValue when a NeedWipeError was returned upon
its creation.

Next, do the same with other sorted SQLs.

Fixes #806

Change-Id: I2032781cbf453a364880bd3e2e8b3c09aac7aed9
2017-01-16 19:10:05 +01:00
mpl 8813375592 pkg/deploy: no self-signed certs, name in camlistore.net
This CL changes the GCE launcher to work with the new features of
camlistored: i.e. that it can automatically get a hostname in
camlistore.net, and that it can get an HTTPS certificate from Let's
Encrypt, for said hostname.

In order for the user to easily (without having to look at the logs)
know what their hostname is, camlistored stores it as the
"camlistore-hostname" key in the custom metadata of the GCE instance.
The deployer can then query for that key, to report the hostname on the
instance creation success page.

Change-Id: Iaaef2d51f34fa5e1e0ee90097919abab7ee72a12
2017-01-13 16:47:04 +01:00
Mathieu Lonjaret d864e35802 Merge "server/camlistored: request a name in camlistore.net" 2017-01-13 14:50:31 +00:00
mpl 620388bd57 server/camlistored: request a name in camlistore.net
In order to use HTTPS, one must have a certificate, and one must have a
domain name for which the certificate is valid.
The first part is solved by the use of Let's Encrypt. For the second
part, we want to provide to any Camlistore instance a name such as
<gpgKeyId>.camlistore.net, where gpgKeyId is the fingerprint of its GPG
key. The DNS for camlistore.net agrees to add a record for that name if
and only if the Camlistore instance can prove it owns the GPG key, as
well as the IP address bound to that name in the DNS record.

A protocol such as the above is already implemented in pkg/gpgchallenge.

This CL:
- uses the client-side of the gpgchallenge protocol in camlistored, so
that it can claim a hostname in camlistore.net on startup (and then use
that hostname when requesting a certificate from Let's Encrypt).
- adds the configuration parameter "CamliNetIP" for the high-level
config. This parameter specifies the IP address that camlistored will
supply during the gpgpchallenge, so it can  prove to the DNS server that
we own this address.

Fixes #722

Change-Id: I6bf4ec149b6dffd0ae93a6fa7bf208b2e8a05445
2017-01-13 00:43:24 +01:00
Brad Fitzpatrick e4af22ca10 Merge "make.go: allow dots in mirrored filenames" 2017-01-12 05:47:08 +00:00
mpl b0b6a0a89e vendor: update go4.org/wkfs/gcs
Requires updating vendor/cloud.google.com/go/storage because of the
BucketHandle.List removal, which in turns triggers a bunch of other
updates or additions.

cloud.google.com/go/internal/optional
cloud.google.com/go/storage
at rev 641b1469e744485a8e6235bffc3b7bf366758a85

github.com/googleapis/gax-go
at rev da06d194a00e19ce00d9011a13931c3f6f6887c7

google.golang.org/api/*
at rev f7e067168bd43883b2156f16b6c2fd91beec76e2

Fixes #884

Change-Id: I7e27a24fa2ffbb747e66bde0d10dabaad1ac60d6
2017-01-05 16:58:18 +01:00
mpl 3e93b66765 make.go: allow dots in mirrored filenames
Fixes #887

Change-Id: I4274f422b417f1f7fd08fe9eea058974455a8895
2017-01-02 22:28:45 +01:00
Brad Fitzpatrick fb21eee1e9 cmd/camtool: add sync flags to dump config and control sync concurrency
Change-Id: If94f9bc60ed6dc902a0a924801f5cfec8e787a02
2016-12-20 23:09:53 -08:00
Mathieu Lonjaret fbf9f3747e Merge "server/camnetdns: get certificate from Lets Encrypt" 2016-12-17 22:56:37 +00:00
mpl b0eefd74fa server/camnetdns: get certificate from Lets Encrypt
Change-Id: Icd67eca36a153fe142d07b39df9ace6ef8301992
2016-12-17 23:38:40 +01:00
Mathieu Lonjaret d29e05d610 Merge "pkg/gpgchallenge: expose the clients handler" 2016-12-17 22:07:56 +00:00
mpl 896c8cda74 pkg/gpgchallenge: expose the clients handler
The Client used to start its own listener and http server, so it could
receive the Server's challenge. However, that design does not work when
the Client must be used in an application that is already an http(s)
server.

Therefore, this change adds a Handler method to the Client, that returns
the Client's handler, as well as the pattern it should registered for
with an HTTPS server. This means, it is now the responsibility of the
caller to setup the listener for the Client before the Challenge can be
started.

Change-Id: I160e21c470322f7acad209ac28a15eaeed36c2c4
2016-12-17 20:40:03 +01:00
Mathieu Lonjaret 6f0d22cac8 Merge "doc: TLS certificate configuration" 2016-12-17 01:17:11 +00:00
mpl a746c8df31 doc: TLS certificate configuration
Fixes #891

Change-Id: I90a7d7c6df90d0296856caed57a1c7cada2c1d74
2016-12-17 02:16:02 +01:00
Mathieu Lonjaret 397a148a10 Merge "server/camnetdns: persist records in datastore" 2016-12-16 14:22:26 +00:00
mpl 9a32570a48 server/camnetdns: persist records in datastore
Store records in Google Datastore in production (on GCE), with an LRU
cache in front.

Keep dev mode that stores in sorted mem key value though.

Change-Id: I17b088b56a68a019f4e253b60c6bd42395a64984
2016-12-16 00:36:08 +01:00
Mathieu Lonjaret 0532eff168 Merge "pkg/gpgchallenge: more paranoia against clients" 2016-12-15 22:13:54 +00:00
mpl 9dc6d6db7c pkg/gpgchallenge: more paranoia against clients
-check claimed IP is a global unicast one
-set timeout on requests, so they don't make us create long-lived
connections for nothing
-prevent redirects
-disable keepalive connections

Change-Id: Ibdbdd9916ddc93eb58505b04b4f21de60e37c745
2016-12-15 23:06:16 +01:00
mpl b211cd72b7 website: log when SMTP down
Change-Id: I37f9e6f72db04ef48d3e45226f6bd0223e998ed7
2016-12-15 17:19:30 +01:00
mpl b3d21d7faa pkg/gpgchallenge: require public key of at least 2048 bits
Change-Id: Id1e3bb32b4fb6b89d09303f8121b95b1008bd65a
2016-12-14 20:48:43 +01:00
mpl 885389a10f app/publisher: use autocert too when Camlistore does it
As the requests to the publisher are proxied through Camlistore's app
handler, there's no point in the publisher having its own autocert
Manager to request a certificate. Therefore, the publisher reuses
(readonly) camlistored's autocert CacheDir to get its certificate.

It follows that, for now, Let's Encrypt only works for the publisher if
it is running on the same host as camlistored (or more precisely, if they
share the same filesystem).

Fixes #458

Change-Id: Icf3be2913f85f9ec6f94b831ad58e1949b4d6961
2016-12-14 01:24:30 +01:00
Mathieu Lonjaret 947266f042 Merge "vendor: rm golang.org/x/crypto/openpgp/clearsign" 2016-12-10 00:30:15 +00:00
mpl 2a2b3d4efd vendor: rm golang.org/x/crypto/openpgp/clearsign
Turns out we don't actually need it.

Change-Id: I309db82601245cb9d7ef3b8c79ca91bcedee8d5c
2016-12-10 01:21:10 +01:00
mpl f4ae855a49 pkg/gpgchallenge: to prove IP ownership with a gpg challenge
A demo client and server are included, to help with testing.

TODO(mpl): restrict IP space

Issue #722

Change-Id: I6952069e8885c06adcbb8fca103af9d83f2fa9a7
2016-12-10 01:09:43 +01:00
mpl bace8b0d44 vendor: add golang.org/x/crypto/openpgp/clearsign
at rev ede567c8e044a5913dad1d1af3696d9da953104c

used in upcoming https://camlistore-review.googlesource.com/8486

Change-Id: I72e71c51825b0679de414691714ab05be7507d2c
2016-12-09 15:36:20 +01:00
mpl 8b5b113d9f vendor: add golang.org/x/time/rate
at rev a4bde12657593d5e90d0533a3e4fd95e635124cb

used in upcoming https://camlistore-review.googlesource.com/8486

Change-Id: I6c761834c0f649ca12864d96bf201999d0c37339
2016-12-09 15:32:31 +01:00
Stephen Searles 2a08eafcab print mode information on top-level commands with just -h
Previously commands like camput, when invoked with simply just -h or
--help, they would only print the global flags defined on
flag.CommandLine of the standard library. In order to reach the richer
help text including mode information, you had to specify some mode, even
a fake one.

This change just replaces the flag.Usage function so that the global
help flag handling will call into the code that prints the nicer
message.

Fixes #890

Change-Id: Ib9ae73472148de6e92eeba92f12b5af7debe2bd1
2016-12-08 22:31:59 -08:00
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
Mathieu Lonjaret e17208dde9 Merge "server/camlistored/ui: specify sort order in search queries" 2016-12-01 14:40:08 +00:00
Mathieu Lonjaret 0137d834ee Merge "pkg/misc/amazon/s3: test against fake-s3 in docker" 2016-11-30 17:24:53 +00:00
mpl 99a6268893 server/camlistored/ui: specify sort order in search queries
In particular, specify "blobref" when search is not about permanode
results (instead of the "-created" default).

Fixes #886

Change-Id: I112288d42ea498873a5dcc3ddd37aa780620f309
2016-11-30 17:14:05 +01:00
mpl 3d048ca304 vendor: rm code.google.com/p/go.crypto/openpgp
And add golang.org/x/crypto/openpgp instead, at rev
ede567c8e044a5913dad1d1af3696d9da953104c
As well as golang.org/x/crypto/cast5 , as a dep.

Change-Id: I385fb0cd0eef438b43fa1dcd2a36e6a1442fd3b1
2016-11-28 19:34:32 +01:00
Mathieu Lonjaret 10fb1f2bd3 Merge "pkg/blobserver/blobpacked: change the meaning of -recovery" 2016-11-28 17:28:19 +00:00
Mathieu Lonjaret fd0ee3791c Merge "pkg/test/integration: make sure testing not linked in camlistored" 2016-11-28 16:59:30 +00:00