diff --git a/knowledge base/cloud computing/aws/README.md b/knowledge base/cloud computing/aws/README.md index da6cb68..0fa4427 100644 --- a/knowledge base/cloud computing/aws/README.md +++ b/knowledge base/cloud computing/aws/README.md @@ -227,6 +227,7 @@ One can can rapidly remapping addresses to other instances in one's account and | [Route53] | DNS | | [S3] | Storage | | [Sagemaker] | Machine learning | +| [Secrets Manager] | Secrets management | | [Security Hub] | Aggregator for security findings | | [SNS] | Pub/sub message delivery | | [SQS] | Queues | @@ -895,6 +896,7 @@ machine if not. [route53]: route53.md [s3]: s3.md [sagemaker]: sagemaker.md +[secrets manager]: secrets%20manager.md [sns]: sns.md [sqs]: sqs.md diff --git a/knowledge base/cloud computing/aws/secrets manager.md b/knowledge base/cloud computing/aws/secrets manager.md new file mode 100644 index 0000000..7bc0687 --- /dev/null +++ b/knowledge base/cloud computing/aws/secrets manager.md @@ -0,0 +1,74 @@ +# AWS Secrets Manager + +AWS' native secrets management service. + +1. [TL;DR](#tldr) +1. [Further readings](#further-readings) + 1. [Sources](#sources) + +## TL;DR + +Provides integration with the AWS ecosystem and has automatic rotation capabilities specifically designed for AWS +services. + +Offers precise access control to each secret via fine-grained IAM permissions with resource-based policies.
+Supports VPC endpoints to enables private network access without the need for Internet routing. Optimal for air-gapped +or highly secure environments.
+Critical secrets can be replicated cross-region. + +Costs $0.40 per secret per month, plus $0.05 per 10,000 API calls.
+Secrets that are marked for deletion are not paid for. + +Secrets Manager uses keys from KMS to encrypt the secrets it manages.
+On first use, Secrets Manager creates the AWS-managed key `aws/secretsmanager` to encrypt the secrets given to it. There +is **no** cost for using this key.
+When _automatic_ rotation is turned on for a secret, Secrets Manager uses a Lambda function to rotate it. The use of the +Lambda function is charged at the current Lambda rate. +The rotation function is **not** called for secrets using _managed_ rotation. + +Logs of the API calls that Secrets Manager sends out are sent to CloudTrail, if it is enabled. Costs for CloudTrail are +**in addition** to the ones incurred by using Secrets Manager. + +```sh +aws secretsmanager create-secret --name 'TestSecretFromFile' --secret-string 'file://gcp_credentials.json' +aws secretsmanager create-secret \ + --name 'MyTestSecret' --description 'A test secret created with the CLI.' \ + --secret-string '{"user":"diego","password":"EXAMPLE-PASSWORD"}' \ + --tags '[{"Key": "FirstTag", "Value": "FirstValue"}, {"Key": "SecondTag", "Value": "SecondValue"}]' +``` + +Secrets can be any text or binary up to 65536 bytes (64KB).
+Should one want to automatically rotate them, they must contain the specific JSON fields that the rotation function +expects. Refer the [JSON structure of AWS Secrets Manager secrets]. + +Secret have versions that hold copies of their encrypted value.
+When changing the secret value, or when the secret is rotated, Secrets Manager creates a new version and serves that by +default. The old version is kept (up to a point), but not accessed unless specifically requested. + +One can access a secret across multiple Regions by replicating it.
+When replicating a secret, Secrets Manager creates a copy of the original (A.K.A. _primary_) secret. That copy is known +as a _replica_ secret.
+The replica secret remains linked to the primary secret, and is updated when a new version of the primary is created. + +Secrets Manager uses [IAM] to allow only authorized users to access or modify a secret. + +_Managed_ secrets are created and managed by the AWS service that created them.
+The managing service might also restrict users from updating secrets, or deleting them without a recovery period.
+Managed secrets use a naming convention that includes the ID of the service managing them. + +## Further readings + +### Sources + + + + + +[IAM]: iam.md + + + +[JSON structure of AWS Secrets Manager secrets]: https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_secret_json_structure.html diff --git a/knowledge base/grafana.md b/knowledge base/grafana.md index 4b61ecb..9110734 100644 --- a/knowledge base/grafana.md +++ b/knowledge base/grafana.md @@ -337,7 +337,7 @@ All the references in the [further readings] section, plus the following: [further readings]: #further-readings -[Hashicorp Vault]: vault.md +[HashiCorp Vault]: hashicorp%20vault.md [loki]: loki.md [prometheus]: prometheus/README.md diff --git a/knowledge base/vault.md b/knowledge base/hashicorp vault.md similarity index 81% rename from knowledge base/vault.md rename to knowledge base/hashicorp vault.md index 2f6926b..a0b604d 100644 --- a/knowledge base/vault.md +++ b/knowledge base/hashicorp vault.md @@ -1,6 +1,4 @@ -# Hashicorp Vault - -## Table of contents +# HashiCorp Vault 1. [TL;DR](#tldr) 1. [Further readings](#further-readings) @@ -38,11 +36,16 @@ vault read -format 'json' 'secret/data/demo-app/config' ## Further readings -- [HashiCorp Vault] +- [Website] +- [Secrets management] + +[Secrets management]: secrets%20management.md + -[hashicorp vault]: https://www.vaultproject.io/ +[Website]: https://www.vaultproject.io/ diff --git a/knowledge base/infisical.md b/knowledge base/infisical.md new file mode 100644 index 0000000..fb50e48 --- /dev/null +++ b/knowledge base/infisical.md @@ -0,0 +1,72 @@ +# Infisical + +Open-source platform for [secrets management], PKI, and SSH access.
+Centralizes application configuration, secrets and credentials management, and PKI management. + +1. [TL;DR](#tldr) +1. [Further readings](#further-readings) + 1. [Sources](#sources) + +## TL;DR + +_Identities_ are user or machine accounts. Each of them gets assigned sets of roles and permissions.
+They can manage secrets in _clients_ after whey verified themselves through authentication. + +_Clients_ are Infisical-developed tools for managing secrets in various infrastructure components. + + + + + + + +## Further readings + +- [Website] +- [Codebase] +- [Secrets management] + +### Sources + +- [Documentation] + + + + + +[Secrets management]: secrets%20management.md + + + +[codebase]: https://github.com/Infisical/infisical +[documentation]: https://infisical.com/docs +[website]: https://infisical.com/ + + diff --git a/knowledge base/jargon.md b/knowledge base/jargon.md index c4b0f76..d114e9d 100644 --- a/knowledge base/jargon.md +++ b/knowledge base/jargon.md @@ -69,6 +69,7 @@ | HPC | High Performance Computing | Collections of systems and tools used to achieve a greater processing capacity than the single unit | | IaC | [Infrastructure as Code][iac] | | | IC | Integrated Circuit | | +| IDP | Internal Developer Platform | | | IIRC | If I Remember/Recall Correctly | | | IoT | Internet of Things | Also see [LoRa] | | IP | Internet Protocol | | diff --git a/knowledge base/openssl.md b/knowledge base/openssl.md index 373bdcc..7c9d903 100644 --- a/knowledge base/openssl.md +++ b/knowledge base/openssl.md @@ -125,8 +125,10 @@ $ openssl req -x509 -out 'cert.pem' \ -newkey 'rsa:4096' -keyout 'key.pem' -days '365' -nodes \ -subj "/C=NL/ST=Nederlands/L=Amsterdam/O=Mek Net/OU=Org/CN=mek.info" Generating a 4096 bit RSA private key -..............................................................................................................................................................................................................................++ -...........................................................................................................................................................................++ +........................................................................................................................ +......................................................................................................++ +........................................................................................................................ +...................................................++ writing new private key to 'key.pem' ----- @@ -220,6 +222,7 @@ See [code 20](#code-20-unable-to-get-local-issuer-certificate). - [Verify certificate chain with OpenSSL] - [How to put domain correctly in CSR?] - [OpenSSL command cheatsheet] +- [The Only OpenSSL CheatSheet You Will Need!] -[backend]: #backend -[configuration]: #configuration -[enforce specific backends for projects]: #enforce-specific-backends-for-projects -[monolith vs micro-stack]: #monolith-vs-micro-stack -[program]: #program -[project]: #project -[stack]: #stack +[Backends]: #backends +[Configurations]: #configurations +[Enforce specific backends for projects]: #enforce-specific-backends-for-projects +[Monolith vs micro-stack]: #monolith-vs-micro-stack +[Programs]: #programs +[Projects]: #projects +[Stacks]: #stacks +[States]: #states +[Composing resources]: #composing-resources -[terraform]: terraform.md +[Terraform]: terraform.md @@ -1535,21 +1566,23 @@ Solution: Read [secrets], and fix the configuration by providing a correct key i [ignorechanges]: https://www.pulumi.com/docs/concepts/options/ignorechanges/ [importing resources]: https://www.pulumi.com/docs/iac/adopting-pulumi/import/ [organizing pulumi projects & stacks]: https://www.pulumi.com/docs/using-pulumi/organizing-projects-stacks/ -[projects]: https://www.pulumi.com/docs/concepts/projects/ [property paths]: https://www.pulumi.com/docs/iac/concepts/miscellaneous/property-paths/ [pulumi config set-all]: https://www.pulumi.com/docs/cli/commands/pulumi_config_set-all/ [pulumi crosswalk for aws]: https://www.pulumi.com/docs/iac/clouds/aws/guides/ +[pulumi esc docs]: https://www.pulumi.com/docs/esc/ +[pulumi idp docs]: https://www.pulumi.com/docs/idp/ [pulumi import]: https://www.pulumi.com/docs/iac/cli/commands/pulumi_import/ [pulumi new]: https://www.pulumi.com/docs/cli/commands/pulumi_new/ [pulumi preview]: https://www.pulumi.com/docs/iac/cli/commands/pulumi_preview/ +[pulumi projects]: https://www.pulumi.com/docs/concepts/projects/ +[pulumi stack]: https://www.pulumi.com/docs/concepts/stack/ +[pulumi state]: https://www.pulumi.com/docs/concepts/state/ [pulumi troubleshooting]: https://www.pulumi.com/docs/support/troubleshooting/ [pulumi up --plan without error message (exit code 255)]: https://github.com/pulumi/pulumi/issues/11303#issuecomment-1311365793 [pulumi-aws/issues/1366]: https://github.com/pulumi/pulumi-aws/issues/1366 [resources reference]: https://www.pulumi.com/resources [secrets]: https://www.pulumi.com/docs/concepts/secrets/ [stack references]: https://www.pulumi.com/docs/concepts/stack/#stackreferences -[stacks]: https://www.pulumi.com/docs/concepts/stack/ -[state]: https://www.pulumi.com/docs/concepts/state/ [update plans]: https://www.pulumi.com/docs/concepts/update-plans/ [website]: https://www.pulumi.com/ [workshops]: https://github.com/pulumi/workshops diff --git a/knowledge base/secrets management.md b/knowledge base/secrets management.md new file mode 100644 index 0000000..2369293 --- /dev/null +++ b/knowledge base/secrets management.md @@ -0,0 +1,76 @@ +# Secrets management + +1. [TL;DR](#tldr) +1. [The problem at hand](#the-problem-at-hand) +1. [Further readings](#further-readings) + 1. [Sources](#sources) + +## TL;DR + +_Vaults_ and _secrets managers_ are centralized solution that manage secrets.
+Examples: [HashiCorp Vault], [OpenBao], [Bitwarden Secrets Manager], [1Password Secrets Automation], [CyberArk Conjur], +[Akeyless]. + +_Secrets orchestration platforms_ offer a transparent access point for users while being a vault itself and/or syncing +secrets between multiple other vaults and secrets managers.
+Examples: [Doppler], [Infisical], [Pulumi ESC]. + +Solutions should be easy to use and get **out** of their users' way, so that they can be more easily adopted. + +## The problem at hand + +Secrets are usually bad managed in local development environments.
+The process of grabbing all required secrets on local machines is often manual, cumbersome, and prone to errors.
+This causes the onboarding process to slow down, and encourages developers to follow insecure practices when sharing +secrets. + +Saving secrets in (possibly encrypted) git-tracked files (e.g. `.env`) still lacks the level of syncing teams might +require.
+Even if notified, developers don't usually pull the updated files nor make all the required adjustments immediately, +likely being then forced to lose time debugging issues due to deprecated or changed data. + +Even with a working synchronization process, it's common for developers to accidentally leak secrets as part of +commits.
+As soon as a secret is part of the git history, it becomes a security issue and it is hard to get it removed +properly.
+Though git hooks exist, it is likely for them to be misconfigured or simply skipped (`git commit --no-verify`). + +Having a centralized solution to manage secrets can come to the rescue, as long as it is adopted profusely.
+The only way this can happen is if that solution is easy to use and manage, and get **out** of the way of +developers.
+_Vaults_ and _secrets managers_ usually do a good job for this. + +Tools might also integrate with or support only one or a small set of solutions, limiting the choice of platforms.
+It would be good to have a way to sync secrets between multiple platforms. Even better, to use a single access point to +abstract the sync process and make it transparent.
+This is what _secrets orchestration platforms_ try to solve. + +## Further readings + +- [HashiCorp Vault] +- [Infisical] + +### Sources + +- [Secrets Management Tools: The Complete 2025 Guide] + + + + + +[HashiCorp Vault]: hashicorp%20vault.md +[Infisical]: infisical.md +[Pulumi ESC]: pulumi.md#esc + + + +[1Password Secrets Automation]: https://1password.com/developers/secrets-management +[Akeyless]: https://www.akeyless.io/ +[Bitwarden secrets manager]: https://bitwarden.com/products/secrets-manager/ +[CyberArk Conjur]: https://www.conjur.org/ +[Doppler]: https://www.doppler.com/ +[OpenBao]: https://openbao.org/ +[Secrets Management Tools: The Complete 2025 Guide]: https://www.pulumi.com/blog/secrets-management-tools-guide/ diff --git a/snippets/aws/other commands.fish b/snippets/aws/other commands.fish index 2de7769..ff80546 100644 --- a/snippets/aws/other commands.fish +++ b/snippets/aws/other commands.fish @@ -489,6 +489,18 @@ aws s3api list-buckets --output 'text' --query 'Buckets[].Name' | xargs -n '1' a aws --profile 'someProfile' s3api head-bucket --bucket 'someBucket' +### +# Secrets +# ------------------ +### + +aws secretsmanager create-secret --name 'TestSecretFromFile' --secret-string 'file://mycreds.json' +aws secretsmanager create-secret \ + --name 'MyTestSecret' --description 'A test secret created with the CLI.' \ + --secret-string '{"user":"diegor","password":"EXAMPLE-PASSWORD"}' \ + --tags '[{"Key": "FirstTag", "Value": "FirstValue"}, {"Key": "SecondTag", "Value": "SecondValue"}]' + + ### # SNS # ------------------