예제 #1
0
def go(mode):
    client = login_from_env()
    blocker = ExaBgpBlocker()
    m = BlockManager(client, blocker)
    if mode == "backfill":
        m.block_all_expected()
    else:
        m.run()
예제 #2
0
def go(mode):
    client = login_from_env()
    blocker = ExaBgpBlocker()
    m = BlockManager(client, blocker)
    if mode == "backfill":
        m.block_all_expected()
    else:
        m.run()
예제 #3
0
def render_config():
    c = login_from_env()
    t = Template(filename=os.getenv("BHR_TEMPLATE"))

    context = {
        "blocked": list(c.get_list()),
        'ip': socket.gethostbyaddr(socket.gethostname())[2][0]
    }

    return t.render(**context)
예제 #4
0
def render_config():
    c = login_from_env()
    t = Template(filename=os.getenv("BHR_TEMPLATE"))

    path_to_bhr_client_exabgp_loop = find_executable("bhr-client-exabgp-loop")
    if not path_to_bhr_client_exabgp_loop:
        raise RuntimeError("Can not find bhr-client-exabgp-loop in $PATH")

    ipv4, ipv6 = get_ips()
    context = {
        "blocked": [],
        'ip': ipv4,
        'ipv6': ipv6,
        "path_to_bhr_client_exabgp_loop": path_to_bhr_client_exabgp_loop,
    }

    return t.render(**context)
예제 #5
0
def render_config():
    c = login_from_env()
    t = Template(filename=os.getenv("BHR_TEMPLATE"))

    path_to_bhr_client_exabgp_loop = find_executable("bhr-client-exabgp-loop")
    if not path_to_bhr_client_exabgp_loop:
        raise RuntimeError("Can not find bhr-client-exabgp-loop in $PATH")

    ipv4, ipv6 = get_ips()
    context = {
        "blocked": [],
        'ip': ipv4,
        'ipv6': ipv6,
        "path_to_bhr_client_exabgp_loop": path_to_bhr_client_exabgp_loop,
    }

    return t.render(**context)
예제 #6
0
파일: run.py 프로젝트: ncsa/bhr-client
def main():
    client = login_from_env()
    blocker = DummyStdoutBlocker()
    m = BlockManager(client, blocker)
    m.run()
예제 #7
0
def main():
    client = login_from_env()
    blocker = ExaBgpBlocker()
    m = BlockManager(client, blocker)
    m.run()
예제 #8
0
def main():
    client = login_from_env()
    #blocker = DummyStdoutBlocker()
    blocker = quaggablocker.QuaggaBlocker()
    m = BlockManager(client, blocker)
    m.run()
예제 #9
0
파일: bhr.py 프로젝트: joeFischetti/bhr-bro
def block(ip, comment, duration):
    from bhr_client.rest import login_from_env
    client = login_from_env()
    duration = int(float(duration)) # Bro sends it as ##.0
    block = client.block(cidr=ip, source='bro', why=comment, duration=duration, autoscale=1)
    return True
예제 #10
0
def main():
    client = login_from_env()

    s = PeerBlocker(client)
    s.run()
예제 #11
0
def main():
    client = login_from_env()

    s = PeerBlocker(client)
    s.run()