Commit Graph

1059 Commits

Author SHA1 Message Date
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
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
mpl b0eefd74fa server/camnetdns: get certificate from Lets Encrypt
Change-Id: Icd67eca36a153fe142d07b39df9ace6ef8301992
2016-12-17 23:38:40 +01: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
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 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
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
mpl 745f8516ea pkg/test/integration: make sure testing not linked in camlistored
I had to add the "-help" flag to camlistored, as otherwise relying on
the automatic usage gets us an exit status == 2, and hence an error when
running the Command.

fixes #475

Change-Id: I6f90329dbdb876a77c13d016f698de5026169e4a
2016-11-25 00:57:01 +01:00
mpl 06f6272e93 camlistored/ui: implement swipe for left/right nav on mobile
Naive implementation for now. I imitated how things were setup for the
left and right keys, but maybe the listener should be on the image
container instead of on the index page? It seems to work anyway.

No animation when starting to swipe though, which means users have no
clue swipe exists/works until they actually try to do it for real.

Change-Id: If0baed3c8d3ff1f5d8886fca891a8ac40980f66e
2016-11-23 17:56:01 +01:00
mpl 14322f8afe pkg/blobserver/blobpacked: change the meaning of -recovery
The -recovery flag from camlistored, now forces the blobpacked index to
be rebuilt, regardless of its state.

Fixes #876

Change-Id: I4e6bd5374ec68d7bb32de9fc119abbc881707625
2016-11-07 22:44:59 +01:00
Mathieu Lonjaret 4081409698 Merge "server/camnetdns: reply with NXDOMAIN when needed" 2016-10-31 17:21:38 +00:00
Filippo Valsorda e8b9df32af blobserver/b2: add new Storage based on Backblaze B2
github.com/FiloSottile/b2: c32038dd691290351948e8fbe956b0ade65e70ea

Change-Id: I0fb5ed3a622ed541170a9fb946b6781defef96fe
2016-10-23 18:04:48 +01:00
mpl 0ab95c3f13 server/camnetdns: reply with NXDOMAIN when needed
When we get a query for a name we are authoritative about, we should
reply with NXDOMAIN when this name does not exist.

This change moves the name lookup to as early as possible to make sure
of that. This means we're now doing lookups even for cases where we
technically wouldn't have needed them, so maybe a substantial increase
in load? We'll see.

Change-Id: I5e9946dd67757856f626f484b547197c6246cccd
2016-10-21 19:14:35 +02:00
mpl 0273e6c5f5 server/camnetdns: implement more of the DNS protocol
As Let's Encrypt DNS server (Unbound) is pretty strict, it
wouldn't resolve names camlistore.net until we implemented more of the
DNS protocol and fix various things.

Since I had no way at first to know what exactly it didn't like, I
started by fixing all errors and warnings reported at:
http://dnsviz.net/d/camlistore.net/dnssec/

Therefore, this CL adds:
-TCP support
-NS response
-SOA response
-MX (empty) response
-DNSKEY (empty) response
-TXT (empty) response
-explicit non-support of EDNS

Then I found out we also needed this:

-https://tools.ietf.org/html/draft-vixie-dnsext-dns0x20-00
-CAA response. A proper response is optional here, as Let's Encrypt only
enforces the response if it finds one. But we do have to reply.

Fixes #867

Change-Id: Ib45f8a642cd83cf19c8ab36435644a2c645a70e7
2016-10-20 17:53:11 +02:00
mpl 39a33c7fa9 server/camnetdns: make it work
Before that change, one would only get a response to a DNS query, if
directly sending the query to the dns server.

I think the main problem was that one has to copy the question section
of the query in the response message, which is part of what SetReply
does.

With this change, I seem to get responses (for e.g. www.camlistore.net
and 6401800c.camlistore.net), without having to specify a server to
query to dig (or nslookup), so by letting the resolver and the DNS
hierarchy follow its normal course.

Issue #722

Change-Id: I530529920fdaa3e5fb025c7684b563e3f05772ac
2016-10-06 16:26:18 +02:00
mpl 2c4332ada2 make.go: optionally build camnetdns
server/camnetdns: update to cloud.google.com/go imports.

