You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
712 B

from flask import Flask
from flask_gnupg import GnuPG
import json
from nagrest.nag_parse import NagParse
app = Flask(__name__)
app.config['GPG_HOME_DIR'] = "/root/.gnupg"
app.config['GPG_BINARY'] = "/usr/bin/gpg"
gpg = GnuPG(app)
parser = NagParse()
@app.route('/')
def index():
keys_list = gpg.list_keys()
for key in keys_list:
gpg.trust_keys(key['fingerprint'], 'TRUST_ULTIMATE')
file = "/app/keys/test.sig"
with open(file, 'rb') as fh:
verified = gpg.decrypt_file(fh)
if verified.trust_level == verified.TRUST_ULTIMATE:
return str(verified).strip()
return '{}'
if __name__ == "__main__":
# use 0.0.0.0 to use it in container
app.run(host='0.0.0.0')