Skip to content

Commit

Permalink
kalua: loader: avoid some special dirs for TMPDIR; fix _monitoring_sc…
Browse files Browse the repository at this point in the history
…reenshot()
  • Loading branch information
Bastian Bittorf committed Jul 24, 2016
1 parent 27da974 commit f451ea4
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 16 deletions.
2 changes: 2 additions & 0 deletions TODO.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# rose: autokick after 3g

stopwatch_stop() timefile '/tmp/STOPWATCH_tmpCRON_LASTCALL'... not found - abort

# switch: 'TP-LINK TL-WR841N/ND v9'
Expand Down
11 changes: 6 additions & 5 deletions openwrt-addons/etc/kalua/cron
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,11 @@ _cron_dummy()
# wget -O olsrd-latest.tar.bz2 http://www.olsr.org/releases/latest.tar.bz2
# tar xjf olsrd-*; cd olsrd-*
# OR: git clone https://github.com/OLSR/olsrd.git olsrd-git && cd olsrd-git
# make build_all && make install_all
# make build_all && sudo make install_all
# cd ..; rm -fR olsrd-*
# mkdir -p /var/etc
# ln -s /usr/local/sbin/olsrd /usr/sbin/olsrd
# ln -s /etc/olsrd.conf /var/etc/olsrd.conf
# sudo mkdir -p /var/etc
# sudo ln -s /usr/local/sbin/olsrd /usr/sbin/olsrd
# sudo ln -s /etc/olsrd.conf /var/etc/olsrd.conf
#
### OLSRv2:
# apt-get -y install cmake pkg-config libnl-3-dev libnl-genl-3-dev libtomcrypt-dev
Expand Down Expand Up @@ -241,9 +241,10 @@ _cron_dummy()
echo 'system.@profile[0].name=ffweimar_ap'
echo 'system.@profile[0].nodenumber=1'
echo 'system.@profile[0].ipsystem=ffweimar'
echo 'network.lan.ifname=venet0'
echo 'network.lan.ifname=venet0' # TODO: autoget first ethernet
echo 'network.lan.gateway=true' # workaround: should be an IP
echo 'olsrd.@meta[0].ignored_interfaces='
echo 'system.@vds[0].server=root@intercity-vpn.de:/var/www/networks/liszt28/vds/'
} >/etc/kalua_uci
#
# - set sms_password?
Expand Down
1 change: 1 addition & 0 deletions openwrt-addons/etc/kalua/firmware
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ _firmware_update_pmu() # poor mens update - simply overwrites all (shell-)files

_log it $funcname daemon alert "[OK] applied tarball in '$MODE'-mode from '$URL' ($COUNT files), wrote new '$banner'"

_netparam check # e.g. changed TMPDIR
_system reboots set '0' # FIXME!
else
_log it $funcname daemon info "[OK] applied nothing - all seems up to date"
Expand Down
2 changes: 1 addition & 1 deletion openwrt-addons/etc/kalua/monitoring
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ _monitoring_screenshot()
local hash_old hash_new mac key dest

command -v 'scrot' >/dev/null && {
read -r hash_old <"$file"
hash_old="$( _file hash "$file" )"

# this only works as user (not root)
export DISPLAY=:0
Expand Down
2 changes: 1 addition & 1 deletion openwrt-addons/etc/kalua/net
Original file line number Diff line number Diff line change
Expand Up @@ -1002,7 +1002,7 @@ _net_ip_reachable()
_net dev_is_valid "$dev" || return 1

ip link show dev "$dev" | fgrep -q 'NOARP' && {
_log it $funcname daemon info "dev $dev is valid but not ARPable - assuming OK"
_log it $funcname daemon info "dev '$dev' is valid but not ARPable - assuming OK"
return 0
}
;;
Expand Down
20 changes: 12 additions & 8 deletions openwrt-addons/etc/kalua/ssh
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ _ssh_regen_keys()
_ssh_sanitize_and_cleanup_keys()
{
local funcname='ssh_sanitize_and_cleanup_keys'
local file mode
local file mode keyok

public_keyfile_ok()
{
Expand All @@ -107,9 +107,18 @@ _ssh_sanitize_and_cleanup_keys()
return 0
}

keyok=
for mode in rsa dss ecdsa; do {
file="/etc/dropbear/dropbear_${mode}_host_key"
[ -e "$file" ] || continue
if [ -e "$file" ]; then
keyok='true'
else
[ -z "$keyok" ] && {
dropbearkey -t "$mode" -f "/etc/dropbear/dropbear_${mode}_host_key" && {
keyok='true'
}
}
fi

public_keyfile_ok "$file" || {
_log it $funcname daemon info "writing $file.pub"
Expand All @@ -119,10 +128,5 @@ _ssh_sanitize_and_cleanup_keys()
}
} done

if [ -L $HOME/.ssh ]; then
:
else
rm -fR $HOME/.ssh
ln -s /etc/dropbear $HOME/.ssh
fi
[ -h "$HOME/.ssh" ] || ln -fs '/etc/dropbear' "$HOME/.ssh"
}
2 changes: 1 addition & 1 deletion openwrt-addons/etc/kalua_init
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

while read -r LINE; do { # e.g. none /run/user tmpfs rw,nosuid,nodev,noexec...
case "$LINE" in
*'nosuid'*|*'noexec'*|*' /home/'*|*'size='[0-9]'k'*)
*'cgmanager'*|'tmpfs /sys/'*|*'nosuid'*|*'noexec'*|*' /home/'*|*'size='[0-9]'k'*)
# avoid those (and very small disks)
# we only 'source' shellscripts and work with tempfiles
;;
Expand Down

0 comments on commit f451ea4

Please sign in to comment.