diff --git a/website/blobserver-example/example-blobserver-config.json b/website/blobserver-example/example-blobserver-config.json index 73ddea03e..76c339b8e 100644 --- a/website/blobserver-example/example-blobserver-config.json +++ b/website/blobserver-example/example-blobserver-config.json @@ -1,14 +1,21 @@ { "_for-emacs": "-*- mode: js2;-*-", - "baseURL": ["_env", "http://camlistore.org:3179"], - "password": ["_env", "${CAMLI_PASSWORD}"], + "handlerConfig": true, + "baseURL": ["_env", "http://camlistore.org:3179"], + "https": false, + "auth": ["_env", "userpass:whatever:${CAMLI_PASSWORD}"], - "prefixes": { - "/": { - "handler": "storage-filesystem", - "handlerArgs": { - "path": ["_env", "${CAMLI_ROOT}"] - } - } - } + "prefixes": { + "/": { + "handler": "storage-filesystem", + "handlerArgs": { + "path": ["_env", "${CAMLI_ROOT}"] + } + }, + "/share/": { + "handler": "share", + "handlerArgs": { + "blobRoot": "/" + } + } + } } - diff --git a/website/blobserver-example/root/sha1/071/fda/sha1-071fda36c1bd9e4595ed16ab5e2a46d44491f708.dat b/website/blobserver-example/root/sha1/071/fda/sha1-071fda36c1bd9e4595ed16ab5e2a46d44491f708.dat deleted file mode 100644 index 9a1ad1cd4..000000000 --- a/website/blobserver-example/root/sha1/071/fda/sha1-071fda36c1bd9e4595ed16ab5e2a46d44491f708.dat +++ /dev/null @@ -1,7 +0,0 @@ -{"camliVersion": 1, - "authType": "haveref", - "camliSigner": "sha1-f019d17dd308eebbd49fd94536eb67214c2f0587", - "camliType": "share", - "target": "sha1-0e5e60f367cc8156ae48198c496b2b2ebdf5313d", - "transitive": true -,"camliSig":"iQEcBAABAgAGBQJNQJGuAAoJEIUeCLJL7Fq1EuAIAL/nGoX8caGaANnam0bcIQT7C61wXMRW4qCCaFW+w67ys5z4ztfnTPKwL9ErzMF8Hd32Xe/bVcF6ZL38x/axqI7ehxN8lneKGQNoEdZDA9i752aAr0fkAba6eDehoOj9F4XxOzk3iVrq445jEXtu/+twamHV3UfRozWK1ZQb57dM+cRff47M/Y6VIBRSgW2BrABjuBs8G6PiKxycgh1mb+RL8f9KG+HB/yFuK37YJqZ0zU2OTRp6ELiOgTxbeg99koV9Duy4f4mQgxQgli46077Sv/ujzIeVbmdFL3OenGEzQnyKG0fhf8fa5WkED0XfH7zibAHLiSq3O7x11Q0406U==ANug"} diff --git a/website/blobserver-example/root/sha1/102/758/sha1-102758fb54521cb6540d256098e7c0f1625b33e3.dat b/website/blobserver-example/root/sha1/102/758/sha1-102758fb54521cb6540d256098e7c0f1625b33e3.dat new file mode 100644 index 000000000..cd0772d0e --- /dev/null +++ b/website/blobserver-example/root/sha1/102/758/sha1-102758fb54521cb6540d256098e7c0f1625b33e3.dat @@ -0,0 +1,9 @@ +{"camliVersion": 1, + "authType": "haveref", + "camliSigner": "sha1-3bee195d0dada92a9d88e67f731124238e65a916", + "camliType": "claim", + "claimDate": "2013-06-24T14:17:02.791613849Z", + "claimType": "share", + "target": "sha1-0e5e60f367cc8156ae48198c496b2b2ebdf5313d", + "transitive": true +,"camliSig":"wsBcBAABCAAQBQJRyFTeCRApy/NNAr6GZgAAKmgIAGbCCn1YPoZuqz+mcMaLN09J3rJYZPnjICp9at9UL7fFJ6izzDFLi6gq9ae/Kou51VRnuLYvRXGvqgZ9HCTTJiGaET8I6c3gBvQWMC/NOS/B9Y+CcZ5qEsz84Dk2D6zMIC9adQjN4yjtcsVtKYDVDQ5SCkCE6sOaUebGBS22TOhZMXPalIyzf2EPSiXdeEKtsMwg+sbd4EmpQHeE3XqzI8gbcsUX6VdCp6zU81Y71pNuYdmEVBPY5gVch2Xe1gJQICOatiAi4W/1nrTLB73sKEeulzRMbIDB4rgWooKKmnBPI1ZOTyg/fkKmfWfuJKSU0ySiPwVHn4aPFwCGrBRladE==KjfB"} diff --git a/website/camweb.go b/website/camweb.go index b6d88780e..f375032e2 100644 --- a/website/camweb.go +++ b/website/camweb.go @@ -42,19 +42,21 @@ const defaultAddr = ":31798" // default webserver address var h1TitlePattern = regexp.MustCompile(`
TODO: finish documenting this.
+TODO: finish documenting this. In particular, add example with camget -shared.
The basic summary is that you create a claim that a user has access to @@ -36,22 +36,28 @@ Its metadata (inode, filename, etc) is blob sha1-0e5e60f367cc8156ae48198c496
Note also that any errors you get from my private blob server always delay for at least 200 ms to mask timing attacks that could otherwise reveal the existence or non-existence of a blob on my private server.
-Now I want to share Hi.txt with you, so I create a share blob (e.g camput --share
Note that in order to have all of the following working, your server needs to have a share handler, so you need to have the line
+"shareHandler"
: true,
+in your server config.
I've created this, and its name is sha1-071fda36c1bd9e4595ed16ab5e2a46d44491f708
+Now I want to share Hi.txt with you, so I create a share blob (e.g camput share --transitive sha1-0e5e60f367cc8156ae48198c496b2b2ebdf5313d).
-Note that you can fetch it without authentication, because my blobserver knows I have it and that it's a share blob that doesn't require auth (authType == "haveref" ... like "Share with others that have the link")
+I've created this, and its name is sha1-102758fb54521cb6540d256098e7c0f1625b33e3
+ +Note that you can fetch it without authentication, because you're using the url prefix /share/
, which delegates the task to the share handler, and because the share handler checks that it's a share blob that doesn't require auth (authType == "haveref" ... like "Share with others that have the link")
Here's you getting the blob:
-$ curl http://camlistore.org:3179/camli/sha1-071fda36c1bd9e4595ed16ab5e2a46d44491f708 +$ curl http://camlistore.org:3179/share/sha1-102758fb54521cb6540d256098e7c0f1625b33e3 {"camliVersion": 1, "authType": "haveref", - "camliSigner": "sha1-f019d17dd308eebbd49fd94536eb67214c2f0587", - "camliType": "share", + "camliSigner": "sha1-3bee195d0dada92a9d88e67f731124238e65a916", + "camliType": "claim", + "claimDate": "2013-06-24T14:17:02.791613849Z", + "claimType": "share", "target": "sha1-0e5e60f367cc8156ae48198c496b2b2ebdf5313d", "transitive": true -,"camliSig":"iQEcBAABAgAGBQJNQJGuAAoJEIUeCLJL7Fq1EuAIAL/nGoX8caGaANnam0bcIQT7C61wXMRW4qCCaFW+w67ys5z4ztfnTPKwL9ErzMF8Hd32Xe/bVcF6ZL38x/axqI7ehxN8lneKGQNoEdZDA9i752aAr0fkAba6eDehoOj9F4XxOzk3iVrq445jEXtu/+twamHV3UfRozWK1ZQb57dM+cRff47M/Y6VIBRSgW2BrABjuBs8G6PiKxycgh1mb+RL8f9KG+HB/yFuK37YJqZ0zU2OTRp6ELiOgTxbeg99koV9Duy4f4mQgxQgli46077Sv/ujzIeVbmdFL3OenGEzQnyKG0fhf8fa5WkED0XfH7zibAHLiSq3O7x11Q0406U==ANug"}+,"camliSig":"wsBcBAABCAAQBQJRyFTeCRApy/NNAr6GZgAAKmgIAGbCCn1YPoZuqz+mcMaLN09J3rJYZPnjICp9at9UL7fFJ6izzDFLi6gq9ae/Kou51VRnuLYvRXGvqgZ9HCTTJiGaET8I6c3gBvQWMC/NOS/B9Y+CcZ5qEsz84Dk2D6zMIC9adQjN4yjtcsVtKYDVDQ5SCkCE6sOaUebGBS22TOhZMXPalIyzf2EPSiXdeEKtsMwg+sbd4EmpQHeE3XqzI8gbcsUX6VdCp6zU81Y71pNuYdmEVBPY5gVch2Xe1gJQICOatiAi4W/1nrTLB73sKEeulzRMbIDB4rgWooKKmnBPI1ZOTyg/fkKmfWfuJKSU0ySiPwVHn4aPFwCGrBRladE==KjfB"}
Note the "target" and "transitive".
@@ -59,7 +65,7 @@ Its metadata (inode, filename, etc) is blob sha1-0e5e60f367cc8156ae48198c496Here's the first hop to the metadata, in which we discover the blobRef of the bytes of the file (in this case, just one part is the whole file bytes...) I already told you this earlier in the email, but assume you're just discovering this now.
-$ curl http://camlistore.org:3179/camli/sha1-0e5e60f367cc8156ae48198c496b2b2ebdf5313d?via=sha1-071fda36c1bd9e4595ed16ab5e2a46d44491f708 +$ curl http://camlistore.org:3179/share/sha1-0e5e60f367cc8156ae48198c496b2b2ebdf5313d?via=sha1-102758fb54521cb6540d256098e7c0f1625b33e3 {"camliVersion": 1, "camliType": "file", "contentParts": [ @@ -80,7 +86,7 @@ Its metadata (inode, filename, etc) is blob sha1-0e5e60f367cc8156ae48198c496Now let's get the final bytes of the file:
-$ curl http://camlistore.org:3179/camli/sha1-3dc1d1cfe92fce5f09d194ba73a0b023102c9b25?via=sha1-071fda36c1bd9e4595ed16ab5e2a46d44491f708,sha1-0e5e60f367cc8156ae48198c496b2b2ebdf5313d +$ curl http://camlistore.org:3179/share/sha1-3dc1d1cfe92fce5f09d194ba73a0b023102c9b25?via=sha1-102758fb54521cb6540d256098e7c0f1625b33e3,sha1-0e5e60f367cc8156ae48198c496b2b2ebdf5313d Hello, Camli!That's it.
diff --git a/website/run.pl b/website/run.pl index d07951100..e64d9bc7b 100755 --- a/website/run.pl +++ b/website/run.pl @@ -22,6 +22,7 @@ push @args, "--root=$Bin"; push @args, "--logdir=$logdir"; push @args, "--buildbot_host=build.camlistore.org"; push @args, "--buildbot_backend=http://c1.danga.com:8080"; +push @args, "--also_run=$Bin/scripts/run-blobserver"; if ($in_prod) { push @args, "--http=:8080"; push @args, "--https=:4430"; diff --git a/website/scripts/run-blobserver b/website/scripts/run-blobserver index 2b9443954..c606cf1e9 100755 --- a/website/scripts/run-blobserver +++ b/website/scripts/run-blobserver @@ -3,11 +3,14 @@ set -e Bin=$(dirname $( readlink -f $0)) -export CAMLI_PASSWORD=`cat $HOME/.camli/camorg-blobserver.pass` +export CAMLI_PASSWORD=`cat $HOME/.config/camlistore/camorg-blobserver.pass` export CAMLI_ROOT=$Bin/../blobserver-example/root -$Bin/../../build.pl server/go/camlistored && \ - $Bin/../../server/go/camlistored/camlistored \ - -configfile=$Bin/../blobserver-example/example-blobserver-config.json \ - -listen=:3179 "$@" +cd $Bin/../.. +go run make.go \ + -embed_static=false \ + -targets=camlistore.org/server/camlistored && \ +./bin/camlistored \ + -configfile=$Bin/../blobserver-example/example-blobserver-config.json \ + -listen=:3179 "$@"