├── CDK ├── AWS_CDK │ ├── requirements.txt │ ├── automation_rocks │ │ ├── __init__.py │ │ ├── automation_rocks.egg-info │ │ │ ├── top_level.txt │ │ │ ├── dependency_links.txt │ │ │ ├── requires.txt │ │ │ ├── SOURCES.txt │ │ │ └── PKG-INFO │ │ ├── __pycache__ │ │ │ ├── __init__.cpython-38.pyc │ │ │ └── automation_rocks_stack.cpython-38.pyc │ │ └── automation_rocks_stack.py │ ├── .gitignore │ ├── cdk.json │ ├── app.py │ ├── setup.py │ └── README.md └── TerraformCDK │ ├── requirements.txt │ ├── .gitignore │ ├── cdktf.json │ ├── help │ └── main.py ├── Inspec ├── files │ ├── inspec │ │ ├── ssh │ │ │ ├── attributes.yml │ │ │ ├── controls │ │ │ │ └── ssh.rb │ │ │ ├── threshold.yml │ │ │ └── inspec.yml │ │ ├── linux │ │ │ ├── attributes.yml │ │ │ ├── controls │ │ │ │ └── linux.rb │ │ │ ├── threshold.yml │ │ │ └── inspec.yml │ │ ├── docker │ │ │ ├── attributes.yml │ │ │ ├── controls │ │ │ │ └── docker.rb │ │ │ ├── threshold.yml │ │ │ └── inspec.yml │ │ └── gcp │ │ │ ├── threshold.yml │ │ │ ├── attributes.yml │ │ │ ├── inspec.yml │ │ │ └── controls │ │ │ └── gcp.rb │ ├── secrets │ │ └── heimdall_key │ ├── setup-docker-secrets.sh │ ├── nginx.conf │ ├── index.html │ ├── docker-compose.yml │ ├── creds.json │ ├── Dockerfile │ └── tests.sh ├── README.md ├── modules │ ├── instance │ │ ├── outputs.tf │ │ ├── variables.tf │ │ └── instance.tf │ └── storage │ │ ├── storage.tf │ │ └── variables.tf ├── gcp.tf ├── terraform.tfvars └── variables.tf ├── helm_example-0.1.0.tgz ├── README.md ├── helm_example ├── templates │ ├── namespace.yaml │ ├── configmap.yaml │ ├── test-svc.yaml │ └── test-deploy.yaml ├── README.md ├── Chart.yaml └── values.yaml ├── EC2_Web_UserData.bash ├── AdminUser.py ├── Automation ├── README.md ├── hosts ├── CloudFormationPlaybook.yml └── CloudFormation.json ├── RegularUser.py ├── DMS ├── README.md ├── DMS_TABLEMAPPINGS.json ├── DMS_CREATE_TASK.py ├── DMS_AWSCLI_COMMAND.sh ├── DMS_TASKSETTINGS.json ├── DMS_SOURCE_CONFIG.sql └── DMS_TARGET_CONFIG.sql ├── Migrate_To_RDS_Oracle ├── README.md ├── install_cli_pip.py ├── Create_Tablespace.py ├── create_user.py ├── Move_Datapump.py ├── create_dblink.py ├── Clean_Up_RDS_Datapump.py ├── Export_Source.py └── Import_Target.py ├── GKE_Cluster_with_Nginx_Ingress ├── modules │ ├── ingress │ │ ├── certs │ │ │ ├── values.yaml.tpl │ │ │ ├── Chart.yaml │ │ │ └── templates │ │ │ │ ├── ClusterIssuer.yml │ │ │ │ └── _helpers.tpl │ │ ├── namespace.tf │ │ ├── data_sources.tf │ │ ├── nginx_ingress.tf │ │ ├── variables.tf │ │ ├── deploy_cert_manager.tf │ │ ├── dns_service_account.tf │ │ └── ingress.tf │ └── gke │ │ ├── data_sources.tf │ │ ├── outputs.tf │ │ ├── variables.tf │ │ └── gke.tf ├── README.md ├── data_sources.tf ├── variables.tf ├── versions.tf ├── outputs.tf ├── terraform.tfvars ├── main.tf └── providers.tf ├── Connect.py ├── Configure_Git.sh ├── Configure cx_Oracle.py └── SQL_Server_2017_On_Linux.sql /CDK/AWS_CDK/requirements.txt: -------------------------------------------------------------------------------- 1 | -e . 2 | -------------------------------------------------------------------------------- /Inspec/files/inspec/ssh/attributes.yml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /CDK/AWS_CDK/automation_rocks/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Inspec/files/inspec/linux/attributes.yml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /CDK/AWS_CDK/.gitignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | cdk.out 3 | -------------------------------------------------------------------------------- /CDK/TerraformCDK/requirements.txt: -------------------------------------------------------------------------------- 1 | cdktf~=0.0.18 -------------------------------------------------------------------------------- /Inspec/files/secrets/heimdall_key: -------------------------------------------------------------------------------- 1 | aZwbtxgUXD8IYDCn_19FpQ 2 | -------------------------------------------------------------------------------- /CDK/AWS_CDK/automation_rocks/automation_rocks.egg-info/top_level.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /CDK/AWS_CDK/automation_rocks/automation_rocks.egg-info/dependency_links.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /helm_example-0.1.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PatriciaAnong/Blog/HEAD/helm_example-0.1.0.tgz -------------------------------------------------------------------------------- /Inspec/files/inspec/docker/attributes.yml: -------------------------------------------------------------------------------- 1 | container_capadd: SYS_ADMIN 2 | benchmark_version: 2.1.0 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Blog 2 | Scripts from my Blog [Patricia-Anong.com/Blog](https://Patricia-Anong.com/blog) 3 | -------------------------------------------------------------------------------- /CDK/TerraformCDK/.gitignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | imports/* 3 | !imports/__init__.py 4 | .terraform 5 | cdktf.out 6 | terraform.tfstate* -------------------------------------------------------------------------------- /helm_example/templates/namespace.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | name: {{ .Values.helm_example.namespace }} 5 | -------------------------------------------------------------------------------- /EC2_Web_UserData.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | /usr/bin/yum -y install httpd php php-mysqli 3 | /sbin/chkconfig httpd on 4 | /sbin/service httpd start 5 | -------------------------------------------------------------------------------- /Inspec/README.md: -------------------------------------------------------------------------------- 1 | # DevSecOps using Inspec 2 | The corresponding blog post can be found at [Patricia-Anong.com/Blog](https://Patricia-Anong.com/blog/2019/9/1/devsecops) -------------------------------------------------------------------------------- /Inspec/files/inspec/ssh/controls/ssh.rb: -------------------------------------------------------------------------------- 1 | # copyright: 2019, Patricia Anong 2 | 3 | title "PAnong Sample Control" 4 | 5 | include_controls "ssh-baseline" do 6 | end 7 | -------------------------------------------------------------------------------- /Inspec/files/inspec/linux/controls/linux.rb: -------------------------------------------------------------------------------- 1 | # copyright: 2019, Patricia Anong 2 | 3 | title "PAnong Sample Control" 4 | 5 | include_controls "linux-baseline" do 6 | end -------------------------------------------------------------------------------- /AdminUser.py: -------------------------------------------------------------------------------- 1 | _author_ = 'panong' 2 | 3 | use admin 4 | 5 | db.createUser({ 6 | user: "Albus", 7 | pwd: "Dumbledore", 8 | roles: ["root"] 9 | }) 10 | 11 | -------------------------------------------------------------------------------- /Inspec/files/inspec/docker/controls/docker.rb: -------------------------------------------------------------------------------- 1 | # copyright: 2019, Patricia Anong 2 | 3 | title "PAnong Sample Control" 4 | 5 | include_controls "docker-baseline" do 6 | end 7 | -------------------------------------------------------------------------------- /Inspec/modules/instance/outputs.tf: -------------------------------------------------------------------------------- 1 | output "instance_public_address" { 2 | value = google_compute_instance.inspec_instance[0].network_interface[0].access_config[0].nat_ip 3 | } -------------------------------------------------------------------------------- /CDK/AWS_CDK/automation_rocks/__pycache__/__init__.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PatriciaAnong/Blog/HEAD/CDK/AWS_CDK/automation_rocks/__pycache__/__init__.cpython-38.pyc -------------------------------------------------------------------------------- /Automation/README.md: -------------------------------------------------------------------------------- 1 | # Automation in the Cloud 2 | The corresponding blog post can be found at [Patricia-Anong.com/Blog](https://Patricia-Anong.com/blog/2017/11/13/automation-in-the-cloud) -------------------------------------------------------------------------------- /RegularUser.py: -------------------------------------------------------------------------------- 1 | _author_ = 'panong' 2 | 3 | use Gryffindor 4 | 5 | db.createUser({ 6 | user: "Harry", 7 | pwd: "Hogwarts4ever", 8 | roles: ["readWrite"] 9 | }) 10 | -------------------------------------------------------------------------------- /DMS/README.md: -------------------------------------------------------------------------------- 1 | # Configuring Amazon Data Migration Service for Oracle Replication 2 | The corresponding blog post can be found at [Patricia-Anong.com/Blog](https://Patricia-Anong.com/blog/2017/9/11/dms) -------------------------------------------------------------------------------- /Migrate_To_RDS_Oracle/README.md: -------------------------------------------------------------------------------- 1 | # Migrate On-Premise Oracle to RDS Oracle 2 | The corresponding blog post can be found at [Patricia-Anong.com/Blog](https://Patricia-Anong.com/blog/2017/7/03/rds-oracle) -------------------------------------------------------------------------------- /CDK/AWS_CDK/automation_rocks/__pycache__/automation_rocks_stack.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PatriciaAnong/Blog/HEAD/CDK/AWS_CDK/automation_rocks/__pycache__/automation_rocks_stack.cpython-38.pyc -------------------------------------------------------------------------------- /Inspec/files/inspec/docker/threshold.yml: -------------------------------------------------------------------------------- 1 | compliance: 2 | min: 40 3 | failed: 4 | critical: 5 | max: 10 6 | error: 7 | total: 8 | max: 5 9 | critical: 10 | max: 5 11 | high: 12 | max: 5 -------------------------------------------------------------------------------- /Inspec/files/inspec/gcp/threshold.yml: -------------------------------------------------------------------------------- 1 | compliance: 2 | min: 40 3 | failed: 4 | critical: 5 | max: 10 6 | error: 7 | total: 8 | max: 5 9 | critical: 10 | max: 5 11 | high: 12 | max: 5 -------------------------------------------------------------------------------- /Inspec/files/inspec/linux/threshold.yml: -------------------------------------------------------------------------------- 1 | compliance: 2 | min: 40 3 | failed: 4 | critical: 5 | max: 10 6 | error: 7 | total: 8 | max: 5 9 | critical: 10 | max: 5 11 | high: 12 | max: 5 -------------------------------------------------------------------------------- /Inspec/files/inspec/ssh/threshold.yml: -------------------------------------------------------------------------------- 1 | compliance: 2 | min: 40 3 | failed: 4 | critical: 5 | max: 10 6 | error: 7 | total: 8 | max: 5 9 | critical: 10 | max: 5 11 | high: 12 | max: 5 -------------------------------------------------------------------------------- /helm_example/README.md: -------------------------------------------------------------------------------- 1 | # Packaging Kubernetes Applications using Helm 2 | The corresponding blog post can be found at [Patricia-Anong.com/Blog](https://Patricia-Anong.com/blog/2019/2/27/packaging-kubernetes-applications-using-helm) -------------------------------------------------------------------------------- /GKE_Cluster_with_Nginx_Ingress/modules/ingress/certs/values.yaml.tpl: -------------------------------------------------------------------------------- 1 | certs: 2 | name: ${name} 3 | env: ${env} 4 | project: ${project} 5 | iac: "deployed-via-terraform" 6 | email: ${email} 7 | dns_secret_name: ${dns_secret_name} -------------------------------------------------------------------------------- /GKE_Cluster_with_Nginx_Ingress/README.md: -------------------------------------------------------------------------------- 1 | # Deploy Nginx Ingress and Cert Manager on a GKE Cluster using Terraform 2 | 3 | The corresponding blog post can be found at [Patricia-Anong.com/Blog](https://Patricia-Anong.com/blog/2017/9/11/dms) 4 | -------------------------------------------------------------------------------- /GKE_Cluster_with_Nginx_Ingress/data_sources.tf: -------------------------------------------------------------------------------- 1 | locals { 2 | env = terraform.workspace 3 | common_tags = { 4 | iac = "deployed-via-terraform" 5 | environment = local.env 6 | owner = "patricia-anong" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /GKE_Cluster_with_Nginx_Ingress/modules/gke/data_sources.tf: -------------------------------------------------------------------------------- 1 | locals { 2 | 3 | gke_name = "gke-${var.name_prefix}-${var.environment}-${var.region}" 4 | 5 | gke_node_name = "gke-node-${var.name_prefix}-${var.environment}-${var.region}" 6 | 7 | } -------------------------------------------------------------------------------- /CDK/AWS_CDK/automation_rocks/automation_rocks.egg-info/requires.txt: -------------------------------------------------------------------------------- 1 | aws-cdk.aws_cloudwatch 2 | aws-cdk.aws_cloudwatch_actions 3 | aws-cdk.aws_ec2 4 | aws-cdk.aws_events 5 | aws-cdk.aws_sns 6 | aws-cdk.aws_sns_subscriptions 7 | aws-cdk.core==1.76.0 8 | -------------------------------------------------------------------------------- /helm_example/templates/configmap.yaml: -------------------------------------------------------------------------------- 1 | kind: ConfigMap 2 | apiVersion: v1 3 | metadata: 4 | name: configmap 5 | namespace: helm-example 6 | data: 7 | NGINX_PORT: "{{ .Values.helm_example.service.externalPort }}" 8 | 9 | 10 | -------------------------------------------------------------------------------- /GKE_Cluster_with_Nginx_Ingress/variables.tf: -------------------------------------------------------------------------------- 1 | variable project {} 2 | 3 | variable name_prefix {} 4 | 5 | variable region {} 6 | 7 | variable master_authorized_networks_config {} 8 | 9 | variable shielded_instance_config {} 10 | 11 | variable enable_apis {} -------------------------------------------------------------------------------- /Inspec/files/inspec/gcp/attributes.yml: -------------------------------------------------------------------------------- 1 | # Below is to be uncommented and set with your GCP project ID: 2 | gcp_project_id: inspecplaygroundgcp 3 | region_name: us-east1 4 | zone: us-east1-b 5 | instance_name: panong-test-inspec-instance 6 | bucket: inspec-files-bucket -------------------------------------------------------------------------------- /helm_example/Chart.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | description: A Helm chart example for Patricia Anong's Blog 3 | name: helm_example 4 | version: 0.1.0 5 | maintainers: 6 | - name: Patricia.Anong 7 | email: PatriciaAnong@gmail.com 8 | url: patricia-anong.com 9 | -------------------------------------------------------------------------------- /Automation/hosts: -------------------------------------------------------------------------------- 1 | [local] 2 | 127.0.0.1 3 | 4 | [local:vars] 5 | aws_access_key=AHGGDSGLJJ746VKJLH 6 | aws_secret_key=AG5HK88N7D56Ygkhk86y88gd6ff 7 | ansible_connection=local 8 | ansible_python_interpreter=/usr/bin/python 9 | EC2_REGION=us-east-1 10 | AWS_REGION=us-east-1 11 | -------------------------------------------------------------------------------- /CDK/AWS_CDK/cdk.json: -------------------------------------------------------------------------------- 1 | { 2 | "app": "python3 app.py", 3 | "context": { 4 | "@aws-cdk/core:enableStackNameDuplicates": "true", 5 | "aws-cdk:enableDiffNoFail": "true", 6 | "@aws-cdk/core:stackRelativeExports": "true", 7 | "@aws-cdk/aws-ecr-assets:dockerIgnoreSupport": true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /CDK/TerraformCDK/cdktf.json: -------------------------------------------------------------------------------- 1 | { 2 | "language": "python", 3 | "app": "python ./main.py", 4 | "terraformProviders": [ 5 | "aws@~> 2.0" 6 | ], 7 | "codeMakerOutput": "imports", 8 | "context": { 9 | "excludeStackIdFromLogicalIds": "true", 10 | "allowSepCharsInLogicalIds": "true" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /GKE_Cluster_with_Nginx_Ingress/modules/ingress/certs/Chart.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v2 2 | name: certs 3 | description: A Helm chart for deploying cert-manager 4 | 5 | type: application 6 | 7 | version: 0.1.0 8 | appVersion: 0.1.0 9 | 10 | maintainers: 11 | - name: Patricia Anong 12 | email: patricia@patricia-anong.com 13 | -------------------------------------------------------------------------------- /GKE_Cluster_with_Nginx_Ingress/versions.tf: -------------------------------------------------------------------------------- 1 | terraform { 2 | required_version = "~> 0.12.25" 3 | required_providers { 4 | google = "~> 3.23.0" 5 | google-beta = "~> 3.23.0" 6 | random = "~> 2.2" 7 | kubernetes = "~> 1.11" 8 | helm = "~> 1.2" 9 | null = "~> 2.1" 10 | } 11 | } -------------------------------------------------------------------------------- /CDK/AWS_CDK/automation_rocks/automation_rocks.egg-info/SOURCES.txt: -------------------------------------------------------------------------------- 1 | README.md 2 | setup.py 3 | automation_rocks/automation_rocks.egg-info/PKG-INFO 4 | automation_rocks/automation_rocks.egg-info/SOURCES.txt 5 | automation_rocks/automation_rocks.egg-info/dependency_links.txt 6 | automation_rocks/automation_rocks.egg-info/requires.txt 7 | automation_rocks/automation_rocks.egg-info/top_level.txt -------------------------------------------------------------------------------- /GKE_Cluster_with_Nginx_Ingress/modules/ingress/namespace.tf: -------------------------------------------------------------------------------- 1 | resource kubernetes_namespace certs { 2 | count = terraform.workspace != "default" ? 1 : 0 3 | 4 | metadata { 5 | annotations = { 6 | name = local.namespace 7 | } 8 | 9 | labels = merge( 10 | tomap({ "name" = local.namespace }), 11 | var.tags 12 | ) 13 | name = local.namespace 14 | } 15 | } -------------------------------------------------------------------------------- /CDK/AWS_CDK/app.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from aws_cdk import core 4 | 5 | from automation_rocks.automation_rocks_stack import ( 6 | AutomationRocksStack, 7 | nova, 8 | ohio, 9 | ) 10 | 11 | 12 | app = core.App() 13 | AutomationRocksStack(app, "automation-rocks-nova", env=nova) 14 | 15 | AutomationRocksStack(app, "automation-rocks-ohio", env=ohio) 16 | 17 | app.synth() 18 | -------------------------------------------------------------------------------- /Inspec/files/setup-docker-secrets.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -f .env-prod ]; then 4 | echo ".env-prod already exists, if you would like to regenerate your secrets, please delete this file and re-run the script." 5 | else 6 | echo ".env-prod does not exist, creating..." 7 | cat >.env-prod - << EOF 8 | SECRET_KEY_BASE=$(openssl rand -hex 64) 9 | CIPHER_PASSWORD=$(openssl rand -hex 64) 10 | CIPHER_SALT=$(openssl rand -hex 32) 11 | EOF 12 | fi 13 | echo "Done" -------------------------------------------------------------------------------- /Inspec/files/nginx.conf: -------------------------------------------------------------------------------- 1 | user nginx nginx; 2 | worker_processes 2; 3 | error_log /var/log/nginx/error.log; 4 | worker_rlimit_nofile 8192; 5 | 6 | events { 7 | worker_connections 4096; 8 | } 9 | 10 | http { 11 | server { 12 | listen 80 default_server; 13 | listen [::]:80 default_server; 14 | server_name _; 15 | server_tokens off; 16 | root /home/root; 17 | 18 | location / { 19 | index index.html; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /helm_example/values.yaml: -------------------------------------------------------------------------------- 1 | replicaCount: 1 2 | helm_example: 3 | name: "helm-example" 4 | namespace: "helm-example" 5 | image_pull_policy: "IfNotPresent" 6 | SSL_REDIRECT: "true" 7 | region: "us-east-1" 8 | logging: "3" 9 | image: 10 | repository: jenkins/jenkins 11 | tag: lts 12 | pullPolicy: IfNotPresent 13 | service: 14 | name: helm-example 15 | type: LoadBalancer 16 | externalPort: 80 17 | internalPort: 8080 -------------------------------------------------------------------------------- /Connect.py: -------------------------------------------------------------------------------- 1 | import pymongo 2 | 3 | _author_ = 'panong' 4 | 5 | uri = "mongodb://Harry:Hogwarts4ever@192.142.32.100/gryffindor" 6 | client = pymongo.MongoClient(uri) 7 | database = client['gryffindor'] 8 | collection = database['SortingHat'] 9 | 10 | 11 | def record(): 12 | wizards = collection.find({}) 13 | for person in wizards: 14 | print ("Are you afraid of what you'll hear?\nYour Animagus is a {}, {}".format(person['Animagus'],person['Member'])) 15 | 16 | record() 17 | 18 | -------------------------------------------------------------------------------- /Inspec/files/inspec/ssh/inspec.yml: -------------------------------------------------------------------------------- 1 | name: PAnong-SSH-Inspec-Profile 2 | title: PAnong Sample SSH InSpec Profile 3 | maintainer: Patricia Anong 4 | copyright: Patricia Anong 5 | copyright_email: patriciaanong@gmail.com 6 | license: Apache-2.0 7 | summary: An InSpec Compliance Profile For SSH 8 | version: 0.1.0 9 | inspec_version: '>= 4.4.0' 10 | 11 | depends: 12 | - name: ssh-baseline 13 | url: https://github.com/dev-sec/ssh-baseline/archive/master.tar.gz 14 | 15 | supports: 16 | - platform-name: debian 17 | - platform-name: ubuntu -------------------------------------------------------------------------------- /DMS/DMS_TABLEMAPPINGS.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": [ 3 | { 4 | "rule-type": "selection", 5 | "rule-id": "1", 6 | "rule-name": "1", 7 | "object-locator": { 8 | "schema-name": "DRWHO", 9 | "table-name": "%" 10 | }, 11 | "rule-action": "include" 12 | }, 13 | { 14 | "rule-type": "transformation", 15 | "rule-id": "2", 16 | "rule-name": "2", 17 | "rule-target": "schema", 18 | "object-locator": { 19 | "schema-name": "DRWHO" 20 | }, 21 | "rule-action": "rename", 22 | "value": "DRWHO" 23 | } 24 | ] 25 | } -------------------------------------------------------------------------------- /Inspec/files/inspec/linux/inspec.yml: -------------------------------------------------------------------------------- 1 | name: PAnong-Linux-Inspec-Profile 2 | title: PAnong Sample Linux InSpec Profile 3 | maintainer: Patricia Anong 4 | copyright: Patricia Anong 5 | copyright_email: patriciaanong@gmail.com 6 | license: Apache-2.0 7 | summary: An InSpec Compliance Profile For Linux 8 | version: 0.1.0 9 | inspec_version: '>= 4.4.0' 10 | 11 | depends: 12 | - name: linux-baseline 13 | url: https://github.com/dev-sec/linux-baseline/archive/master.tar.gz 14 | 15 | supports: 16 | - platform-name: debian 17 | - platform-name: ubuntu -------------------------------------------------------------------------------- /GKE_Cluster_with_Nginx_Ingress/outputs.tf: -------------------------------------------------------------------------------- 1 | output cluster_name { 2 | value = module.gke.name 3 | } 4 | 5 | output cluster_endpoint { 6 | sensitive = true 7 | value = module.gke.endpoint 8 | } 9 | 10 | output client_certificate { 11 | sensitive = true 12 | value = module.gke.client_certificate 13 | } 14 | 15 | output client_key { 16 | sensitive = true 17 | value = module.gke.client_key 18 | } 19 | 20 | output cluster_ca_certificate { 21 | sensitive = true 22 | value = module.gke.cluster_ca_certificate 23 | } -------------------------------------------------------------------------------- /Inspec/files/inspec/docker/inspec.yml: -------------------------------------------------------------------------------- 1 | name: PAnong-Docker-Inspec-Profile 2 | title: PAnong Sample Docker InSpec Profile 3 | maintainer: Patricia Anong 4 | copyright: Patricia Anong 5 | copyright_email: patriciaanong@gmail.com 6 | license: Apache-2.0 7 | summary: An InSpec Compliance Profile For Docker 8 | version: 0.1.0 9 | inspec_version: '>= 4.4.0' 10 | 11 | depends: 12 | - name: docker-baseline 13 | url: https://github.com/dev-sec/cis-docker-benchmark/archive/master.tar.gz 14 | 15 | supports: 16 | - platform-name: debian 17 | - platform-name: ubuntu -------------------------------------------------------------------------------- /GKE_Cluster_with_Nginx_Ingress/modules/ingress/data_sources.tf: -------------------------------------------------------------------------------- 1 | locals { 2 | 3 | sa_name = "dns-sa-${var.name_prefix}-${var.environment}" 4 | 5 | namespace = "certs-manager" 6 | 7 | template_vars = { 8 | project = var.project, 9 | 10 | env = var.environment, 11 | 12 | name = "letsencrypt-${var.environment}", 13 | 14 | email = "devops@patricia-anong.com", 15 | 16 | namespace = local.namespace, 17 | 18 | dns_secret_name = kubernetes_secret.dns_sa_credentials[0].metadata[0].name, 19 | 20 | } 21 | 22 | helm_chart_values = templatefile( 23 | "${path.module}/certs/values.yaml.tpl", 24 | local.template_vars 25 | ) 26 | 27 | } -------------------------------------------------------------------------------- /GKE_Cluster_with_Nginx_Ingress/modules/ingress/nginx_ingress.tf: -------------------------------------------------------------------------------- 1 | resource helm_release ingress { 2 | 3 | count = terraform.workspace != "default" ? 1 : 0 4 | 5 | name = "nginx" 6 | 7 | repository = "https://kubernetes-charts.storage.googleapis.com" 8 | 9 | chart = "nginx-ingress" 10 | 11 | version = "" 12 | force_update = true 13 | 14 | cleanup_on_fail = true 15 | 16 | set { 17 | name = "rbac.create" 18 | value = true 19 | } 20 | 21 | set { 22 | name = "podSecurityPolicy.enabled" 23 | value = true 24 | } 25 | 26 | set { 27 | name = "controller.publishService.enabled" 28 | value = true 29 | } 30 | 31 | } -------------------------------------------------------------------------------- /Automation/CloudFormationPlaybook.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: Run CloudFormation 4 | hosts: "localhost" 5 | connection: "local" 6 | gather_facts: false 7 | 8 | tasks: 9 | - name: launch ansible cloudformation template 10 | cloudformation: 11 | stack_name: "Transformers1" 12 | state: "present" 13 | region: "us-east-1" 14 | disable_rollback: true 15 | template: "autobots.json" 16 | template_parameters: 17 | DBPassword: "NoDeceptic0ns" 18 | DBUser: "OptimusPrime" 19 | KeyName: "autobots" 20 | Subnets: "subnet-3c892210,subnet-e9dcbaa1" 21 | tags: 22 | Stack: "AgeOfExtinction" -------------------------------------------------------------------------------- /GKE_Cluster_with_Nginx_Ingress/terraform.tfvars: -------------------------------------------------------------------------------- 1 | project = "panong-blog-gke" 2 | region = "us-east1" 3 | environment = "dev" 4 | name_prefix = "devops-rules" 5 | 6 | master_authorized_networks_config = [ 7 | { 8 | cidr_blocks = [ 9 | { 10 | cidr_block = "86.75.30.9/32" 11 | display_name = "Jenny" 12 | }, 13 | ] 14 | }, 15 | ] 16 | 17 | shielded_instance_config = { 18 | enable_secure_boot = true 19 | enable_integrity_monitoring = true 20 | } 21 | 22 | enable_apis = { 23 | kubernetes = "container.googleapis.com" 24 | iam = "iam.googleapis.com" 25 | cloud_resource = "cloudresourcemanager.googleapis.com" 26 | } -------------------------------------------------------------------------------- /DMS/DMS_CREATE_TASK.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import boto3 4 | 5 | #CONNECT TO DMS VIA BOTO3 CLIENT 6 | client = boto3.client('dms') 7 | 8 | response = client.create_replication_task( 9 | ReplicationTaskIdentifier='dr-who-migration', 10 | SourceEndpointArn='arn:aws:dms:us-east-1:687720138916:endpoint:T2LA4RF4ULC44N3RR2PFTMRZCY', 11 | TargetEndpointArn='arn:aws:dms:us-east-1:687720138916:endpoint:MOAITORVFW3E62MS4A2QXAGVYA', 12 | ReplicationInstanceArn='arn:aws:dms:us-east-1:687720138916:rep:MT3SNM4BY5U4KAEOH4XUZEO4ME', 13 | MigrationType='full-load', 14 | TableMappings='file://DMS_TABLEMAPPINGS.json', 15 | ReplicationTaskSettings='file://DMS_TASKSETTINGS.json' 16 | ) -------------------------------------------------------------------------------- /helm_example/templates/test-svc.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: {{ .Values.helm_example.service.name }}-service 5 | namespace: {{ .Values.helm_example.namespace }} 6 | annotations: 7 | service.beta.kubernetes.io/aws-load-balancer-backend-protocol: tcp 8 | spec: 9 | type: {{ .Values.helm_example.service.type }} 10 | ports: 11 | - name: http 12 | port: {{ .Values.helm_example.service.externalPort }} 13 | targetPort: {{ .Values.helm_example.service.internalPort }} 14 | protocol: TCP 15 | selector: 16 | app: {{ .Values.helm_example.service.name }} 17 | externalTrafficPolicy: Local 18 | status: 19 | loadBalancer: {} -------------------------------------------------------------------------------- /GKE_Cluster_with_Nginx_Ingress/modules/ingress/variables.tf: -------------------------------------------------------------------------------- 1 | variable project { 2 | description = "The project ID to host the cluster in" 3 | type = string 4 | } 5 | 6 | variable region { 7 | description = "The location (region or zone) to host the cluster in" 8 | type = string 9 | } 10 | 11 | variable environment { 12 | description = "Environment in which to deploy" 13 | type = string 14 | } 15 | 16 | variable name_prefix { 17 | description = "Company or Application Name appended to full name of a resource" 18 | type = string 19 | } 20 | 21 | variable tags { 22 | description = "Tags to be applied to the deployed resources" 23 | type = map(string) 24 | } -------------------------------------------------------------------------------- /Migrate_To_RDS_Oracle/install_cli_pip.py: -------------------------------------------------------------------------------- 1 | #BOOTSTRAP AWS CLI 2 | curl -O https://bootstrap.pypa.io/get-pip.py 3 | python get-pip.py 4 | pip install awscli 5 | 6 | 7 | #CONFIRM AWSCLI INSTALLED 8 | aws --version 9 | 10 | #INSTALL BOTO3 -PYTHON INTERFACE TO AWS CLI 11 | pip install awscli boto3 -U --ignore-installed six 12 | 13 | #VERIFY BOTO3 INSTALLATION: IF NOTHING HAPPENS, THE INTALLATION WAS SUCCESSFUL 14 | python -c "import boto3" 15 | 16 | #CONFIGURE AWS 17 | aws configure 18 | AWS Access Key ID [None]: *************CRMA 19 | AWS Secret Access Key [None]: *********************************91O4X 20 | Default region name [None]: us-east-1 21 | Default output format [None]: json -------------------------------------------------------------------------------- /Migrate_To_RDS_Oracle/Create_Tablespace.py: -------------------------------------------------------------------------------- 1 | #CREATE THE NECESSARY TABLESPACE ON TARGET DB 2 | #!/usr/bin/python 3 | 4 | import os 5 | import sys 6 | from subprocess import Popen, PIPE 7 | 8 | sql = """ 9 | set linesize 120 10 | col owner for a10 11 | col object_name for a30 12 | set wrap off 13 | 14 | CREATE TABLESPACE WONDERWOMAN_DATA 15 | DATAFILE SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED; 16 | """ 17 | 18 | proc = Popen(["sqlplus", "panong/dbalady@WONDERWOMAN"], stdout=PIPE, stdin=PIPE, stderr=PIPE) 19 | proc.stdin.write(sql) 20 | (out, err) = proc.communicate() 21 | 22 | if proc.returncode != 0: 23 | print err 24 | sys.exit(proc.returncode) 25 | else: 26 | print out -------------------------------------------------------------------------------- /CDK/TerraformCDK/help: -------------------------------------------------------------------------------- 1 | ======================================================================================================== 2 | 3 | Your cdktf Python project is ready! 4 | 5 | cat help Prints this message 6 | 7 | Compile: 8 | python3 ./main.py Compile and run the python code. 9 | 10 | Synthesize: 11 | cdktf synth Synthesize Terraform resources to cdktf.out/ 12 | 13 | Diff: 14 | cdktf diff Perform a diff (terraform plan) for the given stack 15 | 16 | Deploy: 17 | cdktf deploy Deploy the given stack 18 | 19 | Destroy: 20 | cdktf destroy Destroy the given stack 21 | 22 | ======================================================================================================== -------------------------------------------------------------------------------- /Inspec/gcp.tf: -------------------------------------------------------------------------------- 1 | provider "google" { 2 | credentials = "${file("creds.json")}" 3 | project = var.project 4 | region = "us-east1" 5 | } 6 | 7 | module "instance" { 8 | source = "./modules/instance" 9 | namespace = var.namespace 10 | name = var.name 11 | environment = var.environment 12 | machine_type = var.machine_type 13 | enabled = var.enabled 14 | } 15 | 16 | module "bucket" { 17 | source = "./modules/storage" 18 | namespace = var.namespace 19 | name = var.name 20 | environment = var.environment 21 | encryption = var.encryption 22 | enabled = var.enabled 23 | matches_storage_class = var.matches_storage_class 24 | } 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /GKE_Cluster_with_Nginx_Ingress/main.tf: -------------------------------------------------------------------------------- 1 | module gke { 2 | 3 | source = "./modules/gke" 4 | project = var.project 5 | region = var.region 6 | enable_apis = var.enable_apis 7 | environment = local.env 8 | name_prefix = var.name_prefix 9 | tags = [lower(local.common_tags["iac"]), lower(local.common_tags["environment"]), lower(local.common_tags["owner"])] 10 | 11 | master_authorized_networks_config = var.master_authorized_networks_config 12 | 13 | shielded_instance_config = var.shielded_instance_config 14 | 15 | } 16 | 17 | module ingress { 18 | source = "./modules/ingress" 19 | project = var.project 20 | region = var.region 21 | environment = local.env 22 | name_prefix = var.name_prefix 23 | tags = local.common_tags 24 | } -------------------------------------------------------------------------------- /Inspec/files/index.html: -------------------------------------------------------------------------------- 1 | 2 |
Thank you for reading my blog and following along!
7 |Check out some of my other code on GitHub. 13 |
Check out some of my other blog posts here.
15 | 16 |© Patricia Anong, 2019
17 | 18 |