Check_radius return Auth error when runned from cron job

I’ve configured one service for radius check. Cron job execute this check within “/opt/librenms/services-wrapper.py 1”.

When “/opt/librenms/services-wrapper.py 1” runs from cron job, check_radius service will return Auth Error. However if I start “/opt/librenms/services-wrapper.py 1” manually, check_radius service return Auth OK.

Anyone an idea what can be reason for this issue?

Output of ./validate.php

====================================
Component | Version
--------- | -------
LibreNMS  | 22.2.1-12-g42c16de54
DB Schema | 2022_02_03_164059_increase_auth_id_length (235)
PHP       | 7.4.13
Python    | 3.6.8
MySQL     | 10.3.17-MariaDB
RRDTool   | 1.7.0
SNMP      | 5.8
====================================

[OK]    Composer Version: 2.2.7
[OK]    Dependencies up-to-date.
[OK]    Database connection successful
[OK]    Database schema correct
[WARN]  Your install is over 24 hours out of date, last update: Sun, 06 Mar 2022 18:52:50 +0000
        [FIX]:
        Make sure your daily.sh cron is running and run ./daily.sh by hand to see if there are any errors.
[WARN]  Your local git contains modified files, this could prevent automatic updates.
        [FIX]:
        You can fix this with ./scripts/github-remove
        Modified Files:
         config/hashing.php
         config/tinker.php

Following is debug output when wrapper has been started from cron job

Nagios Service - 57
Request:  '/usr/lib64/nagios/plugins/check_radius' '-H' 'MY_RADIUS_SERVER_IP' '-F' '/etc/radiusclient/radiusclient.conf' '-u' 'RADIUS_USERNAME' '-p' 'USERS_PASSWORD'
Perf Data - None.
Response: Auth Error
/opt/librenms/check-services.php 2022-03-08 20:00:30 - 1 services polled in 0.020 secs


And following is debug output when wrapper has been started manually

Nagios Service - 57
Request:  '/usr/lib64/nagios/plugins/check_radius' '-H' 'MY_RADIUS_SERVER_IP' '-F' '/etc/radiusclient/radiusclient.conf' '-u' 'RADIUS_USERNAME' '-p' 'USERS_PASSWORD'
Perf Data - None.
Response: Auth OK
/opt/librenms/check-services.php 2022-03-08 20:12:45 - 1 services polled in 0.034 secs

Are you running the services-wrapper.py script as the same user as your cron? Should be librenms user.

1 Like

You are right @laf. Manually I run the wrapper as a root. After a troubleshooting I found that my “/etc/radiusclient/server” has not appropriate file permissions to be read by “librenms” user. After correcting permissions everything works fine.
Thank you very much

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.