From 6694207ad81137a5feddd3ac201e5e92ca01fcb1 Mon Sep 17 00:00:00 2001 From: Baptiste Jonglez Date: Wed, 11 Feb 2015 23:41:15 +0100 Subject: [PATCH] Allow to configure the location of Bird sockets --- lgproxy.cfg.example | 4 ++++ lgproxy.py | 9 ++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lgproxy.cfg.example b/lgproxy.cfg.example index 490a0b5..79a2428 100644 --- a/lgproxy.cfg.example +++ b/lgproxy.cfg.example @@ -13,6 +13,10 @@ BIND_PORT = 5000 # Who can connect to the proxy to launch Bird commands ACCESS_LIST = ["192.0.2.42", "2001:db8::42"] +# Location of Bird control sockets, example for Debian > wheezy +#BIRD_SOCKET = "/run/bird/bird.ctl" +#BIRD6_SOCKET = "/run/bird/bird6.ctl" + # Source IP for traceroute/traceroute6 IPV4_SOURCE = "192.0.2.1" IPV6_SOURCE = "2001:db8::1" diff --git a/lgproxy.py b/lgproxy.py index 22a060f..a6f7aac 100644 --- a/lgproxy.py +++ b/lgproxy.py @@ -96,9 +96,12 @@ def traceroute(): def bird(): check_accesslist() - if request.path == "/bird": b = BirdSocket(file="/var/run/bird.ctl") - elif request.path == "/bird6": b = BirdSocket(file="/var/run/bird6.ctl") - else: return "No bird socket selected" + if request.path == "/bird": + b = BirdSocket(file=app.config.get("BIRD_SOCKET", "/var/run/bird.ctl")) + elif request.path == "/bird6": + b = BirdSocket(file=app.config.get("BIRD6_SOCKET", "/var/run/bird6.ctl")) + else: + return "No bird socket selected" query = request.args.get("q","") query = unquote(query)