-
Notifications
You must be signed in to change notification settings - Fork 293
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Conflicts: ChangeLog NEWS.asciidoc conf/pf-release lib/pf/config/cached.pm lib/pf/services.pm
- Loading branch information
Showing
382 changed files
with
17,129 additions
and
3,660 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
#!/bin/bash | ||
# lmunro@inverse.ca 20130508 | ||
# License: GNU General Public License 2 (GPL2) | ||
# | ||
# This script is called from heartbeat (or corosync) to manage | ||
# the Barnyard2 resource. | ||
# It is loosely based on the barnyard2 init script. | ||
|
||
# Source function library | ||
. /etc/rc.d/init.d/functions | ||
|
||
# program name | ||
BASE=barnyard2 | ||
|
||
# program options | ||
CONF="/usr/local/$BASE/etc/barnyard2.conf" | ||
GEN_MAP="/usr/local/pf/conf/snort/gen-msg.map" | ||
SID_MAP="/usr/local/pf/conf/snort/sid-msg.map" | ||
LOG_DIR="/var/log/snort" | ||
SPOOL_DIR="/var/log/snort" | ||
LOG_FILE="merged.log" | ||
WALDO_FILE="/var/log/snort/barnyard2.waldo" | ||
DAEMON="-D" | ||
|
||
# Check that $BASE exists. | ||
[ -f /usr/local/bin/$BASE ] || exit 0 | ||
|
||
# source ocf functions | ||
: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/resource.d/heartbeat} | ||
. ${OCF_FUNCTIONS_DIR}/.ocf-shellfuncs | ||
|
||
|
||
RETVAL=0 | ||
|
||
|
||
_get_meta_data() { | ||
cat <<END | ||
<?xml version="1.0"?> | ||
<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd"> | ||
<resource-agent name="Barnyard"> | ||
<version>1.0</version> | ||
<longdesc lang="en"> | ||
The Barnyard resource agent manages the barnyard2 service. | ||
</longdesc> | ||
<shortdesc lang="en"> | ||
Barnyard | ||
</shortdesc> | ||
<parameters> | ||
</parameters> | ||
<actions> | ||
<action name="start" timeout="300" /> | ||
<action name="stop" timeout="100" /> | ||
<action name="monitor" depth="0" timeout="20" interval="20" /> | ||
<action name="meta-data" timeout="5" /> | ||
</actions> | ||
</resource-agent> | ||
END | ||
|
||
return $OCF_SUCCESS | ||
} | ||
|
||
|
||
|
||
_start () { | ||
if [ -n "`/sbin/pidof $BASE`" ]; then | ||
echo -n $"$BASE: already running" | ||
echo "" | ||
exit $OCF_SUCCESS | ||
fi | ||
echo -n "Starting Barnyard: " | ||
/usr/local/bin/$BASE -c $CONF -G $GEN_MAP -S $SID_MAP -d $SPOOL_DIR -l $LOG_DIR -f $LOG_FILE -w $WALDO_FILE $DAEMON | ||
sleep 1 | ||
action "" /sbin/pidof $BASE | ||
RETVAL=$? | ||
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/barnyard2 | ||
} | ||
|
||
_stop () { | ||
echo -n "Shutting down Barnyard: " | ||
killproc /usr/local/bin/$BASE | ||
RETVAL=$? | ||
echo | ||
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/barnyard2 | ||
} | ||
|
||
_monitor () { | ||
status $BASE || RETVAL=7 | ||
} | ||
|
||
_usage () { | ||
echo "Usage: barnyard {start|stop|monitor|meta_data}" | ||
} | ||
|
||
case $__OCF_ACTION in | ||
meta-data) | ||
_get_meta_data | ||
exit $OCF_SUCCESS | ||
;; | ||
start) _start | ||
exit $RETVAL | ||
;; | ||
stop) _stop | ||
;; | ||
monitor) _monitor | ||
exit $RETVAL | ||
;; | ||
*) _usage | ||
exit $OCF_ERR_UNIMPLEMENTED | ||
;; | ||
esac | ||
|
||
exit $? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
#!/usr/bin/perl | ||
use lib qw(/usr/local/pf/lib); | ||
|
||
package pf::dump; | ||
use base qw(pf::cmd::subcmd); | ||
|
||
=head1 NAME | ||
dump add documentation | ||
=head1 SYNOPSIS | ||
dump.pl <config|floatingdevices|profiles_filters|profiles|sources> | ||
=head1 DESCRIPTION | ||
dump | ||
=cut | ||
|
||
|
||
package pf::dump::config; | ||
use base qw(pf::cmd); | ||
use Data::Dumper; | ||
|
||
sub _run { | ||
require pf::config; | ||
print Dumper(\%pf::config::Config); | ||
} | ||
|
||
|
||
package pf::dump::floatingdevices; | ||
use base qw(pf::cmd); | ||
use Data::Dumper; | ||
|
||
sub _run { | ||
require pf::config; | ||
print Dumper(\%pf::config::ConfigFloatingDevices); | ||
} | ||
|
||
package pf::dump::profiles; | ||
use base qw(pf::cmd); | ||
use Data::Dumper; | ||
|
||
sub _run { | ||
require pf::config; | ||
print Dumper(\%pf::config::Profiles_Config); | ||
} | ||
|
||
|
||
package pf::dump::profiles_filters; | ||
use base qw(pf::cmd); | ||
use Data::Dumper; | ||
|
||
sub _run { | ||
require pf::config; | ||
print Dumper(\%pf::config::Profile_Filters); | ||
} | ||
|
||
package pf::dump::sources; | ||
use base qw(pf::cmd); | ||
use Data::Dumper; | ||
|
||
sub _run { | ||
require pf::authentication; | ||
print Dumper(\@pf::authentication::authentication_sources); | ||
} | ||
|
||
package main; | ||
use strict; | ||
use warnings; | ||
use lib qw(/usr/local/pf/lib); | ||
|
||
exit pf::dump->new({args => \@ARGV})->run(); | ||
|
||
|
||
=head1 AUTHOR | ||
Inverse inc. <info@inverse.ca> | ||
=head1 COPYRIGHT | ||
Copyright (C) 2005-2013 Inverse inc. | ||
=head1 LICENSE | ||
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 Street, Fifth Floor, Boston, MA 02110-1301, | ||
USA. | ||
=cut | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/bash | ||
|
||
#Get the log for the current day | ||
|
||
DATE=now | ||
|
||
if [ "$#" != "0" ]; then | ||
DATE="$@" | ||
fi | ||
|
||
PATTERN1="$(date --date="$DATE" +'%b %d').*" | ||
|
||
PATTERN2="$(date --date="$DATE" +'\[%a %b %d').*" | ||
|
||
PATTERN3=".*?$(date --date="$DATE" +'\[%d/%b/%Y').*" | ||
|
||
PATTERN4="$(date --date="$DATE" +'%a %b %d').*" | ||
|
||
LOGDIR=/usr/local/pf/logs | ||
|
||
TEMPDIR=$(mktemp -d) | ||
|
||
TEMPLOGDIRNAME="logs-$(date +'%Y%m%d%H%M%S')" | ||
|
||
TEMPLOGDIR=$TEMPDIR/$TEMPLOGDIRNAME | ||
mkdir $TEMPLOGDIR | ||
|
||
extract_log() { | ||
PATTERN=$1 | ||
shift | ||
while [ "$#" != "0" ];do | ||
LOGNAME="$1" | ||
LOG="$LOGDIR/$LOGNAME" | ||
grep -P -A"$(wc -l $LOG | cut -d' ' -f1)" "$PATTERN1" "$LOG" > "$TEMPLOGDIR/$LOGNAME" | ||
shift | ||
done | ||
} | ||
|
||
extract_log "$PATTERN1" catalyst.log packetfence.log | ||
extract_log "$PATTERN2" admin_error_log portal_error_log webservices_error_log | ||
extract_log "$PATTERN3" admin_access_log portal_access_log webservices_access_log | ||
extract_log "$PATTERN4" radius.log | ||
|
||
tar -C"$TEMPDIR" -zcf $TEMPLOGDIRNAME.tar.gz $TEMPLOGDIRNAME | ||
|
||
rm -rf $TEMPDIR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,11 @@ | ||
# logrotate file for packetfence | ||
|
||
/usr/local/pf/logs/access_log /usr/local/pf/logs/admin_access_log /usr/local/pf/logs/admin_error_log /usr/local/pf/logs/error_log /usr/local/pf/logs/packetfence.log /usr/local/pf/logs/pfdetect /usr/local/pf/logs/pfmon /usr/local/pf/logs/snmptrapd.log /usr/local/pf/logs/radius.log /usr/local/pf/logs/portal_access_log /usr/local/pf/logs/portal_error_log /usr/local/pf/logs/webservices_access_log /usr/local/pf/logs/webservices_error_log /usr/local/pf/logs/catalyst.log { | ||
/usr/local/pf/logs/access_log /usr/local/pf/logs/admin_access_log /usr/local/pf/logs/admin_error_log /usr/local/pf/logs/error_log /usr/local/pf/logs/packetfence.log /usr/local/pf/logs/pfdetect /usr/local/pf/logs/pfmon /usr/local/pf/logs/snmptrapd.log /usr/local/pf/logs/radius.log /usr/local/pf/logs/portal_access_log /usr/local/pf/logs/portal_error_log /usr/local/pf/logs/portal_error_log /usr/local/pf/logs/proxy_access_log /usr/local/pf/logs/webservices_access_log /usr/local/pf/logs/webservices_error_log /usr/local/pf/logs/catalyst.log { | ||
weekly | ||
rotate 52 | ||
missingok | ||
compress | ||
delaycompress | ||
sharedscripts | ||
create 644 pf pf | ||
postrotate | ||
# uncomment the crm statements if you are running packetfence in a corosync cluster | ||
#/usr/sbin/crm resource unmanage PacketFence | ||
/etc/init.d/packetfence condrestart >/dev/null 2>&1 || true | ||
#/usr/sbin/crm resource manage PacketFence | ||
endscript | ||
su pf pf | ||
copytruncate | ||
} |
Oops, something went wrong.