From 5c9d8118729c2e5524324bc340da45405ce69505 Mon Sep 17 00:00:00 2001 From: makefu Date: Sun, 9 Mar 2014 12:45:23 +0100 Subject: add filehooker ncdc pseudocode --- ship/lib/filehooker | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 ship/lib/filehooker (limited to 'ship/lib/filehooker') diff --git a/ship/lib/filehooker b/ship/lib/filehooker new file mode 100644 index 00000000..fac84b93 --- /dev/null +++ b/ship/lib/filehooker @@ -0,0 +1,56 @@ +#@include core +#@include tmux +# +netshare= +dc_hub=${dc_hub:-adcs://localhost:2781} +ncdc_user=hooker +ncdc_install(){ +curl http://dev.yorhel.nl/download/ncdc-linux-x86_64-1.19.tar.gz | tar xz -C /usr/bin/ +} + + + +ncdc_configure(){ + # maybe we want to use the running ncdc process and communicate via tmux send-keys ? + (sleep 1;cat;printf "/quit\n") | sudo -u $ncdc_user +# not implemented yet +# /set active +# /share $random $netshare +: +} +ncdc_configure_netshare(){ + :${1?provide path to share} + rnd=`hexdump -n 2 -e '/2 "%u"' /dev/urandom` + rnd_name="share_$rnd" + info "setting active as true" + info "adding share" + (echo "/set active true" ; + echo "/share $rnd_name $1") | ncdc_configure + +} +ncdc_configure_hub(){ + info "configuring DC Hub: $dc_hub, activating autconnect" + (echo "/open c1 $dc_hub" ; + echo "/hset autoconnect true") | ncdc_configure +} +ncdc_autostart(){ +# only systemd +# punani install tmux +cat > /etc/systemd/system/ncdc@.service < Date: Sun, 9 Mar 2014 21:44:17 +0100 Subject: ship:/lib/filehooker set nick --- ship/lib/filehooker | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) (limited to 'ship/lib/filehooker') diff --git a/ship/lib/filehooker b/ship/lib/filehooker index fac84b93..bd658c42 100644 --- a/ship/lib/filehooker +++ b/ship/lib/filehooker @@ -1,22 +1,13 @@ #@include core -#@include tmux -# + netshare= dc_hub=${dc_hub:-adcs://localhost:2781} -ncdc_user=hooker -ncdc_install(){ -curl http://dev.yorhel.nl/download/ncdc-linux-x86_64-1.19.tar.gz | tar xz -C /usr/bin/ -} - +ncdc_user=${ncdc_user:-hooker} -ncdc_configure(){ +ncdc_config(){ # maybe we want to use the running ncdc process and communicate via tmux send-keys ? (sleep 1;cat;printf "/quit\n") | sudo -u $ncdc_user -# not implemented yet -# /set active -# /share $random $netshare -: } ncdc_configure_netshare(){ :${1?provide path to share} @@ -25,14 +16,27 @@ ncdc_configure_netshare(){ info "setting active as true" info "adding share" (echo "/set active true" ; - echo "/share $rnd_name $1") | ncdc_configure + echo "/share $rnd_name $1") | ncdc_config +} +ncdc_configure_nick(){ + nick=${1?nick must be provided} + info "configuring DC Nick: $nick" + echo "/nick $nick" | ncdc_config } ncdc_configure_hub(){ - info "configuring DC Hub: $dc_hub, activating autconnect" - (echo "/open c1 $dc_hub" ; - echo "/hset autoconnect true") | ncdc_configure + hub=${1:-$dc_hub} + info "configuring DC Hub: $hub, activating autconnect" + (echo "/open c1 ${hub}" ; + echo "/hset autoconnect true") | ncdc_config } + + +ncdc_install(){ +curl http://dev.yorhel.nl/download/ncdc-linux-x86_64-1.19.tar.gz | tar xz -C /usr/bin/ +useradd -m $ncdc_user ||: +} + ncdc_autostart(){ # only systemd # punani install tmux -- cgit v1.2.3 From 0970f673456cf8bef932aef048bb89f6178eb104 Mon Sep 17 00:00:00 2001 From: makefu Date: Sun, 9 Mar 2014 22:32:48 +0100 Subject: ship:implement ncdc configuration --- ship/lib/filehooker | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'ship/lib/filehooker') diff --git a/ship/lib/filehooker b/ship/lib/filehooker index bd658c42..a6987733 100644 --- a/ship/lib/filehooker +++ b/ship/lib/filehooker @@ -1,14 +1,12 @@ #@include core - -netshare= -dc_hub=${dc_hub:-adcs://localhost:2781} ncdc_user=${ncdc_user:-hooker} - +ncdc_bin=${ncdc_bin:-/usr/bin/ncdc} ncdc_config(){ # maybe we want to use the running ncdc process and communicate via tmux send-keys ? - (sleep 1;cat;printf "/quit\n") | sudo -u $ncdc_user + (sleep 1;cat;printf "/quit\n") | sudo -u $ncdc_user "$ncdc_bin" } + ncdc_configure_netshare(){ :${1?provide path to share} rnd=`hexdump -n 2 -e '/2 "%u"' /dev/urandom` @@ -25,15 +23,19 @@ ncdc_configure_nick(){ echo "/nick $nick" | ncdc_config } ncdc_configure_hub(){ - hub=${1:-$dc_hub} + rnd=`hexdump -n 2 -e '/2 "%u"' /dev/urandom` + hubname="hub_$rnd" + hub=${1?adcs://localhost:2781} info "configuring DC Hub: $hub, activating autconnect" - (echo "/open c1 ${hub}" ; + (echo "/open ${hubname} ${hub}" ; echo "/hset autoconnect true") | ncdc_config } ncdc_install(){ -curl http://dev.yorhel.nl/download/ncdc-linux-x86_64-1.19.tar.gz | tar xz -C /usr/bin/ +install_dir="$(dirname "${ncdc_bin}")" +info "installing ncdc to $install_dir" +curl http://dev.yorhel.nl/download/ncdc-linux-x86_64-1.19.tar.gz | tar xz -C "$install_dir" useradd -m $ncdc_user ||: } -- cgit v1.2.3 From e2cf4fc92569487e21d096ac6879177aac8f73c1 Mon Sep 17 00:00:00 2001 From: makefu Date: Sun, 16 Mar 2014 12:55:24 +0100 Subject: update tor_announce --- ship/lib/filehooker | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'ship/lib/filehooker') diff --git a/ship/lib/filehooker b/ship/lib/filehooker index a6987733..5e6def5d 100644 --- a/ship/lib/filehooker +++ b/ship/lib/filehooker @@ -1,4 +1,5 @@ #@include core +#@include network ncdc_user=${ncdc_user:-hooker} ncdc_bin=${ncdc_bin:-/usr/bin/ncdc} @@ -60,3 +61,25 @@ WantedBy=multi-user.target EOF systemctl enable ncdc@$ncdc_user } + +install_tor_announce(){ +# systemd only +cat > /etc/systemd/system/tor_announce.service<