Beispiel #1
0
    def __init__(self, cmdname, args):
        self._cmdname = cmdname
        self._args = args

        logging.root.setLevel({
            0: logging.INFO,
        }.get(self._args.verbose, logging.DEBUG))
        formatter = logging.Formatter(
            "{asctime} [{levelname:.1s}]: {name} {message}", style="{")

        handler = logging.StreamHandler()
        handler.setLevel(logging.DEBUG)
        handler.setFormatter(formatter)
        logging.root.addHandler(handler)

        if self._args.verbose >= 1:
            SubprocessExecutor.set_failed_verbose()
        if self._args.verbose >= 2:
            SubprocessExecutor.set_all_verbose()
        if self._args.verbose >= 3:
            SubprocessExecutor.pause_after_failed_execution()

        self._log = logging.getLogger("x509sak." + self.__class__.__name__)
Beispiel #2
0
    from x509sak.actions.ActionTestcaseGen import ActionTestcaseGen
except ImportError:
    ActionTestcaseGen = None
from x509sak.CmdLineArgs import KeyValue
from x509sak.KeySpecification import KeySpecification
from x509sak.Exceptions import UserErrorException, InvisibleUserErrorException, CmdExecutionFailedException
from x509sak.SubprocessExecutor import SubprocessExecutor
from .FriendlyArgumentParser import baseint, baseint_unit
from .MultiCommand import MultiCommand

_default_so_search_path = "/usr/local/lib:/usr/lib:/usr/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu/openssl-1.0.2/engines:/usr/lib/x86_64-linux-gnu/engines-1.1"

if "X509SAK_VERBOSE_EXECUTION" in os.environ:
    SubprocessExecutor.set_all_verbose()
if "X509SAK_PAUSE_FAILED_EXECUTION" in os.environ:
    SubprocessExecutor.pause_after_failed_execution()
if "X509SAK_PAUSE_BEFORE_EXECUTION" in os.environ:
    SubprocessExecutor.pause_before_execution()

mc = MultiCommand()


def genparser(parser):
    parser.add_argument(
        "-s",
        "--ca-source",
        metavar="path",
        action="append",
        default=[],
        help=
        "CA file (PEM format) or directory (containing .pem/.crt files) to include when building the chain. Can be specified multiple times to include multiple locations."