Commit 1a91f3c9 authored by Robin Schneider's avatar Robin Schneider

Make behaviour for UTF-8 decoding errors configurable

parent 0de93289
......@@ -21,6 +21,9 @@ Added
- Allow to exclude/disable checkers using :ref:`exclude_checkers
<fdeunlock__ref_config_exclude_checkers>`. [ypid_]
- Make behaviour for UTF-8 decoding errors configurable as :ref:`codec_error_action
<fdeunlock__ref_config_codec_error_action>`. [ypid_]
Fixed
~~~~~
......
......@@ -53,5 +53,14 @@ Each host has it’s own section. Supported options inside sections:
exclude_checkers =
ChecksumChecker
.. _fdeunlock__ref_config_codec_error_action:
``codec_error_action``
Communication with remote systems is assumed to be UTF-8 encoded.
How should UTF-8 decoding errors be handled?
Set to ``replace`` to convert unknown bytes into the Unicode replacement character.
Defaults to ``strict`` which will cause a ``UnicodeDecodeError`` to be thrown
terminating execution immediately.
:ref:`fdeunlock__ref_host_checkers` might support additional configuration options.
Refer to the :ref:`fdeunlock__ref_host_checkers` section for details.
......@@ -92,7 +92,11 @@ class FdeUnlock(object):
# host key issues.
subprocess.check_call(['ssh', self._original_host, 'true'])
init_shell = SimplifiedPxssh(encoding='utf-8', timeout=7)
init_shell = SimplifiedPxssh(
encoding='utf-8',
codec_errors=self._cfg.get(self._original_host, 'codec_error_action', fallback='strict'),
timeout=7,
)
init_shell.login(self._original_host)
LOG.info("SSH session to initramfs established.")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment