예제 #1
0
파일: agent.py 프로젝트: LukeCarrier/hn
    def __init__(self, request, client_address, server):
        """
        Initialise the request.

        Initialises the logger and GPG interface in preparation for handling the
        request. This enables us to write any debugging information to the log
        and retain key metadata to save resources with larger GPG keyrings.
        """

        # Overridden from BaseHTTPRequestHandler
        #
        # This override enables logging to our dedicated request log.

        self._log = logging.getLogger('hn-request')
        self._err = logging.getLogger('hn-error')

        self._gpg = GPG.get_gpg(instancename='hn-agent')

        super().__init__(request, client_address, server)
예제 #2
0
파일: agent.py 프로젝트: LukeCarrier/hn
    def _init_gpg(self):
        """
        Initialise GPG encryption and signing mechanisms.

        See __init__() for more information.
        """

        self._gpg = GPG.get_gpg(gnupghome=self._config['gpg']['key_store'],
                                          instancename='hn-agent')
        gpg_secrets = self._gpg.list_keys(True)

        for key in gpg_secrets:
            if key['fingerprint'] == self._config['gpg']['fingerprint']:
                self._gpg._secret_key = key
                break

        if not hasattr(self._gpg, '_secret_key'):
            self._main_log.error('no GPG private key configured; aborting')
            sys.exit(78)
예제 #3
0
파일: client.py 프로젝트: LukeCarrier/hn
    def _init_gpg(self):

        self._gpg = GPG.get_gpg(gnupghome=self.gpg_dir)