Skip to content

Commit

Permalink
PLA-22903 - Updated Remediation Job for Key Vault Logging (#46)
Browse files Browse the repository at this point in the history
* PLA-22903 - Updated Remediation Job for Key Vault Logging

* PLA-22903 - Updated Key Vault Logging job

* PLA-22903 - Added Comments

* PLA-22903 - Fixed review comments

* PLA-22903 - Fixed Review Comments

* PLA-22903 - Updated the key vault logging job
  • Loading branch information
kshrutik authored Feb 12, 2021
1 parent 828b1d1 commit cb57810
Show file tree
Hide file tree
Showing 9 changed files with 748 additions and 83 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Enable Logging For Keyvault

This job enables Key Vault Logging.
This job enables Logging for Key Vault. It checks for the existence of Storage Account created by CHSS in the given resource group and region, if the Storage Account exists then it stores the Key Vault Logs in it. Else it creates a new Storage Account to store the Key Vault logs.
The Storage Account created by CHSS is prefixed with "chss" and contains tag `{"Created By" : "CHSS"}`.

### Applicable Rule

Expand All @@ -15,9 +16,14 @@ Logging For Keyvault Enabled
The provided Azure service principal must have the following permissions:
`Microsoft.Storage/storageAccounts/read`
`Microsoft.Storage/storageAccounts/write`
`Microsoft.Storage/storageAccounts/blobServices/write`
`Microsoft.Storage/storageAccounts/blobServices/read`
`Microsoft.Insights/DiagnosticSettings/Write`
`Microsoft.KeyVault/vaults/read`
`Microsoft.KeyVault/vaults/write`
`Microsoft.KeyVault/vaults/keys/read`
`Microsoft.KeyVault/vaults/keys/write`
`Microsoft.KeyVault/vaults/accessPolicies/write`

A sample role with requisite permissions can be found [here](minimum_permissions.json)

Expand All @@ -38,13 +44,16 @@ You may run test using following command under vss-remediation-worker-job-code-p
python3 -m pytest test
```
## Deployment
Provision a Virtual Machine Create an EC2 instance to use for the worker. The minimum required specifications are 128 MB memory and 1/2 Core CPU.
Setup Docker Install Docker on the newly provisioned EC2 instance. You can refer to the [docs here](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/docker-basics.html) for more information.
Deploy the worker image SSH into the EC2 instance and run the command below to deploy the worker image:
Provision an instance by creating an Azure Virtual Machine to use for the worker. The minimum required specifications are 128 MB memory and 1/2 Core CPU.
Setup Docker on newly provisioned Azure Virtual Machine instance.You can refer to the [docs here](https://docs.microsoft.com/en-us/previous-versions/azure/virtual-machines/linux/docker-machine) for more information.
Deploy the worker docker image by SSH into the Azure Virtual Machine instance and run the following commands:
```shell script
docker run --rm -it --name worker \
-e VSS_CLIENT_ID={ENTER CLIENT ID}
-e VSS_CLIENT_SECRET={ENTER CLIENT SECRET} \
docker run --rm -it --name {worker_name}\
-e VSS_CLIENT_ID={ENTER CLIENT ID}\
-e VSS_CLIENT_SECRET={ENTER CLIENT SECRET}\
-e AZURE_CLIENT_ID={ENTER AZURE_CLIENT_ID} \
-e AZURE_CLIENT_SECRET={ENTER AZURE_CLIENT_SECRET} \
-e AZURE_TENANT_ID={ENTER AZURE_TENANT_ID} \
vmware/vss-remediation-worker:latest-python
```
## Contributing
Expand Down
Loading

0 comments on commit cb57810

Please sign in to comment.