summaryrefslogtreecommitdiff
path: root/puppet/modules
diff options
context:
space:
mode:
authorirregulator <irregulator@riseup.net>2014-05-23 17:28:32 +0300
committerelijah <elijah@riseup.net>2014-07-01 16:05:41 -0700
commit7a54923591125894440b9ff7020e4b413a1c6fb5 (patch)
treeb54089264bdd00ad8ea333a60ffea2e3eccc1f71 /puppet/modules
parent2f318f0be937f0bace467640f4011ba422a736b7 (diff)
Address logging for obfsproxy daemon
Create obfsproxy directory in /var/log, specify log file when obfsproxy is spawned by init script, create a logrotate configuration for obfsproxy's logs.
Diffstat (limited to 'puppet/modules')
-rwxr-xr-xpuppet/modules/obfsproxy/files/obfsproxy_init5
-rw-r--r--puppet/modules/obfsproxy/files/obfsproxy_logrotate14
-rw-r--r--puppet/modules/obfsproxy/manifests/init.pp16
3 files changed, 33 insertions, 2 deletions
diff --git a/puppet/modules/obfsproxy/files/obfsproxy_init b/puppet/modules/obfsproxy/files/obfsproxy_init
index 5223ec9d..7a7e7609 100755
--- a/puppet/modules/obfsproxy/files/obfsproxy_init
+++ b/puppet/modules/obfsproxy/files/obfsproxy_init
@@ -19,6 +19,7 @@ USER=obfsproxy
DATDIR=/etc/obfsproxy
PIDFILE=/var/run/obfsproxy.pid
CONF=$DATDIR/obfsproxy.conf
+LOGFILE=/var/log/obfsproxy/log
# If the daemon is not there, then exit.
test -x $DAEMON || exit 0
@@ -30,8 +31,8 @@ else
exit 2
fi
-DAEMONARGS=" --log-min-severity=$LOG --data-dir=$DATDIR $TRANSPORT \
- $PARAM --dest=$DEST_IP:$DEST_PORT server 0.0.0.0:$PORT"
+DAEMONARGS=" --log-min-severity=$LOG --log-file=$LOGFILE --data-dir=$DATDIR \
+ $TRANSPORT $PARAM --dest=$DEST_IP:$DEST_PORT server 0.0.0.0:$PORT"
start_obfsproxy() {
start-stop-daemon --start --quiet --oknodo -m --pidfile $PIDFILE \
diff --git a/puppet/modules/obfsproxy/files/obfsproxy_logrotate b/puppet/modules/obfsproxy/files/obfsproxy_logrotate
new file mode 100644
index 00000000..623bbab1
--- /dev/null
+++ b/puppet/modules/obfsproxy/files/obfsproxy_logrotate
@@ -0,0 +1,14 @@
+/var/log/obfsproxy/log {
+ weekly
+ missingok
+ rotate 10
+ compress
+ delaycompress
+ notifempty
+ create 600 obfsproxy obfsproxy
+ postrotate
+ if [ -f /var/run/obfsproxy.pid ]; then
+ /etc/init.d/obfsproxy restart > /dev/null
+ fi
+ endscript
+}
diff --git a/puppet/modules/obfsproxy/manifests/init.pp b/puppet/modules/obfsproxy/manifests/init.pp
index 456fe1a7..9ba2d0fd 100644
--- a/puppet/modules/obfsproxy/manifests/init.pp
+++ b/puppet/modules/obfsproxy/manifests/init.pp
@@ -48,6 +48,22 @@ class obfsproxy (
mode => '0700',
}
+ file { '/var/log/obfsproxy':
+ ensure => directory,
+ owner => $user,
+ group => $user,
+ mode => '0750',
+ }
+
+ file { '/etc/logrotate.d/obfsproxy':
+ ensure => present,
+ source => 'puppet:///modules/obfsproxy/obfsproxy_logrotate',
+ owner => 'root',
+ group => 'root',
+ mode => '0644',
+ require => File['/var/log/obfsproxy'],
+ }
+
package { 'obfsproxy':
ensure => present,
}