Skip to content

Commit

Permalink
#169 💚 resolving IT reference to aiopskey
Browse files Browse the repository at this point in the history
  • Loading branch information
d-ryan-ashcraft committed Jun 28, 2024
1 parent bcd0e80 commit a57d67a
Show file tree
Hide file tree
Showing 18 changed files with 26 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@
# Enable the transit encryption service
headers = {'X-Vault-Token': client.token}
r = requests.post(VAULT_ADDR+ '/v1/sys/mounts/transit', data={'type':'transit'}, headers=headers)
client.secrets.transit.create_key('aiopskey', exportable=True, mount_point='transit')
client.secrets.transit.create_key('aissemblekey', exportable=True, mount_point='transit')

# Create a policy for the transit service
encrypt_policy = {
'policy': 'path "transit/encrypt/aiopskey" { capabilities = [ "update" ]} path "transit/decrypt/aiopskey" { capabilities = [ "update" ]}'
'policy': 'path "transit/encrypt/aissemblekey" { capabilities = [ "update" ]} path "transit/decrypt/aissemblekey" { capabilities = [ "update" ]}'
}
r = requests.post(VAULT_ADDR+ '/v1/sys/policies/acl/app-aiops', data=encrypt_policy, headers=headers)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ The following tasks will help you add authentication to your module.

