sera/commands/allow.py
def allow(ctx, delay, from_ip):
    """Open firewall connection from ip address"""

    if not from_ip:
        ctx.params['from_ip'] = from_ip = requests.get(
            'http://ipinfo.io').json().get('ip')
    args = ['allow', 'from', from_ip]
    if ctx.obj['local']:
        out = run('ufw', args)
        if not out.returncode:
            ip_addr = get_ip_address(from_ip)
            out.subcommand = disallow
            out.params = {'delay': delay, 'from_ip': from_ip}
            out.stdout += 'Resetting firewall on %s in %s minutes' % (ip_addr, str(RESET_TIME))
    else:
        out = remote('allow', ctx)
    return lprint(ctx, out)
Open firewall connection from ip address
Open firewall connection from ip address
Open firewall connection from ip address
def allow(ctx, delay, from_ip):
    if not from_ip:
        ctx.params['from_ip'] = from_ip = requests.get(
            'http://ipinfo.io').json().get('ip')
    args = ['allow', 'from', from_ip]
    if ctx.obj['local']:
        out = run('ufw', args)
        if not out.returncode:
            ip_addr = get_ip_address(from_ip)
            out.subcommand = disallow
            out.params = {'delay': delay, 'from_ip': from_ip}
            out.stdout += 'Resetting firewall on %s in %s minutes' % (ip_addr, str(RESET_TIME))
    else:
        out = remote('allow', ctx)
    return lprint(ctx, out)
def allow ( ctx , delay , from_ip ) : if not from_ip : ctx . params [ 'from_ip' ] = from_ip = requests . get ( 'http://ipinfo.io' ) . json ( ) . get ( 'ip' ) args = [ 'allow' , 'from' , from_ip ] if ctx . obj [ 'local' ] : out = run ( 'ufw' , args ) if not out . returncode : ip_addr = get_ip_address ( from_ip ) out . subcommand = disallow out . params = { 'delay' : delay , 'from_ip' : from_ip } out . stdout += 'Resetting firewall on %s in %s minutes' % ( ip_addr , str ( RESET_TIME ) ) else : out = remote ( 'allow' , ctx ) return lprint ( ctx , out )
Open firewall connection from ip address
Open firewall connection from ip address
"""Open firewall connection from ip address"""
ctx
delay
from_ip