Remove references to hardcoded file writing in /tmp
/tmp is a world writeable directory, so using hardcoded filenames
in there is just a bad coding style (susceptible to symlink attacks).
Avoid using it to not give a bad precedent.
Change-Id: Ia66763a0e4714f2226e98dbd85600b2035bd5088
diff --git a/stack.sh b/stack.sh
index 1d1f12e..c02b663 100755
--- a/stack.sh
+++ b/stack.sh
@@ -962,17 +962,15 @@
if [[ $SYSLOG != "False" ]]; then
if [[ "$SYSLOG_HOST" = "$HOST_IP" ]]; then
# Configure the master host to receive
- cat <<EOF >/tmp/90-stack-m.conf
+ cat <<EOF | sudo tee /etc/rsyslog.d/90-stack-m.conf >/dev/null
\$ModLoad imrelp
\$InputRELPServerRun $SYSLOG_PORT
EOF
- sudo mv /tmp/90-stack-m.conf /etc/rsyslog.d
else
# Set rsyslog to send to remote host
- cat <<EOF >/tmp/90-stack-s.conf
+ cat <<EOF | sudo tee /etc/rsyslog.d/90-stack-s.conf >/dev/null
*.* :omrelp:$SYSLOG_HOST:$SYSLOG_PORT
EOF
- sudo mv /tmp/90-stack-s.conf /etc/rsyslog.d
fi
RSYSLOGCONF="/etc/rsyslog.conf"