1. Generate a jks key store with at least one public/private key pair.
- Here is an example:
- ```openssl pkcs12 -export -in cacert.pem -inkey cakey.pem -out identity.p12 -name "aiopskey"```
- ```keytool -importkeystore -destkeystore aiops-secure.jks -deststorepass password -srckeystore identity.p12 -srcstoretype PKCS12 -srcstorepass password```
- ```keytool -import -file cacert.pem -keystore aiops-secure.jks -storepass password```
- ```openssl pkcs12 -export -in cacert.pem -inkey cakey.pem -out identity.p12 -name "aissemblekey"```
- ```keytool -importkeystore -destkeystore aissemble-secure.jks -deststorepass password -srckeystore identity.p12 -srcstoretype PKCS12 -srcstorepass password```
- ```keytool -import -file cacert.pem -keystore aissemble-secure.jks -storepass password```
1. Add the jks file to your environment and set the following krausening property to point to your keystore location
- ```keystore.file.location=/path/to/my/keystore.jks```
1. Use one of the authentication methods from com.boozallen.aiops.cookbook.authorization or create your own class that
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public String encryptValue(String valueToEncrypt) {

// Base64 encoding is required by Vault
String base64EncodedDataToEncrypt = base64Encode(valueToEncrypt);
LogicalResponse response = vault.logical().write("transit/encrypt/aiopskey",
LogicalResponse response = vault.logical().write("transit/encrypt/aissemblekey",
Collections.singletonMap("plaintext", base64EncodedDataToEncrypt));

Map<String, String> responses = response.getData();
Expand Down Expand Up @@ -81,7 +81,7 @@ public String decryptValue(String valueTodecrypt) {

VaultUtil.checkSealStatusAndUnsealIfNecessary(vault);

LogicalResponse response = vault.logical().write("transit/decrypt/aiopskey",
LogicalResponse response = vault.logical().write("transit/decrypt/aissemble",
Collections.singletonMap("ciphertext", valueTodecrypt));

Map<String, String> responses = response.getData();
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ The following tasks will help you add authentication to your module.

1. Generate a jks key store with at least one public/private key pair.
- Here is an example:
- ```openssl pkcs12 -export -in cacert.pem -inkey cakey.pem -out identity.p12 -name "aiopskey"```
- ```keytool -importkeystore -destkeystore aiops-secure.jks -deststorepass password -srckeystore identity.p12 -srcstoretype PKCS12 -srcstorepass password```
- ```keytool -import -file cacert.pem -keystore aiops-secure.jks -storepass password```
- ```openssl pkcs12 -export -in cacert.pem -inkey cakey.pem -out identity.p12 -name "aissemblekey"```
- ```keytool -importkeystore -destkeystore aissemble-secure.jks -deststorepass password -srckeystore identity.p12 -srcstoretype PKCS12 -srcstorepass password```
- ```keytool -import -file cacert.pem -keystore aissemble-secure.jks -storepass password```
1. Add the jks file to your environment and set the following krausening property to point to your keystore location
- ```keystore.file.location=/path/to/my/keystore.jks```
1. Use one of the authentication methods from com.boozallen.aiops.cookbook.authorization or create your own class that
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
/**
* Class to load and hold keystore information for AIOps security.
*/
public class AiopsKeyStore {
public class AissembleKeyStore {

private static final Logger logger = LoggerFactory.getLogger(AiopsKeyStore.class);
private static final Logger logger = LoggerFactory.getLogger(AissembleKeyStore.class);
private static final SecurityConfiguration config = KrauseningConfigFactory.create(SecurityConfiguration.class);

private static final String KEY_ALIAS = config.getKeyAlias();
Expand All @@ -41,7 +41,7 @@ public class AiopsKeyStore {
private final X509Certificate certificate;
private final Key signingKey;

public AiopsKeyStore() {
public AissembleKeyStore() {
KeyStore keyStore = loadKeyStore();
certificate = getCertificateFromKeyStore(keyStore);
signingKey = getKeyFromKeyStore(keyStore);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public final class JsonWebTokenUtil {

private static final Logger logger = LoggerFactory.getLogger(JsonWebTokenUtil.class);
private static final SecurityConfiguration config = KrauseningConfigFactory.create(SecurityConfiguration.class);
private static final AiopsKeyStore keyStore = new AiopsKeyStore();
private static final AissembleKeyStore keyStore = new AissembleKeyStore();
private static PolicyDecisionPoint pdp = PolicyDecisionPoint.getInstance();
private static AiopsAttributeProvider attributeProvider = new AiopsAttributeProvider();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public interface SecurityConfiguration extends KrauseningConfig {
* @return keystore location
*/
@Key("keystore.location")
@DefaultValue("/deployments/aiops-secure.jks")
@DefaultValue("/deployments/aissemble-secure.jks")
public String getKeyStoreLocation();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
# #L%
###
attribute.definition.location=src/test/resources/authorization/attributes
private.key.alias=aiopskey
keystore.location=src/test/resources/truststore/aiops-secure.jks
private.key.alias=aissemblekey
keystore.location=src/test/resources/truststore/aissemble-secure.jks
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
public_key_path = some/path/to/publicKey.pem
jks_path = some/path/to/truststore/aiops-secure.jks
jks_path = some/path/to/truststore/aissemble-secure.jks
jks_password = somepassword
key_alias = somekeyalias
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class AiopsReferencePDPPythonMigration extends AbstractAissembleMigration
"aiops-security.properties", "aissemble-security.properties",
"aiops.authority","aissemble.authority",
"aiopskey","aissemblekey",
"/deployments/aiops-secure.jks","/deployments/aissemble-secure.jks"
"/deployments/aissemble-secure.jks","/deployments/aissemble-secure.jks"
);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class AiopsReferencePythonMigration extends AbstractAissembleMigration {
public static final Map<String, String> AIOPS_REFERENCE_PYTHON_PACKAGE_MAP = Map.of(
"aiops.authority", "aissemble.authority",
"aiopskey" , "aissemblekey",
"/deployments/aiops-secure.jks" , "/deployments/aissemble-secure.jks",
"/deployments/aissemble-secure.jks" , "/deployments/aissemble-secure.jks",
"policy-decision-point.aiops-security.properties.vm", "policy-decision-point.aissemble-security.properties.vm",
"aiops_core_filestore.file_store_factory","aissemble_core_filestore.file_store_factory",
"aiops_core_metadata.metadata_model", "aissemble_core_metadata.metadata_model",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# Generated from: templates/general-docker/policy-decision-point.aiops-security.properties.vm

token.issuer=aiops.authority
private.key.alias=aiopskey
keystore.file.location=/deployments/aiops-secure.jks
private.key.alias=aissemblekey
keystore.file.location=/deployments/aissemble-secure.jks
attribute.definition.location=/deployments/
pdp.configuration.location=/deployments/pdp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
# #L%
###
public_key_path = /keystore/publicKey.pem
jks_path = /keystore/aiops-secure.jks
jks_path = /keystore/aissemble-secure.jks
jks_password = password
key_alias = aiopskey
key_alias = aissemblekey
pdp_host_url = http://policy-decision-point:8080/api/pdp
is_authorization_enabled = False
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
# #L%
###
public_key_path = /keystore/publicKey.pem
jks_path = /keystore/aiops-secure.jks
jks_path = /keystore/aissemble-secure.jks
jks_password = password
key_alias = aiopskey
key_alias = aissemblekey
pdp_host_url = http://policy-decision-point:8080/api/pdp
is_authorization_enabled = False

0 comments on commit a57d67a

Please sign in to comment.