Compare commits
2 Commits
299716ee31
...
eccc82a9cc
Author | SHA1 | Date |
---|---|---|
Niklas Yann Wettengel | eccc82a9cc | 3 weeks ago |
Niklas Yann Wettengel | 0facfe0686 | 3 weeks ago |
@ -1,7 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
for file in /run/ff*.socket
|
||||
do
|
||||
echo $file
|
||||
nc -U $file | jq -r '.peers | keys[] as $k | "\(.[$k] | .connection.mac_addresses[]) \(.[$k] | .address) \($k)"' | grep $1
|
||||
done
|
@ -1,6 +0,0 @@
|
||||
#!/bin/sh
|
||||
if grep -q $PEER_KEY /etc/fastd_blacklist; then
|
||||
echo $PEER_KEY blacklisted
|
||||
exit 1
|
||||
fi
|
||||
exit 0
|
@ -1,40 +0,0 @@
|
||||
---
|
||||
- name: reload fastd
|
||||
systemd:
|
||||
name: fastd@ffmyk.service
|
||||
state: reloaded
|
||||
|
||||
- name: restart fastdaw
|
||||
systemd:
|
||||
name: fastd@ffaw.service
|
||||
state: restarted
|
||||
|
||||
- name: restart fastdcoc
|
||||
systemd:
|
||||
name: fastd@ffcoc.service
|
||||
state: restarted
|
||||
|
||||
- name: restart fastdems
|
||||
systemd:
|
||||
name: fastd@ffems.service
|
||||
state: restarted
|
||||
|
||||
- name: restart fastdko
|
||||
systemd:
|
||||
name: fastd@ffko.service
|
||||
state: restarted
|
||||
|
||||
- name: restart fastdmy
|
||||
systemd:
|
||||
name: fastd@ffmy.service
|
||||
state: restarted
|
||||
|
||||
- name: restart fastdsim
|
||||
systemd:
|
||||
name: fastd@ffsim.service
|
||||
state: restarted
|
||||
|
||||
- name: restart fastdww
|
||||
systemd:
|
||||
name: fastd@ffww.service
|
||||
state: restarted
|
@ -1,61 +0,0 @@
|
||||
---
|
||||
- name: install fastd
|
||||
pacman:
|
||||
name: fastd
|
||||
state: present
|
||||
|
||||
- name: create site folder
|
||||
file:
|
||||
path: /etc/fastd/ff{{ item.name }}
|
||||
state: directory
|
||||
with_items: "{{ sites }}"
|
||||
|
||||
- name: fastd.conf
|
||||
template:
|
||||
src: fastd.conf.j2
|
||||
dest: /etc/fastd/ff{{ item.name }}/fastd.conf
|
||||
mode: 0640
|
||||
notify: restart fastd{{ item.name }}
|
||||
with_items: "{{ sites }}"
|
||||
|
||||
- name: add fastd bin folder
|
||||
file:
|
||||
path: /etc/fastd/ff{{ item.name }}/bin
|
||||
state: directory
|
||||
with_items: "{{ sites }}"
|
||||
|
||||
- name: add fastd up script
|
||||
template:
|
||||
src: fastd_up.sh.j2
|
||||
dest: /etc/fastd/ff{{ item.name }}/bin/up.sh
|
||||
mode: 0744
|
||||
notify: restart fastd{{ item.name }}
|
||||
with_items: "{{ sites }}"
|
||||
|
||||
- name: add fastd verify script
|
||||
copy:
|
||||
src: verify.sh
|
||||
dest: /etc/fastd/ff{{ item.name }}/bin/verify.sh
|
||||
mode: 0744
|
||||
with_items: "{{ sites }}"
|
||||
|
||||
- name: add fastd_grep script
|
||||
copy:
|
||||
src: fastd_grep.sh
|
||||
dest: /root/fastd_grep.sh
|
||||
mode: 0744
|
||||
|
||||
- name: install fastd_grep dependencies
|
||||
pacman:
|
||||
name:
|
||||
- openbsd-netcat
|
||||
- jq
|
||||
state: present
|
||||
|
||||
|
||||
- name: start and enable fastd service
|
||||
systemd:
|
||||
name: fastd@ff{{ item.name }}.service
|
||||
enabled: yes
|
||||
state: started
|
||||
with_items: "{{ sites }}"
|
@ -1,45 +0,0 @@
|
||||
#!/usr/bin/php -f
|
||||
<?php
|
||||
//$url = 'http://register.freifunk-myk.de/srvapi.php';
|
||||
$url = 'https://www.freifunk-myk.de/node/keys';
|
||||
$out = '/etc/fastd/ff{{ item.name }}/peers/';
|
||||
|
||||
if(!is_dir($out)) die('Output Dir missing');
|
||||
if(!is_writable($out)) die('Output Dir perms');
|
||||
|
||||
if( ($data = file_get_contents($url)) === FALSE ) die('Error getting keys');
|
||||
$data = unserialize($data);
|
||||
|
||||
$active=array();
|
||||
|
||||
foreach($data as $router) {
|
||||
$router['MAC'] = trim($router['MAC']);
|
||||
$router['PublicKey'] = trim($router['PublicKey']);
|
||||
if(!preg_match('/^[A-F0-9]{2}:[A-F0-9]{2}:[A-F0-9]{2}:[A-F0-9]{2}:[A-F0-9]{2}:[A-F0-9]{2}$/', $router['MAC'])) {
|
||||
//trigger_error('Router mit falscher MAC?!', E_USER_WARNING);
|
||||
}elseif(!preg_match('/^[A-F0-9]{64}$/', $router['PublicKey'])) {
|
||||
//trigger_error('Router mit falschem Key?!'.$router['MAC'], E_USER_WARNING);
|
||||
}else{
|
||||
$filename='client_'.str_replace(':', '-', $router['MAC']);
|
||||
$fp=fopen($out.$filename, 'w');
|
||||
fwrite($fp, 'key "'.$router['PublicKey'].'";'."\n");
|
||||
fclose($fp);
|
||||
$active[] = $filename;
|
||||
}
|
||||
}
|
||||
|
||||
//Check if we fscked up
|
||||
if(count($active) < 10) die('Less than 10 nodes? Database broken?');
|
||||
|
||||
$dh = opendir($out);
|
||||
while(($file = readdir($dh)) !== false) {
|
||||
if($file != '.' && $file != '..') {
|
||||
if(!in_array($file, $active) && (strpos($file, 'client_') !== false)) {
|
||||
unlink($out.$file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exec('killall -SIGHUP fastd');
|
||||
|
||||
?>
|
@ -1,13 +0,0 @@
|
||||
log to syslog level info;
|
||||
interface "vpn{{ item.name }}";
|
||||
method "salsa2012+gmac";
|
||||
method "salsa2012+umac";
|
||||
secure handshakes yes;
|
||||
bind any:{{ item.fastd_port1 }};
|
||||
hide ip addresses yes;
|
||||
hide mac addresses yes;
|
||||
mtu 1280;
|
||||
secret "{{ item.fastd_secret }}";
|
||||
on up "/etc/fastd/ff{{ item.name }}/bin/up.sh $INTERFACE";
|
||||
status socket "/run/ff{{ item.name }}1.socket";
|
||||
on verify "/etc/fastd/ff{{ item.name }}/bin/verify.sh";
|
@ -1,11 +0,0 @@
|
||||
#!/bin/bash
|
||||
ip link set address {{ item.fastd_mesh_mac }} dev $1
|
||||
ip link set up dev $1
|
||||
batctl meshif bat{{ item.name }} if add $1
|
||||
batctl meshif bat{{ item.name }} gw server 1000000/1000000
|
||||
batctl meshif bat{{ item.name }} it 10000
|
||||
batctl meshif bat{{ item.name }} mm 1
|
||||
batctl meshif bat{{ item.name }} hop_penalty 64
|
||||
netctl start bat{{ item.name }}
|
||||
systemctl restart dhcpd4.service
|
||||
systemctl restart named.service
|
Loading…
Reference in New Issue