funktionierendes setup

This commit is contained in:
kantorkel 2015-12-01 19:29:57 +01:00
parent 2043c88c03
commit 793486ff65
4 changed files with 92 additions and 6 deletions

View file

@ -27,9 +27,9 @@ class alfred_merge:
self.request_data_type_2 = request_data_type_2 self.request_data_type_2 = request_data_type_2
def aliases(self): def aliases(self):
output = subprocess.check_output(["/usr/local/sbin/alfred-json","-z", "-r",str(self.request_data_type_1),"-f","json"]) output = subprocess.check_output(["/usr/local/bin/alfred-json","-z", "-r",str(self.request_data_type_1),"-f","json"])
alfred_data_1 = json.loads(output.decode("utf-8")) alfred_data_1 = json.loads(output.decode("utf-8"))
output = subprocess.check_output(["/usr/local/sbin/alfred-json","-z", "-r",str(self.request_data_type_2),"-f","json"]) output = subprocess.check_output(["/usr/local/bin/alfred-json","-z", "-r",str(self.request_data_type_2),"-f","json"])
alfred_data_2 = json.loads(output.decode("utf-8")) alfred_data_2 = json.loads(output.decode("utf-8"))
return json.dumps(rec_merge(alfred_data_1, alfred_data_2)) return json.dumps(rec_merge(alfred_data_1, alfred_data_2))

86
gateway.json Normal file
View file

@ -0,0 +1,86 @@
[
{
"node_id": "deadbeef0101",
"hostname": "gw01",
"network": {
"mesh": {
"bat0": {
"interfaces": {
"tunnel": [
"de:ad:be:ff:01:01",
"de:ad:bf:ff:01:01"
]
}
}
}
}
},
{
"node_id": "deadbeef0505",
"hostname": "gw02",
"network": {
"mesh": {
"bat0": {
"interfaces": {
"tunnel": [
"de:ad:be:ff:05:05",
"de:ad:be:ff:05:06",
"de:ad:bf:ff:05:05"
]
}
}
}
}
},
{
"node_id": "deadbeef0303",
"hostname": "gw03",
"network": {
"mesh": {
"bat0": {
"interfaces": {
"tunnel": [
"de:ad:be:ff:03:03",
"de:ad:bf:ff:03:03"
]
}
}
}
}
},
{
"node_id": "deadbfff2222",
"hostname": "gw05",
"network": {
"mesh": {
"bat0": {
"interfaces": {
"tunnel": [
"de:ad:be:ff:22:22",
"de:ad:be:ff:22:23",
"de:ad:bf:ff:22:22"
]
}
}
}
}
},
{
"node_id": "deadbeef8888",
"hostname": "gw08",
"network": {
"mesh": {
"bat0": {
"interfaces": {
"tunnel": [
"de:ad:be:ff:88:88",
"de:ad:be:ff:88:89",
"de:ad:bf:ff:88:88"
]
}
}
}
}
}
]

View file

@ -13,7 +13,7 @@ class Alfred(object):
raise RuntimeError('alfred: invalid unix socket path given') raise RuntimeError('alfred: invalid unix socket path given')
def _fetch(self, data_type): def _fetch(self, data_type):
cmd = ['alfred-json', cmd = ['/usr/local/bin/alfred-json',
'-z', '-z',
'-f', 'json', '-f', 'json',
'-r', str(data_type)] '-r', str(data_type)]

View file

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
PATH='/opt/ffmap-backend/' FFMAPPATH='/opt/ffmap-backend/'
PEERS="/etc/fastd/ffhh-mesh-vpn/peers" PEERS="/etc/fastd/ffhh-mesh-vpn/peers"
python2 $PATH/generate_aliases.py $PEERS > $PATH/aliases.json python2 $FFMAPPATH/generate_aliases.py $PEERS > $FFMAPPATH/aliases.json
python3 $PATH/backend.py -d /var/www/meshviewer/data/ -a $PATH/aliases.json --vpn de:ad:be:ff:01:01 python3 $FFMAPPATH/backend.py -d /var/www/meshviewer/ --aliases $FFMAPPATH/aliases.json $FFMAPPATH/gateway.json -m bat0:/var/run/alfred.sock -p 30 --vpn de:ad:be:ff:01:01 --vpn de:ad:be:ff:05:05 --vpn de:ad:be:ff:05:06 --vpn de:ad:be:ff:03:03 --vpn de:ad:be:ff:22:22 --vpn de:ad:be:ff:22:23 --vpn de:ad:be:ff:88:88 --vpn de:ad:be:ff:88:89 --vpn de:ad:bf:ff:88:88 --vpn de:ad:bf:ff:22:22 --vpn de:ad:bf:ff:03:03 --vpn de:ad:bf:ff:05:05 --vpn de:ad:bf:ff:01:01