From 732876299f4dccb4caa3a915879d2b5945bbdd42 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 2 Apr 2014 11:15:54 +0200 Subject: filehooker is now elchOS --- elchos/root-image/krebs/bin/add-reaktor-secret.sh | 24 ++++++++++++++++++++++ elchos/root-image/krebs/bin/macid.sh | 2 ++ elchos/root-image/krebs/bin/reaktor-shell.sh | 4 ++++ elchos/root-image/krebs/bin/refresh-shares.ship | 11 ++++++++++ elchos/root-image/krebs/bin/set-hostname.sh | 5 +++++ elchos/root-image/krebs/bin/start-ncdc.ship | 23 +++++++++++++++++++++ .../root-image/krebs/bin/tor-get-hidden-service.sh | 2 ++ .../krebs/bin/tor_configure_hidden_service.ship | 16 +++++++++++++++ elchos/root-image/krebs/bin/tor_publish_ssh.ship | 12 +++++++++++ elchos/root-image/krebs/bin/update-search.sh | 5 +++++ elchos/root-image/krebs/bin/vim_sane_defaults.ship | 10 +++++++++ 11 files changed, 114 insertions(+) create mode 100755 elchos/root-image/krebs/bin/add-reaktor-secret.sh create mode 100755 elchos/root-image/krebs/bin/macid.sh create mode 100755 elchos/root-image/krebs/bin/reaktor-shell.sh create mode 100755 elchos/root-image/krebs/bin/refresh-shares.ship create mode 100755 elchos/root-image/krebs/bin/set-hostname.sh create mode 100755 elchos/root-image/krebs/bin/start-ncdc.ship create mode 100755 elchos/root-image/krebs/bin/tor-get-hidden-service.sh create mode 100755 elchos/root-image/krebs/bin/tor_configure_hidden_service.ship create mode 100755 elchos/root-image/krebs/bin/tor_publish_ssh.ship create mode 100755 elchos/root-image/krebs/bin/update-search.sh create mode 100755 elchos/root-image/krebs/bin/vim_sane_defaults.ship (limited to 'elchos/root-image/krebs/bin') diff --git a/elchos/root-image/krebs/bin/add-reaktor-secret.sh b/elchos/root-image/krebs/bin/add-reaktor-secret.sh new file mode 100755 index 00000000..92681449 --- /dev/null +++ b/elchos/root-image/krebs/bin/add-reaktor-secret.sh @@ -0,0 +1,24 @@ +#!/bin/sh +set -euf +green='\e[0;32m' +red='\e[0;31m' +nc='\e[0m' +black='\e[0;30m' + +printf "${green}Add a Reaktor Secret ${nc}\n" +printf "${red}(no spaces in input plox)${nc}\n" + +nick=${1:-} +while test -z "${nick:-}" ;do + printf "provide Nick Name:\n" + read nick +done + +secret=${2:-} +while test -z "${secret:-}" ;do + printf "provide Secret:$black\n" + read secret +done + +echo "$nick $secret" >> /krebs/painload/Reaktor/admin.lst +printf "${green}done${nc}" diff --git a/elchos/root-image/krebs/bin/macid.sh b/elchos/root-image/krebs/bin/macid.sh new file mode 100755 index 00000000..0fccc84b --- /dev/null +++ b/elchos/root-image/krebs/bin/macid.sh @@ -0,0 +1,2 @@ +#!/bin/sh +ip addr | grep ether | awk '{print $2}' | sort |md5sum | awk '{print $1}' | dd bs=1 count=6 2>/dev/null diff --git a/elchos/root-image/krebs/bin/reaktor-shell.sh b/elchos/root-image/krebs/bin/reaktor-shell.sh new file mode 100755 index 00000000..117c64f6 --- /dev/null +++ b/elchos/root-image/krebs/bin/reaktor-shell.sh @@ -0,0 +1,4 @@ +#!/bin/sh +echo "IP Addresses:" +/krebs/painload/Reaktor/commands/ips || echo "no IPs!" +/krebs/bin/add-reaktor-secret.sh diff --git a/elchos/root-image/krebs/bin/refresh-shares.ship b/elchos/root-image/krebs/bin/refresh-shares.ship new file mode 100755 index 00000000..364d7758 --- /dev/null +++ b/elchos/root-image/krebs/bin/refresh-shares.ship @@ -0,0 +1,11 @@ +#!/bin/sh +#TODO: +#!/usr/bin/env ship +set -euf +#@include filehooker +. /krebs/lib/filehooker +ncdc_user="hooker" + +share_all_partitions +systemctl restart hddtemp.service +exit 0 diff --git a/elchos/root-image/krebs/bin/set-hostname.sh b/elchos/root-image/krebs/bin/set-hostname.sh new file mode 100755 index 00000000..31101a18 --- /dev/null +++ b/elchos/root-image/krebs/bin/set-hostname.sh @@ -0,0 +1,5 @@ +#!/bin/sh +hostn="elch_$(/krebs/bin/macid.sh)" +hostnamectl set-hostname "$hostn" +hostname $hostn +echo "$hostn" > /etc/hostname diff --git a/elchos/root-image/krebs/bin/start-ncdc.ship b/elchos/root-image/krebs/bin/start-ncdc.ship new file mode 100755 index 00000000..1d47bcfb --- /dev/null +++ b/elchos/root-image/krebs/bin/start-ncdc.ship @@ -0,0 +1,23 @@ +#!/usr/bin/env ship +set -euf +#@include filehooker +. /krebs/lib/filehooker +#@include network +ncdc_user="hooker" + +useradd -m $ncdc_user ||: + +sudo -u $ncdc_user /usr/bin/tmux new-session -s dcpp -n ncdc -d ncdc 2>/dev/null || echo "ncdc is already running" + +nick=$(cat /etc/hostname) +echo "using nick $nick" +ncdc_configure_nick "$nick" +sleep 1 +dc_hub="adcs://elchhub.nsupdate.info:2781" +echo "connecting to $dc_hub" +ncdc_configure_hub "$dc_hub" "elch" + + +share_all_partitions + +exit 0 diff --git a/elchos/root-image/krebs/bin/tor-get-hidden-service.sh b/elchos/root-image/krebs/bin/tor-get-hidden-service.sh new file mode 100755 index 00000000..c9946366 --- /dev/null +++ b/elchos/root-image/krebs/bin/tor-get-hidden-service.sh @@ -0,0 +1,2 @@ +#!/bin/sh +cat /var/lib/tor/hidden_service/hostname diff --git a/elchos/root-image/krebs/bin/tor_configure_hidden_service.ship b/elchos/root-image/krebs/bin/tor_configure_hidden_service.ship new file mode 100755 index 00000000..1e026d26 --- /dev/null +++ b/elchos/root-image/krebs/bin/tor_configure_hidden_service.ship @@ -0,0 +1,16 @@ +#!/bin/sh +#@include core +. /krebs/lib/core +#@include network +. /krebs/lib/network +#@include tor +. /krebs/lib/tor + +sleep_time=5 +test -w "$torrc" || ( error "$torrc is not writable!"; exit 1 ) || exit 1 + +configure_hidden_service +test ! -e $hidden_service_dir/hostname && \ + info "hidden service file does not exist, restarting tor" && \ + systemctl restart tor && \ + sleep 1 diff --git a/elchos/root-image/krebs/bin/tor_publish_ssh.ship b/elchos/root-image/krebs/bin/tor_publish_ssh.ship new file mode 100755 index 00000000..2ecee9fb --- /dev/null +++ b/elchos/root-image/krebs/bin/tor_publish_ssh.ship @@ -0,0 +1,12 @@ +#!/usr/bin/env ship +#@include core +. /krebs/lib/core +#@include network +. /krebs/lib/network +#@include tor +. /krebs/lib/tor + +test -w "$torrc" || ( error "$torrc is not writable!"; exit 1 ) || exit 1 + +configure_hidden_service +cat $hidden_service_dir/hostname | send_irc diff --git a/elchos/root-image/krebs/bin/update-search.sh b/elchos/root-image/krebs/bin/update-search.sh new file mode 100755 index 00000000..665f6543 --- /dev/null +++ b/elchos/root-image/krebs/bin/update-search.sh @@ -0,0 +1,5 @@ +#!/bin/sh +for i in /media/vag*;do + updatedb -l 0 -o "$i/mlocate.db" -U "$i" +done +echo "update complete" diff --git a/elchos/root-image/krebs/bin/vim_sane_defaults.ship b/elchos/root-image/krebs/bin/vim_sane_defaults.ship new file mode 100755 index 00000000..fcc7ffcf --- /dev/null +++ b/elchos/root-image/krebs/bin/vim_sane_defaults.ship @@ -0,0 +1,10 @@ +#!/bin/sh +#@strict +#@include core +. /krebs/lib/core +#@include vim +. /krebs/lib/vim +#@mainifyme +touch $vimrc +info "configuring vim" +vim_conf_sane_defaults -- cgit v1.2.3