summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changelog28
-rw-r--r--examples/debian4
-rw-r--r--examples/debian.filter2
-rw-r--r--examples/kit_edu5
-rw-r--r--examples/kit_edu.filter2
-rwxr-xr-xplugins/curl4
-rwxr-xr-xupdate-openssh-known-hosts32
7 files changed, 59 insertions, 18 deletions
diff --git a/changelog b/changelog
index f2633e4..ef7ce56 100644
--- a/changelog
+++ b/changelog
@@ -1,3 +1,31 @@
+commit 43b1b4cbfb1aeabf3c9542c27c971790bf77cf91 (HEAD, master)
+Author: Timo Weingärtner <timo@tiwe.de>
+Date: 2015-02-17 19:39:41 +0100
+
+ apply shellcheck to update-openssh-known-hosts
+
+ applied with care, the two remaining things are meant that way
+
+commit 0e971e742afad1669dbae0d75eead51e76af1899 (origin/master)
+Author: Timo Weingärtner <timo@tiwe.de>
+Date: 2015-01-22 20:34:42 +0100
+
+ plugins/curl: fix silent wrong output on HTTP 404
+
+commit 4a043c6de09658a97dff8ec2d7b311c4f4bce3af
+Author: Timo Weingärtner <timo@tiwe.de>
+Date: 2014-03-04 17:18:25 +0100
+
+ add some real-life examples
+
+ kit_edu has connect-timeout because firewall DROPs connections from outside
+
+commit a1ccb1e836177276c23851fc015ec5c7ebf9f362 (tag: 0.6.1)
+Author: Timo Weingärtner <timo@tiwe.de>
+Date: 2014-02-18 18:39:44 +0100
+
+ changelog for 0.6.1
+
commit f8b47031fd65b9055e6a89a961466bdb367cd710
Author: Timo Weingärtner <timo@tiwe.de>
Date: 2014-02-18 18:25:08 +0100
diff --git a/examples/debian b/examples/debian
new file mode 100644
index 0000000..cb3b19e
--- /dev/null
+++ b/examples/debian
@@ -0,0 +1,4 @@
+PLUGIN=curl
+EXIT_IGNORE='6 7 28'
+
+URL='https://db.debian.org/debian_known_hosts'
diff --git a/examples/debian.filter b/examples/debian.filter
new file mode 100644
index 0000000..d17590f
--- /dev/null
+++ b/examples/debian.filter
@@ -0,0 +1,2 @@
+allow \.debian\.org$
+allow \.debian\.net$
diff --git a/examples/kit_edu b/examples/kit_edu
new file mode 100644
index 0000000..e676499
--- /dev/null
+++ b/examples/kit_edu
@@ -0,0 +1,5 @@
+PLUGIN=curl
+EXIT_IGNORE='6 7 28'
+
+CURL_OPTIONS='--connect-timeout 10'
+URL='https://rzadmin.rz.uni-karlsruhe.de/openssh/ssh_known_hosts'
diff --git a/examples/kit_edu.filter b/examples/kit_edu.filter
new file mode 100644
index 0000000..556ab25
--- /dev/null
+++ b/examples/kit_edu.filter
@@ -0,0 +1,2 @@
+allow \.(fzk|uka|uni-karlsruhe)\.de$
+allow \.kit\.edu$
diff --git a/plugins/curl b/plugins/curl
index 93be854..9c47601 100755
--- a/plugins/curl
+++ b/plugins/curl
@@ -12,12 +12,12 @@
set -e
if [ "${SIGURL}" ]; then
- curl -Rz "./current" -m 300 ${CURL_OPTIONS} -o new.sig "${SIGURL}" -o new "${URL}"
+ curl -fRz "./current" -m 300 ${CURL_OPTIONS} -o new.sig "${SIGURL}" -o new "${URL}"
[ -e new ] || exit 0
gpgv --keyring "${KEYRING}" --status-fd 2 new.sig || exit 1
# return 1 because it's not clear what other codes may used
else
- curl -Rz "./current" -m 300 ${CURL_OPTIONS} -o new "${URL}"
+ curl -fRz "./current" -m 300 ${CURL_OPTIONS} -o new "${URL}"
fi
# vim:set ft=sh:
diff --git a/update-openssh-known-hosts b/update-openssh-known-hosts
index 82c56c4..6d72663 100755
--- a/update-openssh-known-hosts
+++ b/update-openssh-known-hosts
@@ -41,7 +41,7 @@ path_search () {
return 0
fi
done
- echo "'${search}' not found in '$@'!" >&2
+ echo "'${search}' not found in '$*'!" >&2
exit 127
}
@@ -70,17 +70,17 @@ find -mindepth 2 -maxdepth 2 -type f -name new -delete
run-parts --list "${CONFDIR}/sources/" | while read sourcefile; do
source=${sourcefile##*/}
- mkdir -p ${source}
+ mkdir -p "${source}"
(
set -a
- cd ${source}
+ cd "${source}"
. "${sourcefile}"
$(path_search "$PLUGIN" "$PLUGIN_PATH") >| log 2>&1 || {
exitcode=$?
rm -f new
ignore=''
for e in ${EXIT_IGNORE:-0}; do
- if [[ $e = $exitcode ]]; then
+ if [[ $e = "$exitcode" ]]; then
ignore=1
break
fi
@@ -95,22 +95,22 @@ run-parts --list "${CONFDIR}/sources/" | while read sourcefile; do
fi
} >&2
) || exit 1
- if [ -e ${source}/new ]; then
- mv ${source}/new ${source}/current
+ if [ -e "${source}/new" ]; then
+ mv "${source}/new" "${source}/current"
fi
- if [ -e ${source}/current ]; then
+ if [ -e "${source}/current" ]; then
if [ -e "${sourcefile}.filter" ]; then
if [[ ${source}/filtered -ot ${source}/current ]] || [[ ${source}/filtered -ot ${sourcefile}.filter ]]; then
mapfile -t filter < "${sourcefile}.filter"
- for i in ${!filter[@]}; do
+ for i in "${!filter[@]}"; do
if [[ ${filter[$i]} =~ ^($|#) ]]; then
unset filter[$i]
fi
done
while read hostlist rest; do
- IFS=, read -a hostarray <<<$hostlist
+ IFS=, read -a hostarray <<<"$hostlist"
new_hostlist=''
- for host in ${hostarray[@]}; do
+ for host in "${hostarray[@]}"; do
for rule in "${filter[@]}"; do
if [[ ${host} =~ ${rule#* } ]]; then
if [[ ${rule%% *} =~ ^[aopy] ]]; then
@@ -122,12 +122,12 @@ run-parts --list "${CONFDIR}/sources/" | while read sourcefile; do
done
[ "$new_hostlist" ] || continue
echo "${new_hostlist%,} ${rest}"
- done < ${source}/current | sort -u >| ${source}/filtered.new
- mv ${source}/filtered.new ${source}/filtered
+ done < "${source}/current" | sort -u >| "${source}/filtered.new"
+ mv "${source}/filtered.new" "${source}/filtered"
fi
- cat ${source}/filtered >&3
+ cat "${source}/filtered" >&3
else
- sort -u ${source}/current >&3
+ sort -u "${source}/current" >&3
fi
fi
done 3>| "${OUTFILE}.new"
@@ -140,8 +140,8 @@ fi
# clean up cache dirs of vanished sources
for d in *; do
- [ -d $d ] || continue
- [ -e "${CONFDIR}/sources/$d" ] || rm -fr $d
+ [ -d "$d" ] || continue
+ [ -e "${CONFDIR}/sources/$d" ] || rm -fr "$d"
done
# vim:set ft=sh: