예제 #1
0
def revoke_cert(name):
    print 'Revoking: ', name

    decoder = Decoder(None, None)
    app, appsocket = create_app()
    manager = Manager(app)

    with app.app_context():
        cert = Certificate.query.filter_by(name=name).first()

        if cert is not None:
            cert.revoke()

            Certificate.save_certificate_index()
            Certificate.save_revocation_list()

            ser2sock.hup()

            db.session.add(cert)
            db.session.commit()

            print name, 'successfully revoked.'
        else:
            print name, 'not found.'
예제 #2
0
def revoke_cert(name):
    print 'Revoking: ', name

    decoder = Decoder(None, None)
    app, appsocket = create_app()
    manager = Manager(app)

    with app.app_context():
        cert = Certificate.query.filter_by(name=name).first()

        if cert is not None:
            cert.revoke()

            Certificate.save_certificate_index()
            Certificate.save_revocation_list()

            ser2sock.hup()

            db.session.add(cert)
            db.session.commit()

            print name, 'successfully revoked.'
        else:
            print name, 'not found.'
예제 #3
0
def certs():
    reset()

    app, appsocket = create_app()
    manager = Manager(app)

    with app.app_context():
        config_path = Setting(name='ser2sock_config_path', value='/etc/ser2sock')
        db.session.add(config_path)
        db.session.commit()

        ca = Certificate(name='AlarmDecoder CA', status=ACTIVE, type=CA)
        ca.generate(ca.name)

        server = Certificate(name='AlarmDecoder Server', status=ACTIVE, type=SERVER)
        server.generate(server.name, parent=ca)

        internal = Certificate(name='AlarmDecoder Internal', status=ACTIVE, type=INTERNAL)
        internal.generate(internal.name, parent=ca)

        test_1 = Certificate(name='Test #1', status=ACTIVE, type=CLIENT)
        test_1.generate(test_1.name, parent=ca)

        test_2 = Certificate(name='Test #2', status=ACTIVE, type=CLIENT)
        test_2.generate(test_2.name, parent=ca)

        db.session.add(ca)
        db.session.add(server)
        db.session.add(internal)
        db.session.add(test_1)
        db.session.add(test_2)
        db.session.commit()

        path = os.path.join(os.path.sep, 'etc', 'ser2sock', 'certs')
        ca.export(path)
        server.export(path)
        internal.export(path)
        test_1.export(path)
        test_2.export(path)

        Certificate.save_certificate_index()
        Certificate.save_revocation_list()

        ser2sock.hup()
예제 #4
0
def certs():
    reset()

    app, appsocket = create_app()
    manager = Manager(app)

    with app.app_context():
        config_path = Setting(name='ser2sock_config_path',
                              value='/etc/ser2sock')
        db.session.add(config_path)
        db.session.commit()

        ca = Certificate(name='AlarmDecoder CA', status=ACTIVE, type=CA)
        ca.generate(ca.name)

        server = Certificate(name='AlarmDecoder Server',
                             status=ACTIVE,
                             type=SERVER)
        server.generate(server.name, parent=ca)

        internal = Certificate(name='AlarmDecoder Internal',
                               status=ACTIVE,
                               type=INTERNAL)
        internal.generate(internal.name, parent=ca)

        test_1 = Certificate(name='Test #1', status=ACTIVE, type=CLIENT)
        test_1.generate(test_1.name, parent=ca)

        test_2 = Certificate(name='Test #2', status=ACTIVE, type=CLIENT)
        test_2.generate(test_2.name, parent=ca)

        db.session.add(ca)
        db.session.add(server)
        db.session.add(internal)
        db.session.add(test_1)
        db.session.add(test_2)
        db.session.commit()

        path = os.path.join(os.path.sep, 'etc', 'ser2sock', 'certs')
        ca.export(path)
        server.export(path)
        internal.export(path)
        test_1.export(path)
        test_2.export(path)

        Certificate.save_certificate_index()
        Certificate.save_revocation_list()

        ser2sock.hup()