Page MenuHomePhabricator

[wmcs-cookbooks] SAL messages are shown differently when logging via wm-bot
Closed, ResolvedPublic

Description

When running WMCS cookbooks from a laptop (or from any host that is not allowed to send TCP messages to tcpircbot on alert1001.wikimedia.org), we send SAL messages through wm-bot instead.

These messages have the same format {user}@{host} {message}, but user and host could be easily spoofed so we are currently not displaying those in the second column of https://sal.toolforge.org/ and instead we display <wm-bot2> in that column, and user@host at the start of the message.

It would be nice to have a more consistent output, and to prevent users from spoofing the username/hostname.

Screenshot 2023-09-18 at 14.47.41.png (208×2 px, 100 KB)

Event Timeline

fnegri moved this task from Backlog to wmcs-cookbooks on the Cloud-VPS board.

Change 958439 had a related patch set uploaded (by FNegri; author: FNegri):

[labs/tools/stashbot@master] Parse user@host in wm-bot2 messages

https://gerrit.wikimedia.org/r/958439

One option could be to connect to wm-bot through a proxy host (e.g. login.toolforge.org), and display the username on that host (e.g. fnegri@tools-sgebastion-10). In this way we could also increase the security of wm-bot that is currently openly accessible on the internet.

fnegri added a subscriber: taavi.

@dcaro suggested we could in the meantime add a prefix like wmbot. to the user@host string, so that we know it was received from wm-bot and it could be spoofed. I have updated my patch to do this. Restricting access to wm-bot and enforcing a proper authentication could be handled in a separate task.

user and host could be easily spoofed so we are currently not displaying those in the second column of https://sal.toolforge.org/

I understand where this interpretation comes from, but the reality is a much more boring explanation of "nobody wrote the code yet" rather than a fear of spoofing attacks or their theoretical consequences. I think the spoofing risks are too to low worry about. I find it unlikely that there will be any non-trivial amount of abuse. I also cannot see any real harm from a spoofed message. SAL is not any sort of canonical audit log.

fnegri changed the task status from Open to In Progress.Sep 28 2023, 1:12 PM

Change 958439 merged by jenkins-bot:

[labs/tools/stashbot@master] Parse user@host in wm-bot2 messages

https://gerrit.wikimedia.org/r/958439

Mentioned in SAL (#wikimedia-cloud) [2024-01-08T16:10:24Z] <wm-bot> fnegri@tools-sgebastion-10 test message T346631

Change 988669 had a related patch set uploaded (by FNegri; author: FNegri):

[operations/puppet@production] dologmsg: standarize logging format

https://gerrit.wikimedia.org/r/988669

Mentioned in SAL (#wikimedia-cloud) [2024-01-08T16:28:30Z] <wmbot~fnegri@tools-sgebastion-10> test message2 T346631

Mentioned in SAL (#wikimedia-cloud) [2024-01-08T17:49:04Z] <wmbot~fnegri@tools-sgebastion-10> test message3 T346631

Mentioned in SAL (#wikimedia-cloud-feed) [2024-01-09T17:49:52Z] <wmbot~fran@wmf3169> START - Cookbook wmcs.do_log_msg (T346631)

Mentioned in SAL (#wikimedia-cloud-feed) [2024-01-09T17:49:58Z] <wmbot~fran@wmf3169> test message2 from local cookbook (T346631)

Mentioned in SAL (#wikimedia-cloud-feed) [2024-01-09T17:50:02Z] <wmbot~fran@wmf3169> END (PASS) - Cookbook wmcs.do_log_msg (exit_code=0) (T346631)

Change 989219 had a related patch set uploaded (by FNegri; author: FNegri):

[cloud/wmcs-cookbooks@main] SAL logging: invert user and project

https://gerrit.wikimedia.org/r/989219

Mentioned in SAL (#wikimedia-cloud-feed) [2024-01-10T16:48:44Z] <wmbot~fran@wmf3169> START - Cookbook wmcs.do_log_msg (T346631)

Mentioned in SAL (#wikimedia-cloud-feed) [2024-01-10T16:48:49Z] <wmbot~fran@wmf3169> test message3 from local cookbook (T346631)

Mentioned in SAL (#wikimedia-cloud-feed) [2024-01-10T16:48:54Z] <wmbot~fran@wmf3169> END (PASS) - Cookbook wmcs.do_log_msg (exit_code=0) (T346631)

Change 988669 merged by FNegri:

[operations/puppet@production] dologmsg: standardize logging format

https://gerrit.wikimedia.org/r/988669

Change 989219 merged by jenkins-bot:

[cloud/wmcs-cookbooks@main] SAL logging: invert user and project

https://gerrit.wikimedia.org/r/989219

Mentioned in SAL (#wikimedia-cloud) [2024-01-12T12:37:34Z] <wmbot~fnegri@tools-sgebastion-10> test dologmsg after merging T346631