Class SNPGuestWrapper
- java.lang.Object
-
- com.suse.coco.module.snpguest.execution.SNPGuestWrapper
-
public class SNPGuestWrapper extends java.lang.ObjectWrapper to execute the command line tool SNPGuest.
-
-
Field Summary
Fields Modifier and Type Field Description private static org.apache.logging.log4j.LoggerLOGGERprivate java.lang.Runtimeruntimeprivate static java.nio.file.PathSNPGUESTprivate static org.apache.logging.log4j.MarkerSTDERR_MARKERprivate static org.apache.logging.log4j.MarkerSTDOUT_MARKER
-
Constructor Summary
Constructors Constructor Description SNPGuestWrapper()Default constructor.SNPGuestWrapper(java.lang.Runtime runtimeIn)Constructor to specify a runtime.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ProcessOutputdisplayReport(java.nio.file.Path report)Display the attestation report.protected ProcessOutputexecuteProcess(java.lang.String... command)Executes a commandline processProcessOutputfetchVCEK(EpycGeneration generation, java.nio.file.Path certsDir, java.nio.file.Path report)Fetch the VCEK from the KDS.private static java.lang.StringgetOutput(java.io.InputStream stream, org.apache.logging.log4j.Marker logMarker)ProcessOutputverifyAttestation(java.nio.file.Path certsDir, java.nio.file.Path report)Verify the attestation report.ProcessOutputverifyCertificates(java.nio.file.Path certsDir)Verify the certificate chain.
-
-
-
Field Detail
-
STDOUT_MARKER
private static final org.apache.logging.log4j.Marker STDOUT_MARKER
-
STDERR_MARKER
private static final org.apache.logging.log4j.Marker STDERR_MARKER
-
LOGGER
private static final org.apache.logging.log4j.Logger LOGGER
-
SNPGUEST
private static final java.nio.file.Path SNPGUEST
-
runtime
private final java.lang.Runtime runtime
-
-
Method Detail
-
fetchVCEK
public ProcessOutput fetchVCEK(EpycGeneration generation, java.nio.file.Path certsDir, java.nio.file.Path report) throws java.util.concurrent.ExecutionException
Fetch the VCEK from the KDS.- Parameters:
generation- Specify the processor model for the certificate chain.certsDir- Directory to store the certificates inreport- Path to attestation report to use to request VCEK- Returns:
- the exit code of the fetching process
- Throws:
java.util.concurrent.ExecutionException- when an error happens during the process execution
-
verifyCertificates
public ProcessOutput verifyCertificates(java.nio.file.Path certsDir) throws java.util.concurrent.ExecutionException
Verify the certificate chain.- Parameters:
certsDir- Path to directory containing certificate chain- Returns:
- the exit code of the verification process
- Throws:
java.util.concurrent.ExecutionException- when an error happens during the process execution
-
verifyAttestation
public ProcessOutput verifyAttestation(java.nio.file.Path certsDir, java.nio.file.Path report) throws java.util.concurrent.ExecutionException
Verify the attestation report.- Parameters:
certsDir- Path to directory containing VCEK.report- Path to attestation report to use for validation.- Returns:
- the exit code of the verification process
- Throws:
java.util.concurrent.ExecutionException- when an error happens during the process execution
-
displayReport
public ProcessOutput displayReport(java.nio.file.Path report) throws java.util.concurrent.ExecutionException
Display the attestation report.- Parameters:
report- Path to attestation report to use for validation.- Returns:
- the exit code of the verification process
- Throws:
java.util.concurrent.ExecutionException- when an error happens during the process execution
-
executeProcess
protected ProcessOutput executeProcess(java.lang.String... command) throws java.util.concurrent.ExecutionException
Executes a commandline process- Parameters:
command- the command line to execute- Returns:
- the exit code returned by the process
- Throws:
java.util.concurrent.ExecutionException- when an error happens during the process execution
-
getOutput
private static java.lang.String getOutput(java.io.InputStream stream, org.apache.logging.log4j.Marker logMarker) throws java.io.IOException- Throws:
java.io.IOException
-
-