Exemplo n.º 1
0
def run_live_system_init():
    if not sys.platform.startswith("linux"):
        return
    from toughradius.tools import livecd

    # create database
    shell.run('echo "create database toughradius DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;" | mysql')
    # setup mysql user and passwd
    shell.run(
        "echo \"GRANT ALL ON toughradius.* TO radiusd@'127.0.0.1' IDENTIFIED BY 'root' WITH GRANT OPTION;FLUSH PRIVILEGES;\" | mysql"
    )
    shell.run("mkdir -p /var/toughradius/log")
    shell.run("mkdir -p /var/toughradius/data")

    with open("/etc/radiusd.conf", "wb") as ef:
        ef.write(livecd.echo_radiusd_cnf())

    with open("/var/toughradius/privkey.pem", "wb") as ef:
        ef.write(livecd.echo_privkey_pem())

    with open("/var/toughradius/cacert.pem", "wb") as ef:
        ef.write(livecd.echo_cacert_pem())

    shell.run("toughctl --initdb")

    if not os.path.exists("/etc/init.d/radiusd"):
        with open("/etc/init.d/radiusd", "wb") as rf:
            rf.write(livecd.echo_radiusd_script())
        shell.run("chmod +x /etc/init.d/radiusd")
        shell.run("update-rc.d radiusd defaults")

    shell.run("/etc/init.d/radiusd start", raise_on_fail=True)
Exemplo n.º 2
0
def run_live_system_init():
    from toughradius.tools import livecd
    # create database
    shell.run(
        "echo \"create database toughradius DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;\" | mysql"
    )
    # setup mysql user and passwd
    shell.run(
        "echo \"GRANT ALL ON toughradius.* TO radiusd@'127.0.0.1' IDENTIFIED BY 'root' WITH GRANT OPTION;FLUSH PRIVILEGES;\" | mysql"
    )
    shell.run("mkdir -p /var/toughradius/log")
    shell.run("mkdir -p /var/toughradius/data")

    with open("/etc/radiusd.conf", 'wb') as ef:
        ef.write(livecd.echo_radiusd_cnf())

    with open("/var/toughradius/privkey.pem", 'wb') as ef:
        ef.write(livecd.echo_privkey_pem())

    with open("/var/toughradius/cacert.pem", 'wb') as ef:
        ef.write(livecd.echo_cacert_pem())

    shell.run("toughctl --initdb")

    if not os.path.exists("/etc/init.d/radiusd"):
        with open("/etc/init.d/radiusd", 'wb') as rf:
            rf.write(livecd.echo_radiusd_script())
        shell.run("chmod +x /etc/init.d/radiusd")
        shell.run("update-rc.d radiusd defaults")

    shell.run("/etc/init.d/radiusd start", raise_on_fail=True)
Exemplo n.º 3
0
def run_echo_radiusd_script():
    from toughradius.tools import livecd

    print livecd.echo_radiusd_script()
Exemplo n.º 4
0
def run_echo_radiusd_script():
    from toughradius.tools import livecd
    print livecd.echo_radiusd_script()