Skip to content
Snippets Groups Projects
Commit aea039e7 authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

Include authentication with log sender.

parent a430788b
No related branches found
No related tags found
No related merge requests found
......@@ -10,7 +10,8 @@ BASEURL='https://api.turris.cz/logsend/upload.cgi?'
RID="$(atsha204cmd serial-number)"
CERT="/etc/ssl/startcom.pem"
TMPFILE="/tmp/logsend.tmp"
trap 'rm -f "$TMPFILE"' EXIT
BUFFER="/tmp/logsend.buffer"
trap 'rm -f "$TMPFILE" "$BUFFER"' EXIT ABRT QUIT TERM
# Don't load the server all at once. With NTP-synchronized time, and
# thousand clients, it would make spikes on the CPU graph and that's not
......@@ -25,7 +26,11 @@ cp /tmp/logs.last.sha1 "$TMPFILE" || true
cat /var/log/messages
) | \
/usr/bin/whatsnew /tmp/logs.last.sha1 | \
grep "^[^ ][^ ]* *[a-z][a-z]* *\($DAEMONS\)\(\[[0-9]*\]\|\):" | \
tail -n 10000 | \
curl --compress --cacert "$CERT" -T - "$BASEURL$RID" -X POST
GREP "^[^ ][^ ]* *[a-z][a-z]* *\($DAEMONS\)\(\[[0-9]*\]\|\):" | \
tail -n 10000 >"$BUFFER"
(
atsha204cmd file-challenge-response <"$BUFFER"
cat "$BUFFER"
) | curl --compress --cacert "$CERT" -T - "$BASEURL$RID" -X POST
mv "$TMPFILE" /tmp/logs.last.sha1
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment