Skip to content

Commit

Permalink
feat: Add TacticalRMM Remote_Mgmt support on linux
Browse files Browse the repository at this point in the history
  • Loading branch information
g-bougard committed Jul 8, 2024
1 parent 99736dd commit 8442a20
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Changes
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ inventory:
This is also an attempt to start antivirus support on Windows Server based on
service detection.
* Add support for Cortex XDR Antivirus on MacOSX and linux
* fix #700: Add TacticalRMM Remote_Mgmt module for windows
* fix #700: Add TacticalRMM Remote_Mgmt module for windows and linux
* Update Solaris OS installation date support

netdiscovery/netinventory:
Expand Down
40 changes: 27 additions & 13 deletions lib/GLPI/Agent/Task/Inventory/Generic/Remote_Mgmt/TacticalRMM.pm
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use warnings;
use parent 'GLPI::Agent::Task::Inventory::Module';

use English qw(-no_match_vars);
use Cpanel::JSON::XS;

use GLPI::Agent::Tools;

Expand All @@ -26,6 +27,8 @@ sub isEnabled {

return 1 if defined($key);

} elsif (OSNAME eq 'linux') {
return 1 if has_file('/etc/tacticalagent');
}

return 0;
Expand Down Expand Up @@ -57,6 +60,21 @@ sub _getAgentId {
my (%params) = @_;

return _winBased(%params) if OSNAME eq 'MSWin32';
return _linuxBased(%params) if OSNAME eq 'linux';
}

sub _linuxBased {
my (%params) = @_;

my $config = getAllLines(
file => '/etc/tacticalagent',
%params
);

my $json = decode_json($config)
or return;

return $json->{agentid};
}

sub _winBased {
Expand All @@ -73,20 +91,16 @@ sub _winBased {
sub _getVersion {
my (%params) = @_;

my $version;

if (OSNAME eq 'MSWin32') {
my $command = "C:\\Program Files\\TacticalAgent\\tacticalrmm.exe";
if (canRun($command)) {
$version = getFirstMatch(
command => "\"$command\" --version",
pattern => qr/^Tactical RMM Agent:\s+(\S+)/i,
logger => $params{logger}
);
}
}
my $command = OSNAME eq 'MSWin32' ?
'"C:\\Program Files\\TacticalAgent\\tacticalrmm.exe" --version'
:
"rmmagent --version";

return $version;
return getFirstMatch(
command => $command,
pattern => qr/^Tactical RMM Agent:\s+(\S+)/i,
%params
);
}

1;

0 comments on commit 8442a20

Please sign in to comment.