This file is indexed.

/usr/share/perl5/Octopussy/Configuration.pm is in octopussy 1.0.6-0ubuntu1.

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

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
# $HeadURL$
# $Revision: 595 $
# $Date: 2012-08-28 00:22:16 +0100 (Tue, 28 Aug 2012) $
# $Author: sebthebert $

=head1 NAME

Octopussy::Configuration - Octopussy Configuration module

=cut

package Octopussy::Configuration;

use strict;
use warnings;

use POSIX qw(strftime);

use AAT;
use AAT::FS;
use Octopussy::FS;

my $DIR_BACKUP = '/etc/octopussy/';

=head1 FUNCTIONS

=head2 Set_Backup_Directory($dir)

=cut

sub Set_Backup_Directory
{
    my $dir = shift;
    
    $DIR_BACKUP = $dir;     	
}

=head2 Backup($filename)

=cut

sub Backup
{
	my $filename = shift;

  	my $timestamp   = strftime("%Y%m%d%H%M%S", localtime);
  	Octopussy::FS::Create_Directory($DIR_BACKUP);
  	my $file_backup = $filename || "${DIR_BACKUP}backup_$timestamp.tgz";

  	my $dir_main    = Octopussy::FS::Directory('main'); 
  	my ($dirs, $files) = ('', '');
  
  	foreach my $d (Octopussy::FS::Directories('alerts', 'contacts', 'devices', 'maps', 'plugins', 'reports', 'search_templates', 'services', 'tables'))
  	{
  		$dirs .= "$d " if (-d $d);	
  	}
  
  	foreach my $f (Octopussy::FS::Files('db', 'devicegroups', 'ldap', 'locations', 'nsca', 'proxy', 'schedule', 'servicegroups', 'smtp', 'storages', 'timeperiods', 'users', 'xmpp'))
  	{
  		$files .= "$f "	if (-f $f);
  	}

  	system "tar Picfz $file_backup $dirs $files";
	
  	return ($file_backup);
}

=head2 Backup_List()

Returns List of Backup Files

=cut

sub Backup_List
{
  my @backups = ();

  my @list = AAT::FS::Directory_Files($DIR_BACKUP, qr/^backup_.+$/);
  foreach my $e (reverse sort @list)
  {
    push @backups, {label => "Backup $2/$3/$4 $5:$6:$7", value => $1}
      if ($e =~ /(backup_(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2}))\.tgz/);
  }

  return (@backups);
}

=head2 Restore($file)

Restores configuration from Backup File '$file'

=cut

sub Restore
{
  my $file        = shift;
  my $file_backup = "${DIR_BACKUP}${file}.tgz";
  system "tar Pxfz $file_backup";

  return (1);
}

1;

=head1 AUTHOR

Sebastien Thebert <octo.devel@gmail.com>

=cut