This file is indexed.

/usr/sbin/argonaut-clean-audit is in argonaut-fusiondirectory 1.0-1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#!/usr/bin/perl

#######################################################################
#
# Cleaning old audit entries
#
# Copyright (C) 2015-2016 FusionDirectory project
#
# Author: Côme BERNIGAUD
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
#
#######################################################################

use strict;
use warnings;

use 5.008;

use Argonaut::Libraries::Common qw(:ldap :config);

my $verbose = 0;

sub print_usage
{
  print "Usage : argonaut-clean-audit [--verbose]\n";
  exit(0);
}

foreach my $arg ( @ARGV ) {
  if (lc($arg) eq "--verbose") {
    $verbose = 1;
  } else {
    print_usage();
  }
}

my $config = argonaut_read_config;
my ($ldap,$ldap_base) = argonaut_ldap_handle($config);
argonaut_read_ldap_config(
  $ldap,
  $ldap_base,
  $config,
  '(&(objectClass=fdAuditPluginConf)(fdAuditRotationDelay=*))',
  {
    'delay' => "fdAuditRotationDelay"
  }
);

my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime(time() - $config->{'delay'} * 24 * 60 * 60);
my $date = sprintf("%04d%02d%02d%02d%02d%02dZ", 1900 + $year, 1 + $mon, $mday, $hour, $min, $sec);

my $mesg = $ldap->search( # list obsolete audit events
  base   => $ldap_base,
  filter => "(&(objectClass=fdAuditEvent)(fdAuditDateTime<=$date))",
  attrs => [ 'dn' ]
);
if ($mesg->code != 0) {
  die "LDAP error: " . $mesg->error . "(" . $mesg->code . ")\n";
}

my $count = 0;
foreach my $entry ($mesg->entries()) {
  $mesg = $ldap->delete($entry);
  if ($mesg->is_error()) {
    print "Error: " . $mesg->error . "(" . $mesg->code . ")\n";
  } else {
    $count++;
  }
}
print "Deleted $count audit event entries\n";

__END__

=head1 NAME

argonaut-clean-audit - delete old audit entries from the LDAP

=head1 SYNOPSIS

argonaut-clean-audit [--verbose]

=head1 DESCRIPTION

argonaut-clean-audit is a program used to delete old audit entries from the LDAP.
It reads the delay before deletion from LDAP in fdAuditRotationDelay.

=head1 OPTIONS

=over 3

=item B<--verbose>

be verbose

=back

=head1 BUGS

Please report any bugs, or post any suggestions, to the fusiondirectory mailing list fusiondirectory-users or to
<https://forge.fusiondirectory.org/projects/argonaut-agents/issues/new>

=head1 AUTHORS

Come Bernigaud

=head1 LICENCE AND COPYRIGHT

This code is part of Argonaut Project <https://www.argonaut-project.org/>

=over 1

=item Copyright (C) 2015-2016 FusionDirectory project

=back

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

=cut