Skip to content

Instantly share code, notes, and snippets.

View tkishel's full-sized avatar

Thomas Kishel tkishel

  • Wiz
  • Portland, OR
View GitHub Profile
@tkishel
tkishel / aci-wiz.md
Last active May 4, 2023 18:52
Deploy WizCLI via an Azure Container Instance | TechNote

Deploy WizCLI as an Azure Container Instance | TechNote

Overview

This document outlines deploying the wiz-cli docker image as an Azure Container Instance.

By reusing the wiz-cli docker image (and changing its entrypoint) you leverage the supported docker image.

This TechNote illustrates scanning IaC templates, but can be extended or modified for other use cases.

@tkishel
tkishel / pc_agentless_gcp.md
Last active January 24, 2023 22:26
Prisma Cloud: Agentless Configuration: GCP

Prisma Cloud: Agentless Configuration: GCP

This documents the steps to configure Prisma Cloud Agentless Scanning for GCP Projects.

There are two scanning options (Same Account, Hub and Target) and two credential options (SaaS, Compute).

For Same Account scanning, using SaaS credentials:

  • Onboard the GCP Project in Prisma Cloud > Settings > Cloud Accounts, enabling Agentless Workload Scanning
  • Configure additional settings for Agentless Scanning of the Project in Prisma Cloud > Compute > Cloud Accounts
@tkishel
tkishel / gcp_agentless_hub_model_saas.md
Last active September 15, 2023 04:49
GCP Agentless Hub Model SaaS

Configure Agentless Scanning (GCP, Hub Model, SaaS)

This documents the steps to configure Prisma Cloud Agentless Scanning for GCP Projects, using the Hub and Target model with Prisma Cloud SaaS credentials.

Onboarding Projects in Prisma Cloud > Settings > Cloud Accounts provides almost all of the necessary configuration, with only cross-project configuration required to support the Hub and Target model.

In this document, each GCP Project and its Prisma Cloud Account use the same name. Doing so creates a one-to-one mapping of projects, accounts, resources, and filenames. This mapping is not required, but results in a simple series of steps.

Step 1

@tkishel
tkishel / gcp_agentless_same_account_cwp.md
Last active January 24, 2023 22:29
GCP Agentless (Same Account Model, Compute)

Configure Agentless Scanning (GCP, Same Account Model, Compute)

This documents the steps to configure Prisma Cloud Agentless Scanning for GCP Projects, using the Same Account model, with Prisma Cloud Compute credentials.

In this document, the GCP Project, its Service Account, and its Prisma Cloud Account use the same name. Doing so creates a one-to-one mapping of projects, accounts, resources, and filenames. This mapping is not required, but results in a simple series of steps.

Step 1

Set the following environment variable (locally, or in CloudShell) to define the name of the Project:

@tkishel
tkishel / gcp_agentless_hub_model_cwp.md
Last active January 24, 2023 22:29
GCP Agentless (Hub Model, Compute)

Configure Agentless Scanning (GCP, Hub Model, Compute)

This documents the steps to configure Prisma Cloud Agentless Scanning for GCP Projects, using the Hub and Target model, with Prisma Cloud Compute credentials.

In this document, each GCP Project, its Service Account, and its Prisma Cloud Account use the same name. Doing so creates a one-to-one mapping of projects, accounts, resources, and filenames. This mapping is not required, but results in a simple series of steps.

Step 1

Set the following environment variables (locally, or in CloudShell) to define the name of the Hub and Target Projects:

#!/usr/bin/env ruby
require 'uri'
require 'net/http'
# require 'openssl'
#### METHODS
def get_package(package)
if (matched = package.match(%r{^(?<name>.+)-(?<version>[^-]+)-(?<release>[^-]+)\.(?<architecture>\w+)}))
@tkishel
tkishel / puppet_until_idempotent.sh
Last active March 25, 2020 23:41
Sometimes it takes more than one run. This script runs puppet until it is idempotent or returns an error.
#!/bin/bash
[ "$PT_noop" = "true" ] && NOOP_FLAG="--noop" || unset NOOP_FLAG
puppet_command="/opt/puppetlabs/bin/puppet agent --onetime --verbose --no-daemonize --no-splay --no-usecacheonfailure --no-use_cached_catalog $NOOP_FLAG"
# Sometimes it takes more than one run ...
# Retries until idempotent or error.
#
# Waits for up to five minutes for an in-progress puppet run to complete.
@tkishel
tkishel / pes_tune_current.rb
Last active April 15, 2020 18:36
Extract current (startup and running) tunable configuration of PE Services from a Support Script
#!/usr/bin/env ruby
# Change into the Support Script output directory, and execute this script.
# Or, pass the directory as the parameter.
require 'json'
# Convert JAVA_ARGS string to a Hash.
def java_args_to_hash(s)

Decision Tree: Certificate Error

  • Verify the server setting in puppet.conf on the Agent is set to the Master (or the Load Balancer of the Master).

  • Note the datetime stamp of the files in puppet/ssl on the Agent

  • Review the Application and System logs.

    • Look for the start time of the last run, and for errors before and during that run for a root cause.
  • Execute puppet agent -t as root on Linux or an Administrator on Windows.

    • No Certificate?
  • Execute puppet cert list or puppetserver ca list on the Master

@tkishel
tkishel / prune_puppetdb_stockpile_queue.md
Created July 17, 2019 16:42
Prune PuppetDB Stockpile Queue

PuppetDB only stores one catalog and factset per node (but n number of reports), so deleting older catalog and fact queue files older than an hour (given runinterval=30) could allow PuppetDB to catch up on the queue, and would not have an impact on the data in PostgreSQL. To delete older catalogs and factsets (that would have been replaced by newer catalogs and factsets) from the PuppetDB queue:

find /opt/puppetlabs/server/data/puppetdb/stockpile/cmd/q -name "*_catalog_9_*.json.gz" -mmin +60 -delete
find /opt/puppetlabs/server/data/puppetdb/stockpile/cmd/q -name "*_facts_5_*.json.gz" -mmin +60 -delete