diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/RestfulAttestationCertificateAuthority.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/RestfulAttestationCertificateAuthority.java index 2b011879..7e850645 100644 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/RestfulAttestationCertificateAuthority.java +++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/RestfulAttestationCertificateAuthority.java @@ -8,9 +8,9 @@ import hirs.attestationca.persist.entity.manager.PolicyRepository; import hirs.attestationca.persist.entity.manager.ReferenceDigestValueRepository; import hirs.attestationca.persist.entity.manager.ReferenceManifestRepository; import hirs.attestationca.persist.entity.manager.TPM2ProvisionerStateRepository; -import hirs.attestationca.persist.entity.userdefined.certificate.IssuedAttestationCertificate; import hirs.attestationca.persist.service.SupplyChainValidationService; import hirs.structs.converters.StructConverter; +import lombok.extern.log4j.Log4j2; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.PropertySource; @@ -31,7 +31,7 @@ import java.security.cert.X509Certificate; @PropertySource(value = "file:/etc/hirs/aca/application.properties", ignoreResourceNotFound = true) @RestController -@RequestMapping("/") +@RequestMapping("/client") public class RestfulAttestationCertificateAuthority extends AttestationCertificateAuthority implements RestfulInterface { /** diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/listener/AnnotationDrivenEndpointsListener.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/listener/AnnotationDrivenEndpointsListener.java new file mode 100644 index 00000000..0a990bd4 --- /dev/null +++ b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/listener/AnnotationDrivenEndpointsListener.java @@ -0,0 +1,26 @@ +package hirs.attestationca.portal.listener; + +import lombok.extern.log4j.Log4j2; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.event.ContextRefreshedEvent; +import org.springframework.context.event.EventListener; +import org.springframework.web.method.HandlerMethod; +import org.springframework.web.servlet.mvc.method.RequestMappingInfo; +import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; + +import java.util.Map; + +@Log4j2 +@Configuration +public class AnnotationDrivenEndpointsListener { + + @EventListener + public void handleContextRefresh(ContextRefreshedEvent event) { + ApplicationContext applicationContext = event.getApplicationContext(); + RequestMappingHandlerMapping requestMappingHandlerMapping = applicationContext + .getBean("requestMappingHandlerMapping", RequestMappingHandlerMapping.class); + Map map = requestMappingHandlerMapping.getHandlerMethods(); + map.forEach((key, value) -> log.debug("{} {}", key, value)); + } +} diff --git a/HIRS_Provisioner/hirs-provisioner-config.sh b/HIRS_Provisioner/hirs-provisioner-config.sh index ec8bf638..db86e854 100755 --- a/HIRS_Provisioner/hirs-provisioner-config.sh +++ b/HIRS_Provisioner/hirs-provisioner-config.sh @@ -66,7 +66,6 @@ echo "----> Downloading truststore" | tee -a $PROVISIONER_LOG_FILE wget https://"$ATTESTATION_CA_FQDN":"$ATTESTATION_CA_PORT"/HIRS_AttestationCA/client-files/TrustStore.jks --no-check-certificate -P ${CERTIFICATES} >/dev/null 2>/dev/null if [ ! -f "${CERTIFICATES}/TrustStore.jks" ]; then echo "----> ERROR: Truststore could not be downloaded from $ATTESTATION_CA_FQDN" | tee -a $PROVISIONER_LOG_FILE - exit 1 fi sed -i "s/provisioner\.aca\.host\s*=\s*.*/provisioner.aca.host = $ATTESTATION_CA_FQDN/" $PROVISIONER_PROPERTIES diff --git a/HIRS_ProvisionerTPM2/src/RestfulClientProvisioner.cpp b/HIRS_ProvisionerTPM2/src/RestfulClientProvisioner.cpp index 87102cb3..63eeffca 100644 --- a/HIRS_ProvisionerTPM2/src/RestfulClientProvisioner.cpp +++ b/HIRS_ProvisionerTPM2/src/RestfulClientProvisioner.cpp @@ -65,7 +65,8 @@ string RestfulClientProvisioner::sendIdentityClaim( // Send serialized Identity Claim to ACA LOGGER.info("Sending Serialized Identity Claim Binary"); auto r = cpr::Post(cpr::Url{"https://" + acaAddress + ":" + to_string(port) - + "/HIRS_AttestationCA/identity-claim-tpm2/" + + "/HIRS_AttestationCA/portal/" + + "client/identity-claim-tpm2/" + "process"}, cpr::Body{identityClaimByteString}, cpr::Header{{"Content-Type", @@ -121,7 +122,7 @@ string RestfulClientProvisioner::sendAttestationCertificateRequest( // Send serialized certificate request to ACA LOGGER.info("Sending Serialized DeviceInfo Binary"); auto r = cpr::Post(cpr::Url{"https://" + acaAddress + ":" + to_string(port) - + "/HIRS_AttestationCA" + + "/HIRS_AttestationCA/portal/client" + "/request-certificate-tpm2"}, cpr::Body{certificateRequestByteString}, cpr::Header{{"Content-Type", diff --git a/HIRS_ProvisionerTPM2/src/TPM2_Provisioner.cpp b/HIRS_ProvisionerTPM2/src/TPM2_Provisioner.cpp index 612f2d92..4b87b439 100644 --- a/HIRS_ProvisionerTPM2/src/TPM2_Provisioner.cpp +++ b/HIRS_ProvisionerTPM2/src/TPM2_Provisioner.cpp @@ -62,12 +62,12 @@ int provision() { // get platform credential cout << "----> Collecting platform credential from TPM" << endl; - string platformCredential = tpm2.getPlatformCredentialDefault(); + // string platformCredential = tpm2.getPlatformCredentialDefault(); std::vector platformCredentials; // if platformCredential is empty, not in TPM // pull from properties file - if (platformCredential.empty()) { + // if (platformCredential.empty()) { const std::string& cert_dir = props.get( "tcg.cert.dir", @@ -78,9 +78,9 @@ int provision() { } catch (HirsRuntimeException& hirsRuntimeException) { logger.error(hirsRuntimeException.what()); } - } else { - platformCredentials.push_back(platformCredential); - } +// } else { +// platformCredentials.push_back(platformCredential); +// } // collect device info cout << "----> Collecting device information" << endl;