diff options
-rw-r--r-- | jsaccess/Makefile | 6 | ||||
-rw-r--r-- | jsaccess/README.txt | 16 | ||||
-rw-r--r-- | jsaccess/doc/put_your_encrypted_files_here.txt | 6 | ||||
-rwxr-xr-x | jsaccess/jstore.sh (renamed from jsaccess/store.sh) | 13 | ||||
-rwxr-xr-x | jsaccess/tests/test_store.sh | 28 |
5 files changed, 32 insertions, 37 deletions
diff --git a/jsaccess/Makefile b/jsaccess/Makefile index 41c1157..94062c9 100644 --- a/jsaccess/Makefile +++ b/jsaccess/Makefile @@ -1,11 +1,9 @@ PREFIX=/usr/local BINDIR=$(PREFIX)/bin -BINARIES=store.sh - all: - @echo "Run \"sudo make install\" to install store.sh" + @echo "Run \"sudo make install\" to install jstore" @echo "Run \"scp -rp jsa user@webserver:/var/www/htdocs/\" to install jsa on your web server" install: - install -m 0755 $(BINARIES) $(BINDIR) + install -m 0755 jstore.sh $(BINDIR)/jstore diff --git a/jsaccess/README.txt b/jsaccess/README.txt index 4127c1a..7d7292b 100644 --- a/jsaccess/README.txt +++ b/jsaccess/README.txt @@ -32,8 +32,8 @@ Deployment There are 2 parts: * The jsa/ directory that contains html / javascript files, for the user to access files list and download. jsa/store/ is the files store. -* The store.sh script for the web server owner to manage file store. -It is recomanded to run store.sh on your laptop, and then syncronise the +* The jstore script for the web server owner to manage file store. +It is recomanded to run jstore on your laptop, and then syncronise the jsa/store/ with your server. Put jsa/ directory on your web server, publicly available. @@ -44,7 +44,7 @@ Share a file 1. Add the file you want to share to the file store On your laptop: -$ ./store.sh add myfile +$ jstore add myfile # Then enter the passphase you want to use for encryption. # It will tell you something like: jsa/store/af022cd820fdad6cbcac8e15ac565c639a47dab0 @@ -54,9 +54,9 @@ UPDATED file jsa/store/af022cd820fdad6cbcac8e15ac565c639a47dab0/index.txt 2. Syncronise the file store with you online server On your laptop: # Set the rsync url (only once) -./store.sh rset user@myserver:/var/www/htdocs/jsa/store/ +jstore rset user@myserver:/var/www/htdocs/jsa/store/ # push the file store -./store.sh push +jstore push 3. Direct people to the directory jsa/, e.g. http://myserver.com/jsa/ @@ -64,7 +64,7 @@ On your laptop: How it works ============ -store.sh creates a directory jsa/store/<rmd160_hash_of_passphrase>/. +jstore creates a directory jsa/store/<rmd160_hash_of_passphrase>/. It encrypts your file using AES256 with the passphrase and stores the result in jsa/store/<rmd160_hash_of_passphrase>/<rmd160_hash_of_(passphrase+filename)>. It also updates the index of available files per directory called index.txt, @@ -82,7 +82,7 @@ Filesaver JS API. Dependencies / Compatibility ============================ -On the host that runs store.sh: +On the host that runs jstore: * openssl * base64 * optional: rsync, if you with to use ./store push to deploy your file store @@ -101,7 +101,7 @@ Git content jsa/ - should be on your webserver, can be renamed jsa/store/<password_hash>/ - directory of files to download for a given password jsa/store/<password_hash>/index.txt - list of file name available -store.sh - to encrypt the files that will be available for download +jstore - to encrypt the files that will be available for download TODO diff --git a/jsaccess/doc/put_your_encrypted_files_here.txt b/jsaccess/doc/put_your_encrypted_files_here.txt index 3e2eb80..81eca5e 100644 --- a/jsaccess/doc/put_your_encrypted_files_here.txt +++ b/jsaccess/doc/put_your_encrypted_files_here.txt @@ -4,12 +4,12 @@ decrypted OK ! To a new file to download: -$ ./store.sh add README.txt +$ jstore add README.txt Using store "jsa/store" Enter encryption passphrase > jsa CREATED file /home/user/code/laurent-tools/jsaccess/jsa/store/af022cd820fdad6cbcac8e15ac565c639a47dab0/065e18a7f246b800242a778a6e8dd07a3321dac6 UPDATED file /home/user/code/laurent-tools/jsaccess/jsa/store/af022cd820fdad6cbcac8e15ac565c639a47dab0/index.txt -$ ./store.sh rset user@_host:/var/www/htdocs/jsa/ # Only the first time -$ ./store.sh push +$ jstore rset user@_host:/var/www/htdocs/jsa/ # Only the first time +$ jstore push diff --git a/jsaccess/store.sh b/jsaccess/jstore.sh index c6f49af..ea19ea0 100755 --- a/jsaccess/store.sh +++ b/jsaccess/jstore.sh @@ -1,7 +1,7 @@ #!/bin/sh # jsaccess - private web file sharing using client side crypto -# store.sh: file store manager for encrypting new files and deploy to server +# jstore.sh: file store manager for encrypting new files and deploy to server # Copyright (c) 2013 Laurent Ghigonis <laurent@gouloum.fr> # @@ -20,7 +20,8 @@ VERSION=0.2 usage_exit() { - echo "usage: store.sh [-v] [action] [action arguments...] [store]" + echo "jsaccess jstore.sh v$VERSION" + echo "usage: jstore.sh [-v] [action] [action arguments...] [store]" echo echo "actions on local store for a given passphrase:" echo " ls [store] # default action if no arguments" @@ -141,7 +142,7 @@ _rset() { _rget() { [ ! -f $store/.rsync_uri ] && echo "ERROR: no rsync_uri set !" && \ - echo "set it with \"store.sh rset <rsync_uri> $store\"" && \ + echo "set it with \"jstore.sh rset <rsync_uri> $store\"" && \ clean_exit 1 rsync_uri=`cat $store/.rsync_uri` } @@ -281,11 +282,7 @@ rget) _store_get $2 action_rget ;; -help|-h) - usage_exit - ;; -version|-V) - echo "v$VERSION" +help|-h|version|-V) usage_exit ;; "") diff --git a/jsaccess/tests/test_store.sh b/jsaccess/tests/test_store.sh index c22ce26..70e44f5 100755 --- a/jsaccess/tests/test_store.sh +++ b/jsaccess/tests/test_store.sh @@ -1,8 +1,8 @@ #!/bin/sh -# Unittests for jsaccess store.sh +# Unittests for jsaccess jstore.sh -storesh=../store.sh +jstoresh=../jstore.sh TMP=test_store.tmp export JSA_PASS=jsa_unittest_passphrase export JSA_FORCE=1 @@ -10,54 +10,54 @@ export JSA_FORCE=1 echo echo "=== INIT ===" -$storesh init store ||exit 1 +$jstoresh init store ||exit 1 [ -d store ] ||exit 2 echo echo "=== LOCAL ===" -$storesh add example.txt ||exit 10 +$jstoresh add example.txt ||exit 10 [ -d ./store/ad2c5eb7c4fca722235f5df80e11fa619adbd533/ ] ||exit 11 [ -f ./store/ad2c5eb7c4fca722235f5df80e11fa619adbd533/8e895f3f4317fb442747a40b9025d6ad8c9c8cf3 ] ||exit 12 -$storesh ls > $TMP ||exit 20 +$jstoresh ls > $TMP ||exit 20 [ `grep -c "example.txt" $TMP` -eq 1 ] || exit 21 rm $TMP -$storesh rm example.txt ||exit 30 +$jstoresh rm example.txt ||exit 30 [ ! -f ./store/ad2c5eb7c4fca722235f5df80e11fa619adbd533/8e895f3f4317fb442747a40b9025d6ad8c9c8cf3 ] ||exit 31 -$storesh ls > $TMP ||exit 40 +$jstoresh ls > $TMP ||exit 40 [ `grep -c "example.txt" $TMP` -eq 0 ] || exit 41 rm $TMP -$storesh add example.txt ||exit 50 +$jstoresh add example.txt ||exit 50 [ -d ./store/ad2c5eb7c4fca722235f5df80e11fa619adbd533/ ] ||exit 51 [ -f ./store/ad2c5eb7c4fca722235f5df80e11fa619adbd533/8e895f3f4317fb442747a40b9025d6ad8c9c8cf3 ] ||exit 52 -$storesh rmall ||exit 60 +$jstoresh rmall ||exit 60 [ ! -d ./store/ad2c5eb7c4fca722235f5df80e11fa619adbd533/ ] ||exit 61 -$storesh add example.txt ||exit 70 +$jstoresh add example.txt ||exit 70 [ -d ./store/ad2c5eb7c4fca722235f5df80e11fa619adbd533/ ] ||exit 71 [ -f ./store/ad2c5eb7c4fca722235f5df80e11fa619adbd533/8e895f3f4317fb442747a40b9025d6ad8c9c8cf3 ] ||exit 72 echo echo "=== DEPLOY ===" -$storesh rset clone_store ||exit 100 +$jstoresh rset clone_store ||exit 100 echo clone_store |diff -u - ./store/.rsync_uri ||exit 101 -$storesh rget > $TMP ||exit 110 +$jstoresh rget > $TMP ||exit 110 [ `grep -c "rsync_uri: clone_store" $TMP` -eq 1 ] || exit 21 -$storesh push ||exit 120 +$jstoresh push ||exit 120 [ -f ./clone_store/ad2c5eb7c4fca722235f5df80e11fa619adbd533/8e895f3f4317fb442747a40b9025d6ad8c9c8cf3 ] ||exit 121 echo echo "=== WIPE ===" -$storesh wipe store ||exit 200 +$jstoresh wipe store ||exit 200 [ ! -d store ] ||exit 201 rm -rf ./clone_store/ |