Allow to configure the location of Bird sockets

This commit is contained in:
Baptiste Jonglez 2015-02-11 23:41:15 +01:00
parent 51b35242fa
commit 6694207ad8
2 changed files with 10 additions and 3 deletions

View file

@ -13,6 +13,10 @@ BIND_PORT = 5000
# Who can connect to the proxy to launch Bird commands # Who can connect to the proxy to launch Bird commands
ACCESS_LIST = ["192.0.2.42", "2001:db8::42"] 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 # Source IP for traceroute/traceroute6
IPV4_SOURCE = "192.0.2.1" IPV4_SOURCE = "192.0.2.1"
IPV6_SOURCE = "2001:db8::1" IPV6_SOURCE = "2001:db8::1"

View file

@ -96,9 +96,12 @@ def traceroute():
def bird(): def bird():
check_accesslist() check_accesslist()
if request.path == "/bird": b = BirdSocket(file="/var/run/bird.ctl") if request.path == "/bird":
elif request.path == "/bird6": b = BirdSocket(file="/var/run/bird6.ctl") b = BirdSocket(file=app.config.get("BIRD_SOCKET", "/var/run/bird.ctl"))
else: return "No bird socket selected" 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 = request.args.get("q","")
query = unquote(query) query = unquote(query)