vendor: add github.com/miekg/dns at rev
3f1f7c8ec9ead89493df11f2c3d8bec353a2c2c0 as a dep of server/camnetdns

Change-Id: Ief8e0ad3e09a6c3511c72a7991309808f855d3df
2016-10-04 01:58:50 +02:00
mpl ab06dbd80d vendor: rename google.golang.org/cloud to cloud.google.com/go
rm google.golang.org/cloud
add cloud.google.com/go at a47b182e769f5e75f5fc927ff6ee2678f7f552cf
update google.golang.org/api to 63cb68f1e3834e44683ca062ddf06cb9a889380a
update google.golang.org/grpc to
0e6ec3a4501ee9ee2d023abe92e436fd04ed4081
update go4.org to f5283521d7365fb2875408726e9cbf349f173767

fix in cmd/ pkg/ server/

TODO(mpl): fix misc/docker tools as well. next CL.

Fixes #832

Change-Id: I842b968a0afea8a5822913bd614d67cdbe50ee63
2016-09-08 15:14:12 +02:00
mpl c052bd2804 web UI: upload with input file button
Fixes #830

Change-Id: Ic69fb7e6edc6a0dc0d604356f0214aaf6c8136a9
2016-08-16 18:18:56 +02:00
mpl@serenity 5522ebbeb1 webUI: disable tokenAuth when auth is None
This allows deferring HTTP authentication and authorization to a proxy
(such as nginx) between Camlistore and the rest of the world, without
breaking the web UI.

Fixes #816

Change-Id: Ia4b5be8f2236ddac68dc0d3a09f0f24e588c4995
2016-06-28 01:56:08 +02:00
Mathieu Lonjaret fbe5656196 Merge "Add button to remove selection from current set." 2016-05-10 23:24:24 +00:00
Mathieu Lonjaret cdadfd650b Merge "server/camlistored: allow GCL for non-GCE" 2016-05-05 13:47:55 +00:00
mpl 1ddc5ec092 server/camlistored: allow GCL for non-GCE
This change enables camlistored to log on Google Cloud Logging even when
not running on Google Compute Engine.

The main reason is to help with debugging cloud logging bugs, because
it usually is easier to do so from a local camlistored than from one
running on GCE.

Related: issue #704

Change-Id: I7de23cf9365683f8641a6bbad0deab754fc579f7
2016-05-05 15:47:09 +02:00
Brad Fitzpatrick e305847941 Merge "ui: fix reload menu item for broken websocket connection" 2016-04-30 21:28:24 +00:00
Tilman Dilo d208b531c9 Fix permissions for files
Use mode 0644 instead of 0755 for non-vendored files.

Change-Id: Ifbe1d5e21f24814531248a8a6c84d6f0a72c071c
2016-04-28 21:15:09 +02:00
Tilman Dilo cb67c554ec ui: fix reload menu item for broken websocket connection
The "click to reload" menu item displayed when the websocket connection
fails was non-functional. Clicking on the menu item only produced an
error (Uncaught TypeError: Illegal invocation) in the JavaScript
console.

Change-Id: Iea44dd35c92c99562c35f87c38687f4fa433ad41
2016-04-28 21:11:44 +02:00
Jeromy 444b2a81f3 server/camnetdns: set authority flag on dns response
Updates #722

Change-Id: I18277a0181234e9a9e497100a5f86613fca2dba4
2016-04-25 18:07:52 -07:00
Jeromy d77d4b8b51 server/camnetdns: log all incoming requests
Updates #722

Change-Id: Ief6b172d8ec4e62f22332a117f379ea4998a3f76
2016-04-25 16:53:50 -07:00
Jeromy e53f91085b server/camnetdns: default to port 53 on gce
Updates #722

Change-Id: I4d435634b6c78a4d4d1392616870d50f0c458e5c
2016-04-25 16:38:04 -07:00
Jeromy 4841ce270f server/camnetdns: add cloudlaunch config
Updates #722

Change-Id: Ia7532118183b5c38dfedc3aaa437f5284301b4c9
2016-04-25 16:26:26 -07:00
Brad Fitzpatrick 15ad9bf381 Merge "server/camnetdns: start of camlistore.net DNS server" 2016-04-25 23:08:34 +00:00
Jeromy 21c5373a0b server/camnetdns: start of camlistore.net DNS server
Updates #722

