Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSSEC sending daily login reports, even if a user hasn't logged in #6748

Closed
nathandyer opened this issue Feb 15, 2023 · 2 comments · Fixed by #6780
Closed

OSSEC sending daily login reports, even if a user hasn't logged in #6748

nathandyer opened this issue Feb 15, 2023 · 2 comments · Fixed by #6780
Assignees

Comments

@nathandyer
Copy link
Contributor

nathandyer commented Feb 15, 2023

Description

Ever since the 2.5.1 release, OSSEC sends a daily email showing either one or two logins on the app server. After investigation, it appears that this is happening as a result of changes made in this commit which changes it so that OSSEC checks run as as the www-data user.

Because it now sends out these false alarms, the daily login report is less useful as a monitoring tool.

Steps to Reproduce

This behavior happens automatically once per day, as long as the server is running and OSSEC alerts are set up correctly.

You can see where this happens by inspecting /var/log/auth.log. A line will appear, containing:

USER=www-data ; COMMAND=/opt/venvs/securedrop-app-code/bin/python3 /var/www/securedrop/manage.py check-disconnected-[db|fs]-submissions

followed by:

session opened for user www-data by (uid=0)

Expected Behavior

A daily login report is only sent in the event of an actual login by an end-user.

@nathandyer nathandyer changed the title OSSEC sending daily login reports OSSEC sending daily login reports, even if a user hasn't logged in Feb 15, 2023
@legoktm
Copy link
Member

legoktm commented Feb 15, 2023

It would be worth checking to see if #6705 fixes this, I don't remember if systemd timers trigger the same pam line about a session being opened. Of course the simpler fix would be to adjust the OSSEC rule.

@zenmonkeykstop
Copy link
Contributor

It probably would - sudo is the culprit here.

@legoktm legoktm added this to the 2.6.0 milestone Feb 21, 2023
legoktm added a commit that referenced this issue Apr 12, 2023
systemd timers are easier to define and offer more flexibility in
running commands. For example, 9169606 would've been a 2 line
change instead of a complex and fragile bash migration.

We clear the old crontabs and enable the timers in d/postinst for now. Once
we migrate to dh_installsystemd, we can let debhelper take care of
activating the timers (dh_systemd_enable will enable both the timer and
service units, which we don't want).

Fixes #6705.
Fixes #6748.
@legoktm legoktm self-assigned this Apr 12, 2023
legoktm added a commit that referenced this issue Apr 12, 2023
systemd timers are easier to define and offer more flexibility in
running commands. For example, 9169606 would've been a 2 line
change instead of a complex and fragile bash migration.

We clear the old crontabs in the postinst and let debhelper enable
the timers.

Turns out uur usage of `dh_systemd_enable` and `dh_systemd_start`
was wrong, because we were calling it multiple times without specifying
explicit unit files, it was adding the same stanza to the postinst/postrm
multiple times. We now invoke it explicitly for each unit we want
enabled/started. Hopefully when we switch to compat 12/dh_installsystemd
we don't need to manually list each one.

Fixes #6705.
Fixes #6748.
legoktm added a commit that referenced this issue Apr 12, 2023
systemd timers are easier to define and offer more flexibility in
running commands. For example, 9169606 would've been a 2 line
change instead of a complex and fragile bash migration.

We clear the old crontabs in the postinst and let debhelper enable
the timers.

Turns out our usage of `dh_systemd_enable` and `dh_systemd_start`
was wrong, because we were calling it multiple times without specifying
explicit unit files, it was adding the same stanza to the postinst/postrm
multiple times. We now invoke it explicitly for each unit we want
enabled/started. Hopefully when we switch to compat 12/dh_installsystemd
we don't need to manually list each one.

Fixes #6705.
Fixes #6748.
@sssoleileraaa sssoleileraaa moved this to Cycle Backlog in SecureDrop dev cycle May 15, 2023
cfm pushed a commit that referenced this issue May 24, 2023
systemd timers are easier to define and offer more flexibility in
running commands. For example, 9169606 would've been a 2 line
change instead of a complex and fragile bash migration.

We clear the old crontabs in the postinst and let debhelper enable
the timers.

Turns out our usage of `dh_systemd_enable` and `dh_systemd_start`
was wrong, because we were calling it multiple times without specifying
explicit unit files, it was adding the same stanza to the postinst/postrm
multiple times. We now invoke it explicitly for each unit we want
enabled/started. Hopefully when we switch to compat 12/dh_installsystemd
we don't need to manually list each one.

Fixes #6705.
Fixes #6748.
legoktm added a commit that referenced this issue May 25, 2023
systemd timers are easier to define and offer more flexibility in
running commands. For example, 9169606 would've been a 2 line
change instead of a complex and fragile bash migration.

We clear the old crontabs in the postinst and let debhelper enable
the timers.

Turns out our usage of `dh_systemd_enable` and `dh_systemd_start`
was wrong, because we were calling it multiple times without specifying
explicit unit files, it was adding the same stanza to the postinst/postrm
multiple times. We now invoke it explicitly for each unit we want
enabled/started. Hopefully when we switch to compat 12/dh_installsystemd
we don't need to manually list each one.

Fixes #6705.
Fixes #6748.
@cfm cfm closed this as completed in #6780 May 26, 2023
@github-project-automation github-project-automation bot moved this from Cycle Backlog to Done in SecureDrop dev cycle May 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants