diff --git a/clean_bistreams.sh b/clean_bistreams.sh new file mode 100644 index 0000000..4e21ad9 --- /dev/null +++ b/clean_bistreams.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# Compress bistream files older than 1 hour +find /opt/dionaea/var/dionaea/bistreams/* -type f -mmin +5 -exec gzip {} \; + +# Clear bistream logs from dionaea every day +find /opt/dionaea/var/dionaea/bistreams/* -type f -mtime +60 -exec rm {} \; +find /opt/dionaea/var/dionaea/bistreams/* -type d -empty -delete diff --git a/cron.run b/cron.run new file mode 100644 index 0000000..3d74151 --- /dev/null +++ b/cron.run @@ -0,0 +1,3 @@ +#!/bin/sh +exec 2>&1 +exec cron -f -l \ No newline at end of file diff --git a/dionaea.yml b/dionaea.yml index ce509d7..9f63706 100644 --- a/dionaea.yml +++ b/dionaea.yml @@ -78,6 +78,29 @@ group: nogroup recurse: yes + - name: Dionaea | set clean_bistreams.sh file permissions + file: + path: "/opt/clean_bistreams.sh" + mode: 0755 + + - name: Dionaea | set clean_bistreams.sh cron + cron: + name: "clean bistreams" + job: "/opt/clean_bistreams.sh" + minute: "*/5" + + - name: Dionaea | create cron runit directories + file: + state: directory + path: "/etc/service/cron" + mode: 0755 + + - name: Dionaea | create dionaea runit run file + template: + src: cron.run + dest: "/etc/service/cron/run" + mode: 0755 + - name: Dionaea | copy dionaea sysconfig file copy: dest: "{{ sysconfig_dir }}/dionaea" diff --git a/vars/default.yml b/vars/default.yml index b5d5e70..fd78086 100644 --- a/vars/default.yml +++ b/vars/default.yml @@ -7,6 +7,7 @@ - check - libtool - curl + - cron dionaea_repo: http://github.com/dinotools/dionaea