Change-Id: Ie4c2d6d036f13d7fb6f5545131397f55d1d9a91c
2016-04-25 16:05:25 -07:00
Mathieu Lonjaret 7332aad3aa Merge "server/camlistored: upload gpg key blob on startup" 2016-04-25 22:43:38 +00:00
mpl 36944ca818 server/camlistored: upload gpg key blob on startup
Fixes Issue #700

Change-Id: Ica92c321666220043e9c157de38e67a043250afe
2016-04-25 15:42:04 -07:00
Brad Fitzpatrick 924c895b22 server/camlistored/ui: rename confusing Pudgy menu to Camli
Change-Id: Ic7785881f2db65aff562ef329753d78aa131e68b
2016-04-23 17:42:56 -07:00
Brad Fitzpatrick 75d60962f6 Move remaining stuff in third_party/* to vendor/*
Change-Id: Ifbcc02817083cba68d8c1acec3e6ec50e8f61149
2016-04-20 16:49:15 -07:00
Tamás Gulácsi 7402cc0efd Delete misc unused objects
Using honnef.co/go/unused/cmd/unused

Change-Id: I672b3cb77f09e9bd80dcdc149cde4f7f2939e451
2016-04-06 17:59:51 +02:00
Mathieu Lonjaret 1c08a41322 Merge "ui: renamed "Search roots" to "Favorites"" 2016-03-19 00:12:27 +00:00
mpl 4e4f045c29 web UI: port Directory view to React
Side-effects:

Fixes issue #694

And we can now remove filetree.* and cache_buster_iframe.js

Change-Id: Id2d72054366be820771e8b342bb84c4da07a0abf
2016-03-17 00:29:26 +01:00
Ricardo Kirkner 48695d85a0 ui: renamed "Search roots" to "Favorites"
Mostly a cosmetic change but should make the menu item easier to
understand for users.

Fixes #506

Change-Id: I30b75a659948859988c1fd07780d08175b56cbc6
2016-03-16 20:09:04 -03:00
Will Norris 77ed42edf8 add canonical import paths
The import path was added to the go file that included the package
documentation if one existed.  Otherwise, I used what seemed to be the
primary file for the package.

Fixes #689

Change-Id: If51be0e86529fd6f179e80af6781e639f8550fd2
2016-03-13 19:57:14 -07:00
Mathieu Lonjaret c86007e232 Merge "blobserver/blobpacked: reindex meta from packed blobs" 2016-03-11 20:51:46 +00:00
mpl 4dd31658a5 blobserver/blobpacked: reindex meta from packed blobs
Added recovery mode to trigger reindex.

Fixes #676

Change-Id: Ifb9c26e1fe8e562c1dab5f1ce793f1c9165be988
2016-03-11 17:02:38 +01:00
Steve Armstrong 93dba45f8d ui: fix symlink in filetree view
Fixes issue #687

Change-Id: I385b5c86d736f798aaaf1416221bee05598c6c4c
2016-03-08 20:30:14 -08:00
mpl e03d0af04f ui: use authentication token instead of Basic Auth
Since issue #660 showed that we could not rely on Basic Auth for some
very particular cases (of POST requests), we wanted to replace Basic
Auth with a pre-generated token based authentication mechanism for these
cases.

However, as there already is such a mechanism used to authenticate
websocket connections, we simply extended the use of that mechanism.
Therefore, the token that is initially generated for websocket
connections is also now a valid token to authenticate any other
connection. The relevant types and method names have been changed to
reflect that. The javascript code pertaining to the sensitive cases
mentioned above has been changed to use that token.

Some doc has been added to point out how security-sensitive the
OpDiscovery permission is, since it gives access to the auth token.

Fixes issue #660

Change-Id: Iafed3b6e4804364ca2559414c8d87dc4a30f6637
2016-02-10 16:58:34 +01:00
Mathieu Lonjaret e67998ee12 Merge "UI: add to set when dropped is a dup but not yet a member of the set" 2015-12-29 18:22:48 +00:00