Exemplo n.º 1
0
    context = daemon.DaemonContext(
        working_directory=args['data_dir'],
        pidfile=lock,
        stderr=sys.stderr
    )

    context.signal_map = {
        signal.SIGTERM: 'terminate',
        signal.SIGHUP: 'terminate'
    }

    if args['no_text']:
        args['password'] = ""

    if args['password'] is None:
        args['password'] = get_password(verify=check_with_encrypter)

    encrypter = make_encrypter(args['password'])

    if not check_password.check(args['data_dir'], encrypter):
        print 'Password failed'
        sys.exit(1)

    with context:
        astore = ActivityStore(os.path.join(args['data_dir'], DBNAME), encrypter, store_text=(not args['no_text']))

        try:
            astore.run()
        except SystemExit:
            astore.close()
Exemplo n.º 2
0
        args['password'] = ""

    if args['password'] is None:
        args['password'] = get_password(verify=check_with_encrypter)

    encrypter = make_encrypter(args['password'])

    if not check_password.check(args['data_dir'], encrypter):
        print 'Password failed'
        sys.exit(1)

    if args['change_password']:
        new_password = get_password(message="New Password: ")
        new_encrypter = make_encrypter(new_password)
        print 'Re-encrypting your keys...'
        astore = ActivityStore(os.path.join(args['data_dir'], DBNAME), encrypter, store_text=(not args['no_text']))
        astore.change_password(new_encrypter)
        # delete the old password.digest
        os.remove(os.path.join(args['data_dir'], check_password.DIGEST_NAME))
        check_password.check(args['data_dir'], new_encrypter)
        # don't assume we want the logger to run afterwards
        print 'Exiting...'
        sys.exit(0)

    with context:
        astore = ActivityStore(os.path.join(args['data_dir'], DBNAME), encrypter, store_text=(not args['no_text']))

        try:
            astore.run()
        except SystemExit:
            astore.close()
Exemplo n.º 3
0
    context = daemon.DaemonContext(working_directory=args['data_dir'],
                                   pidfile=lock,
                                   stderr=sys.stderr)

    context.signal_map = {
        signal.SIGTERM: 'terminate',
        signal.SIGHUP: 'terminate'
    }

    if args['no_text']:
        args['password'] = ""

    if args['password'] is None:
        args['password'] = get_password(verify=check_with_encrypter)

    encrypter = make_encrypter(args['password'])

    if not check_password.check(args['data_dir'], encrypter):
        print 'Password failed'
        sys.exit(1)

    with context:
        astore = ActivityStore(os.path.join(args['data_dir'], DBNAME),
                               encrypter,
                               store_text=(not args['no_text']))

        try:
            astore.run()
        except SystemExit:
            astore.close()