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

function piholeStatus() is flooding syslog with www-data sudo to root messages #4615

Open
thelner opened this issue Feb 15, 2022 · 6 comments
Open
Labels
Fixed in next release Investigating

Comments

@thelner
Copy link

@thelner thelner commented Feb 15, 2022

Versions

Pi-hole version is v5.9 (Latest: v5.9)
AdminLTE version is v5.11 (Latest: v5.11)
FTL version is v5.14 (Latest: v5.14)

Platform

  • OS and version:
    Debian GNU/Linux 11 (Raspberry Pi OS (64-bit))

  • Platform:
    Raspberry Pi 4

Actual behavior / bug

With the addition of "Use piholeStatus() in header.php #2062", every time "function piholeStatus()" (scripts/pi-hole/php/func.php) is called, this is written to the systemd journal once per second the entire time the pi-hole web page is loaded:

Feb 15 12:11:50 pihole4 sudo[120279]: www-data : PWD=/var/www/html/admin ; USER=root ; COMMAND=/usr/local/bin/pihole status web
Feb 15 12:11:50 pihole4 sudo[120279]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=33)
Feb 15 12:11:50 pihole4 sudo[120279]: pam_unix(sudo:session): session closed for user root

This is not only flooding the systemd journal but causing high system loads because of IO wait.

Steps to reproduce

Steps to reproduce the behavior:

  1. Load Pi-Hole webpage
  2. View systemd journal: $ sudo journalctl -xe

Debug Token

https://tricorder.pi-hole.net/YqF94i7Y/

Additional Info

To temporarily solve this, I edited scripts/pi-hole/php/func.php to stop calling pihole_execute('status web'):

function piholeStatus()
{
// Receive the return of "pihole status web"
// $pistatus = pihole_execute('status web');
$pistatus = '53';
return isset($pistatus[0]) ? intval($pistatus[0]) : -2;
}

@zoqaeski
Copy link

@zoqaeski zoqaeski commented Feb 15, 2022

I've also noticed this behaviour since the new update.

@yubiuser
Copy link
Sponsor Member

@yubiuser yubiuser commented Feb 16, 2022

I can confirm the behavior but I'm not sure if this is new. Before pi-hole/AdminLTE#2062 header.php directly called pihole_execute('status web'). Now it calls piholeStatus() in func.php which itself also only calls pihole_execute('status web')

https://github.com/pi-hole/AdminLTE/blob/64bbce906b31c213183db7b6f0547513423e4bbf/scripts/pi-hole/php/func.php#L487-L491

@yubiuser yubiuser added the Investigating label Feb 16, 2022
@yubiuser
Copy link
Sponsor Member

@yubiuser yubiuser commented Feb 16, 2022

I think the "real" issue is a more general one: the pihole script checks for root privileges right at the start and not only for functions that need it. E.g. pihole status and pihole -h should not require root access. See #2927

@pralor-bot
Copy link

@pralor-bot pralor-bot commented Feb 16, 2022

This issue has been mentioned on Pi-hole Userspace. There might be relevant details there:

https://discourse.pi-hole.net/t/pi-hole-spamming-auth-log/53637/2

@github-actions
Copy link

@github-actions github-actions bot commented Mar 18, 2022

This issue is stale because it has been open 30 days with no activity. Please comment or update this issue or it will be closed in 5 days.

@github-actions github-actions bot added the stale label Mar 18, 2022
@yubiuser
Copy link
Sponsor Member

@yubiuser yubiuser commented Mar 18, 2022

Should be mitigated by pi-hole/AdminLTE#2126

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed in next release Investigating
Projects
None yet
Development

No branches or pull requests

4 participants