diff options
author | root <root@flap> | 2014-05-06 10:00:33 -0400 |
---|---|---|
committer | root <root@flap> | 2014-05-06 10:00:33 -0400 |
commit | 4d8016064edd5e5dc1d194ea5ec0fce4f07b8f2a (patch) | |
tree | d8ecba8651604e51d6f887449641ac627844ae63 /services/bin | |
parent | f44c8529e6d04b557d93cc862599b956ed21f0de (diff) | |
parent | d0367082a5c1296cefed641b4eda736b29a3ad69 (diff) |
Merge branch 'master' of https://github.com/krebscode/painload
Diffstat (limited to 'services/bin')
-rwxr-xr-x | services/bin/obsolete/copy-services | 34 | ||||
-rwxr-xr-x | services/bin/sync-host-to-services | 15 |
2 files changed, 49 insertions, 0 deletions
diff --git a/services/bin/obsolete/copy-services b/services/bin/obsolete/copy-services new file mode 100755 index 00000000..381d39a3 --- /dev/null +++ b/services/bin/obsolete/copy-services @@ -0,0 +1,34 @@ +#!/bin/bash + +set -euf +cd $(dirname $(readlink -f $0)) +usage(){ + cat <<EOF +usage: $0 [pubkey-file] [bootstrap-file] + if pubkey-file is "" it will be skipped. + + e.g.: + $0 "" ../path/to/other/bootstrap +EOF + +} +pubfile=${1:-} +bootfile=${2:-../etc/services/bootstrap} +outdir=$PWD/out +mkdir -p "$outdir" +for i in `cat $bootfile`; do + # retard uriparsing but good enough for our use case + netloc=${i##*//} + host=${netloc%%:*} + port=${netloc##*:} + [ "$port" == "$host" ] && port=1337 + + pubarg="${pubfile:+-i $pubfile}" + #printf "[32m" + cat >$outdir/$host <<EOF +$(ssh ${pubarg} "services@$host" -p "$port" -o PasswordAuthentication=no + 2>/dev/null||: ) +EOF + #printf "[0m" +done + diff --git a/services/bin/sync-host-to-services b/services/bin/sync-host-to-services new file mode 100755 index 00000000..526bc569 --- /dev/null +++ b/services/bin/sync-host-to-services @@ -0,0 +1,15 @@ +#!/bin/sh +green='\e[0;32m' +red='\e[0;31m' +nc='\e[0m' + +outdir=${1?please provide services-outdir} +find ../../retiolum/hosts -type f | while read hostfile;do + host=$(basename "$hostfile") + if test -e "$outdir/$host";then + printf "${green}$host already exists$nc\n" + else + printf "${red}$host missing, adding${nc}\n" + cat ../services.txt | sed "s#{{hostname}}#$host#" > $outdir/$host + fi +done |