- Switched to alfred v15.1 from git

- Add logrotate config (only 1 day history)
This commit is contained in:
Roman Katrincak 2015-12-06 21:41:30 +01:00
parent 6e9eea7f62
commit a596fa870f
5 changed files with 79 additions and 28 deletions

View File

@ -37,7 +37,7 @@ EOF
if [ -f $tempfile ] if [ -f $tempfile ]
then then
/bin/cat "$tempfile" | /bin/gzip | /usr/sbin/alfred -s 158 /bin/cat "$tempfile" | /bin/gzip | /usr/local/sbin/alfred -s 158
fi fi
if [ -f $tempfile ] if [ -f $tempfile ]

View File

@ -40,6 +40,6 @@ done
/sbin/ip link set up dev bat0 /sbin/ip link set up dev bat0
/sbin/ip addr add $communitynetwork.$octet3rd.${localserver#$communityname}/16 broadcast $communitynetwork.255.255 dev bat0 /sbin/ip addr add $communitynetwork.$octet3rd.${localserver#$communityname}/16 broadcast $communitynetwork.255.255 dev bat0
/sbin/ip -6 addr add fda0:747e:ab29:7405:255::${localserver#$communityname}/64 dev bat0 /sbin/ip -6 addr add fda0:747e:ab29:7405:255::${localserver#$communityname}/64 dev bat0
/usr/sbin/alfred -i bat0 > /dev/null 2>&1 & /usr/local/sbin/alfred -i bat0 > /dev/null 2>&1 &
/usr/sbin/batadv-vis -i bat0 -s > /dev/null 2>&1 & /usr/sbin/batadv-vis -i bat0 -s > /dev/null 2>&1 &
/usr/sbin/service bind9 restart /usr/sbin/service bind9 restart

34
files/logrotate.conf Normal file
View File

@ -0,0 +1,34 @@
# see "man logrotate" for details
# rotate log files weekly
#weekly
daily
# keep 4 weeks worth of backlogs
#rotate 4
rotate 0
# create new (empty) log files after rotating old ones
create
# uncomment this if you want your log files compressed
#compress
# packages drop log rotation information into this directory
include /etc/logrotate.d
# no packages own wtmp, or btmp -- we'll rotate them here
/var/log/wtmp {
missingok
monthly
create 0664 root utmp
rotate 1
}
/var/log/btmp {
missingok
monthly
create 0660 root utmp
rotate 1
}
# system-specific logs may be configured here

View File

@ -1,30 +1,31 @@
#!/bin/sh #!/bin/sh
# Stop tunneldigger until bat0 is up # Stop tunneldigger until bat0 is up
/usr/sbin/service tunneldigger stop #/usr/sbin/service tunneldigger stop
# Set unreachable for table 200 # Set unreachable for table 200
/bin/ip route add unreachable 0.0.0.0/0 table iffy #/bin/ip route add unreachable 0.0.0.0/0 table iffy
while ! ping -c 1 -W 1 {{ sn_iffy_traffic }}; do #while ! ping -c 1 -W 1 {{ sn_iffy_traffic }}; do
echo "Waiting for {{ sn_iffy_traffic }} - network interface might be down..." # echo "Waiting for {{ sn_iffy_traffic }} - network interface might be down..."
sleep 5 # sleep 5
done #done
# Activate IP forwarding # Activate IP forwarding
/sbin/sysctl -w net.ipv6.conf.all.forwarding=1 /sbin/sysctl -w net.ipv6.conf.all.forwarding=1
/sbin/sysctl -w net.ipv4.ip_forward=1 /sbin/sysctl -w net.ipv4.ip_forward=1
/sbin/sysctl kernel.panic=10
# Routing table 200 for traffic above port 1023 # Routing table 200 for traffic above port 1023
/bin/grep 200 /etc/iproute2/rt_tables || /bin/echo 200 iffy >> /etc/iproute2/rt_tables #/bin/grep 200 /etc/iproute2/rt_tables || /bin/echo 200 iffy >> /etc/iproute2/rt_tables
# Set table for traffice with mark 4 # Set table for traffice with mark 4
/bin/ip rule add fwmark 0x4 table iffy #/bin/ip rule add fwmark 0x4 table iffy
# Set mark 4 to traffic above port 1023 # Set mark 4 to traffic above port 1023
/sbin/iptables -t mangle -A PREROUTING -p tcp --dport 1024:65535 -s 10.0.0.0/8 ! -d 10.0.0.0/8 -j MARK --set-mark 4 #/sbin/iptables -t mangle -A PREROUTING -p tcp --dport 1024:65535 -s 10.0.0.0/8 ! -d 10.0.0.0/8 -j MARK --set-mark 4
/sbin/iptables -t mangle -A PREROUTING -p udp --dport 1024:65535 -s 10.0.0.0/8 ! -d 10.0.0.0/8 -j MARK --set-mark 4 #/sbin/iptables -t mangle -A PREROUTING -p udp --dport 1024:65535 -s 10.0.0.0/8 ! -d 10.0.0.0/8 -j MARK --set-mark 4
# NAT on eth0 # NAT on eth0
/sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE /sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
@ -33,9 +34,9 @@ done
/sbin/sysctl net.ipv4.conf.bat0.rp_filter=0 /sbin/sysctl net.ipv4.conf.bat0.rp_filter=0
# Set gateway for table 200 # Set gateway for table 200
/bin/ip route replace default via {{ sn_iffy_traffic }} table iffy #/bin/ip route replace default via {{ sn_iffy_traffic }} table iffy
# Start tunneldigger # Start tunneldigger
/usr/sbin/service tunneldigger start #/usr/sbin/service tunneldigger start
exit 0 exit 0

View File

@ -65,6 +65,9 @@
- gre_backbone.sh - gre_backbone.sh
authorized_keys: authorized_keys:
- authorized_keys - authorized_keys
logrotate_config:
- logrotate.conf
tasks: tasks:
- name: Remove cdrom in sources.list - name: Remove cdrom in sources.list
@ -157,26 +160,39 @@
- systemctl daemon-reload - systemctl daemon-reload
- systemctl enable tunneldigger.service - systemctl enable tunneldigger.service
when: tunneldigger.changed when: tunneldigger.changed
- name: Check if alfred is installed - name: Copy logrotate config
command: dpkg-query -W alfred copy: src=./files/{{ item }} dest=/etc/ owner=root group=root mode=0500
register: alfred_check_deb with_items: logrotate_config
failed_when: alfred_check_deb.rc > 1 - shell: test -f /usr/local/sbin/alfred
changed_when: alfred_check_deb.rc == 1 register: alfred_file
- name: Download alfred failed_when: alfred_file.rc > 1
get_url: changed_when: alfred_file.rc == 1
url="https://firmware.freifunk-wuppertal.net/deb/alfred_2015.0_amd64.deb" - name: Get alfred
dest="/tmp/alfred_2015.0_amd64.deb" git: repo=http://git.open-mesh.org/alfred.git
when: alfred_check_deb.rc == 1 dest=/tmp/alfred
- name: Install alfred register: git_alfred
apt: deb="/tmp/alfred_2015.0_amd64.deb" when: alfred_file.rc == 1
sudo: False - name: make alfred
when: alfred_check_deb.rc == 1 shell: cd /tmp/alfred && git checkout v2015.1 && make && make install
register: git_alfred
when: alfred_file.rc == 1
# - name: Download alfred
# get_url:
# url="https://firmware.freifunk-wuppertal.net/deb/alfred_2015.0_amd64.deb"
# dest="/tmp/alfred_2015.0_amd64.deb"
# when: alfred_check_deb.rc == 1
# - name: Install alfred
# apt: deb="/tmp/alfred_2015.0_amd64.deb"
# sudo: False
# when: alfred_check_deb.rc == 1
# - name: copy openvpn files # - name: copy openvpn files
# copy: src=./files/{{ item }} dest=/etc/openvpn owner=root group=root mode=0400 # copy: src=./files/{{ item }} dest=/etc/openvpn owner=root group=root mode=0400
# with_items: openvpn_files # with_items: openvpn_files
# - name: copy openvpn scripts # - name: copy openvpn scripts
# copy: src=./files/{{ item }} dest=/etc/openvpn owner=root group=root mode=0500 # copy: src=./files/{{ item }} dest=/etc/openvpn owner=root group=root mode=0500
# with_items: openvpn_scripts # with_items: openvpn_scripts
- name: Create freifunk directory - name: Create freifunk directory
file: path=/opt/freifunk state=directory mode=0755 file: path=/opt/freifunk state=directory mode=0755
- name: Check gateway / keepalive script - name: Check gateway / keepalive script