NETW 0014 Week 2, Day 4 — rsyslog: Local & Centralised Logging

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/18

encourage image

There's no tags or description

Looks like no tags are added yet.

19 Terms

1
New cards

An attacker gets root on S2 and runs truncate -s0 /var/log/auth.log. What evidence is destroyed?

everything held locally

2
New cards

Explain how journald and rsyslog work.

On Ubuntu services log to systemd-journald (binary, structured, queried with journalctl -u <unit> -p <level> --since), and the journal is also handed to rsyslog, which writes the traditional text files in /var/log (auth.log, syslog, kern.log) and can send messages over the network. rsyslog is the one that does routing and forwarding.

3
New cards

What is the syslog model?

Every message has a facility (what produced it: auth/authpriv, kern, daemon, cron, local0 to local7) and a severity 0 (emerg) to 7 (debug): the same eight levels as Cisco's logging trap. In a rule, facility.severity means that severity and more severe; *.debug is everything.

4
New cards

What does /etc/rsyslog.conf do and how would you make changes to it?

/etc/rsyslog.conf loads modules and sets global behaviour and includes /etc/rsyslog.d/*.conf; the default routing rules live in 50-default.conf Put your own changes in your own file in rsyslog.d/ so the packaged files stay untouched. Validate before restarting with sudo rsyslogd -N1.

5
New cards

What is RainerScript’s syntax?

template(name="myDefault" type="string" string="%timegenerated% %HOSTNAME% %syslogfacility-text%.%syslogseverity-text% %syslogtag% %msg%\n") and action(type="omfile" file="/var/log/x.log" template="myDefault"). The default line format omits facility and severity; a template that adds them makes logs self-describing, which matters once several hosts feed one server.

6
New cards

When you load imudp and add an input on port 514, why is it important to bind it to S1's LAN1 address, not all addresses?

S1 also has an External interface on the classroom network, and an unbound listener would accept logs from (and be spammed by) anyone there. sudo ss -ulnp | grep 514 proves what it is bound to.

7
New cards

What is the point of a central copy?

The point of a central copy is forensic: it survives tampering with the client's local file.

8
New cards

Is UDP reliable?

No and the messages are plaintext. TCP is better, and RELP or TLS are the production answers

9
New cards

What does logrotate do?

reads /etc/logrotate.conf and /etc/logrotate.d/*. On Ubuntu it is started by a systemd timer (systemctl list-timers), not cron. Directives: daily/weekly, rotate N, compress, delaycompress, missingok, notifempty, sharedscripts and a postrotate block that tells rsyslog to reopen its files. logrotate -d is a dry run, -f forces a rotation. The packaged /etc/logrotate.d/rsyslog covers the default files; any new file needs its own rule or it grows forever.

10
New cards

What is the su line?

The su line: /var/log is group-writable (group syslog), so when you run a rule file by itself with logrotate -d or -f, logrotate skips files directly in it with "parent directory has insecure permissions" unless the rule says su root syslog. The packaged rule gets away without it only because the timer runs it through logrotate.conf, which sets a global su.

11
New cards

Why bind the receiver to the LAN address instead of 0.0.0.0?

S1's External side faces the classroom network

12
New cards

What would have happened to fail2ban if you had moved the auth rule?

the jail would stop seeing auth events and would stop banning

13
New cards

The logs travel in plaintext over UDP. Name two ways an attacker could exploit that, and the production fix.

spoofed or modified messages, eavesdropping, silent loss; TCP/RELP with TLS.

14
New cards

What is the likely cause and fix for the following issue: Logging stops entirely after a change

Syntax error in the rsyslog configuration

sudo rsyslogd -N1 to find the line; restore the backup

15
New cards

What is the likely cause and fix for the following issue: The new file is created but stays empty

Wrong facility, or rsyslog not restarted

Test with logger -p auth.notice; restart rsyslog; check the rule's facility.severity

16
New cards

What is the likely cause and fix for the following issue: fail2ban stopped banning

The auth rule was moved or auth.log was truncated

Restore the original rule; systemctl restart fail2ban and recheck fail2ban-client status sshd

17
New cards

What is the likely cause and fix for the following issue: Nothing arrives on S1

Receiver not bound or on the wrong address, a wrong port, or the sender targets the wrong IP

sudo ss -ulnp | grep 514; capture UDP 514 on S1 eth0 while S2 sends

18
New cards

What is the likely cause and fix for the following issue: S1 listens on every address

The input has no address set

Bind it to S1's LAN1 address and restart

19
New cards

What is the likely cause and fix for the following issue: logrotate dry run shows the rule is ignored

File is not matched by the path, or the rule file has wrong permissions or a syntax error

Check the path pattern; run logrotate -d on the file and read its messages