Class AbstractSNPGuestWrapper

java.lang.Object
com.suse.coco.module.snpguest.execution.AbstractSNPGuestWrapper
Direct Known Subclasses:
SNPGuestWrapperVer07Below, SNPGuestWrapperVer09Above

public abstract class AbstractSNPGuestWrapper extends Object
Wrapper to execute the command line tool SNPGuest.
  • Field Details

    • STDOUT_MARKER

      protected static final org.apache.logging.log4j.Marker STDOUT_MARKER
    • STDERR_MARKER

      protected static final org.apache.logging.log4j.Marker STDERR_MARKER
    • logger

      protected final org.apache.logging.log4j.Logger logger
    • SNPGUEST

      protected static final Path SNPGUEST
    • runtime

      protected final Runtime runtime
  • Constructor Details

    • AbstractSNPGuestWrapper

      protected AbstractSNPGuestWrapper()
      Default constructor.
    • AbstractSNPGuestWrapper

      protected AbstractSNPGuestWrapper(Runtime runtimeIn)
      Constructor to specify a runtime. For unit testing.
      Parameters:
      runtimeIn - the runtime used to execute processes
  • Method Details

    • fetchVCEK

      public abstract ProcessOutput fetchVCEK(EpycGeneration generation, Path certsDir, Path report) throws ExecutionException
      Fetch the VCEK from the KDS.
      Parameters:
      generation - Specify the processor model for the certificate chain.
      certsDir - Directory to store the certificates in
      report - Path to attestation report to use to request VCEK
      Returns:
      the exit code of the fetching process
      Throws:
      ExecutionException - when an error happens during the process execution
    • verifyCertificates

      public ProcessOutput verifyCertificates(Path certsDir) throws ExecutionException
      Verify the certificate chain.
      Parameters:
      certsDir - Path to directory containing certificate chain
      Returns:
      the exit code of the verification process
      Throws:
      ExecutionException - when an error happens during the process execution
    • verifyAttestation

      public abstract ProcessOutput verifyAttestation(EpycGeneration generation, Path certsDir, Path report) throws ExecutionException
      Verify the attestation report.
      Parameters:
      generation - Specify the processor model for the certificate chain.
      certsDir - Path to directory containing VCEK.
      report - Path to attestation report to use for validation.
      Returns:
      the exit code of the verification process
      Throws:
      ExecutionException - when an error happens during the process execution
    • displayReport

      public ProcessOutput displayReport(Path report) throws ExecutionException
      Display the attestation report.
      Parameters:
      report - Path to attestation report to use for validation.
      Returns:
      the exit code of the verification process
      Throws:
      ExecutionException - when an error happens during the process execution
    • executeProcess

      protected ProcessOutput executeProcess(String... command) throws ExecutionException
      Executes a commandline process
      Parameters:
      command - the command line to execute
      Returns:
      the exit code returned by the process
      Throws:
      ExecutionException - when an error happens during the process execution
    • getOutput

      private String getOutput(InputStream stream, org.apache.logging.log4j.Marker logMarker) throws IOException
      Throws:
      IOException