Repository navigation
Closed
Labels
bugUndesired behaviourUndesired behaviourconfirmedBug is confirm by dev teamBug is confirm by dev teamresolvedA fixed issueA fixed issuestatus:confirmedNamespaced Cacti workflow labelNamespaced Cacti workflow labeltype:bugNamespaced Cacti workflow labelNamespaced Cacti workflow label
Milestone
Description
If you dont have a reverse DNS or IP set for the remote poller to verify the main poller
an error reporting you are not authorized to use this service should appear
However I am seeing it does not
here is the function
if (get_nfilter_request_var('action') == 'runquery') {
db_force_remote_cnn();
}
$poller_db_cnn_id = $remote_db_cnn_id;
} else {
$poller_db_cnn_id = false;
}
if (!remote_client_authorized()) {
print 'FATAL: Client authorization failed. You are not authorized to use this service';
exit;
}
set_default_action();
function remote_client_authorized() {
global $config, $poller_db_cnn_id;
/* don't allow to run from the command line */
$client_addr = get_client_addr();
if ($client_addr === false) {
return false;
}
if (!filter_var($client_addr, FILTER_VALIDATE_IP)) {
cacti_log('ERROR: Invalid remote agent client IP Address. Exiting');
return false;
}
$client_name = gethostbyaddr($client_addr);
if ($client_name == $client_addr) {
cacti_log('NOTE: Unable to resolve hostname from address ' . $client_addr, false, 'WEBUI', POLLER_VERBOSITY_MEDIUM);
} else {
$client_name = remote_agent_strip_domain($client_name);
}
$pollers = db_fetch_assoc('SELECT * FROM poller WHERE disabled = ""', true, $poller_db_cnn_id);
if (cacti_sizeof($pollers) > 1) {
foreach($pollers as $poller) {
if (remote_agent_strip_domain($poller['hostname']) == $client_name) {
return true;
} elseif ($poller['hostname'] == $client_addr) {
return true;
}
}
}
cacti_log("Unauthorized remote agent access attempt from $client_name ($client_addr)");
return false;
}
``
Metadata
Metadata
Assignees
Labels
bugUndesired behaviourUndesired behaviourconfirmedBug is confirm by dev teamBug is confirm by dev teamresolvedA fixed issueA fixed issuestatus:confirmedNamespaced Cacti workflow labelNamespaced Cacti workflow labeltype:bugNamespaced Cacti workflow labelNamespaced Cacti workflow label
Activity
bmfmancini commentedon Apr 13, 2024
Viewing device on Master that is located on remote
Remote Poller Log does not record the access attempt
Main poller does not record the error as a unauthorized user but records
[-][1.2.27] - Remote Agent is not recording not authorized agent in log[/-][+][1.2.27] - [QA] - Remote Agent is not recording not authorized agent in log[/+]TheWitness commentedon Apr 13, 2024
Can you do a pull request @bmfmancini ?
bmfmancini commentedon Apr 13, 2024
That function is what already there
I'll do some debug haven't spent much time on it yet
TheWitness commentedon Apr 14, 2024
Can the remote data collector even reach foo.bar.com? If it can not reach it, of course it will error out and the main data collector will never log an issue.
bmfmancini commentedon Apr 14, 2024
the poller IP is correct but the hostname is differnt
So the main can reach the remote but it will not be authorized to admin any devices on it
TheWitness commentedon Apr 14, 2024
So, the warning should be at the remote or at the main?
bmfmancini commentedon Apr 14, 2024
bmfmancini commentedon Apr 14, 2024
TheWitness commentedon Apr 14, 2024
So, the current error is not good enough?
TheWitness commentedon Apr 14, 2024
Or would you like it more meaningful? I would want to de-bounce notification for something like this for sure.
bmfmancini commentedon Apr 14, 2024
It seems to be a regression
Usually the remote would log that an error has occurred and the main would display an authorization failure not thag it cannot connect to the poller
[-][1.2.27] - [QA] - Remote Agent is not recording not authorized agent in log[/-][+]Remote Agent is not recording not authorized agent in log[/+]Fixing #5725 - Remote Data Collector logging
bmfmancini commentedon Apr 14, 2024
This is good now 👍
Fixing #5725 - Remote Data Collector logging
[-]Remote Agent is not recording not authorized agent in log[/-][+]Unauthorized agents should be recorded into logs[/+]