Welcome
My name is Ulysses. Sr. Cloud Engineer at Cardinal Health.
About This Website
This is my static site based on Hugo.
My name is Ulysses. Sr. Cloud Engineer at Cardinal Health.
This is my static site based on Hugo.
Differences using gcloud table vs CSV format. Table format gcloud compute snapshots list \ --filter="sourceSnapshotSchedulePolicy ~ $POLICY AND sourceDisk~$disk$" \ --format="table(sourceDisk.basename(),name,creationTimestamp,sourceSnapshotSchedulePolicy.basename())" \ --sort-by "~creationTimestamp" \ --project="$PROJECT" CSV format gcloud compute snapshots list \ --filter="sourceSnapshotSchedulePolicy ~ $POLICY AND sourceDisk~$disk$" \ --format="csv[separator=','](sourceDisk.basename(),name,creationTimestamp,sourceSnapshotSchedulePolicy.basename())" \ --sort-by "~creationTimestamp" \ --project="$PROJECT" Output to file gcloud compute snapshots list \ --filter="sourceSnapshotSchedulePolicy ~ $POLICY AND sourceDisk~$disk$" \ --format="csv[separator=','](sourceDisk.basename(),name,creationTimestamp,sourceSnapshotSchedulePolicy.basename())" \ --sort-by "~creationTimestamp" \ --project="$PROJECT" > output.csv
If you are getting funky formatting in GCP Cloud Shell, run this to set the format. gcloud config set accessibility/screen_reader False
Here’s the command to list what SSL and TLS protocols are active. openssl ciphers -v | awk '{print $2}' | sort | uniq
Here’s another command to check what version of SSL and TLS is being used. nmap --script ssl-enum-ciphers -p 443 server.domain.com Result PORT STATE SERVICE 443/tcp open https | ssl-enum-ciphers: | TLSv1.2: | ciphers: ... In this example, only TLSv1.2 is in use. For security purposes, use TLSv1.2 or higher.
Here’s the command to list what app or package requires OpenSSL. repoquery --whatrequires --installed --recursive openssl Result authconfig-0:6.2.8-30.el7.x86_64 falcon-sensor-0:6.38.0-13501.el7.x86_64 python2-cryptography-0:1.7.2-2.el7.x86_64 realmd-0:0.16.1-12.el7_9.1.x86_64 terraform-0:1.3.6-1.x86_64
Here’s the command to display VM OS licenses. #!/bin/bash ts=$(date +%Y%m%d-%H%M%S) log="gcp-licenses-logs-$ts" >$log while read -r project; do echo "Project: $project" | tee -a $log gcloud compute instances list --project $project --format="table[no-heading](name,zone.basename())" > instances.list while read -r instance zone; do gcloud compute instances describe $instance \ --project $project \ --zone $zone \ --format="table[no-heading](name,zone.basename(),disks[0].licenses[0].basename())" | tee -a $log done < instances.list done < projectIds.list It’s going to go through a list of VM’s in each project and display the name, zone and license information.
Here’s the command to capture a GCP VM serial port output to your terminal. gcloud compute instances get-serial-port-output servername \ --zone us-central1-f \ --project your-project \ --port 1 You can also send the output to a file. gcloud compute instances get-serial-port-output servername \ --zone us-central1-f \ --project your-project \ --port 1 > output.txt
When you exhausted all efforts trying to login to a VM and there’s no other way to log in to the server, here’s a breakglass method to allow you to log in to a VM via a startup script. Just add the following bash script to the VM startup section. Change the username and password to your liking. Restart the server to trigger the startup script. After reboot, it should give you access to the server. In addition, you will also have sudo access so you can switch as root. ...
How to install pint utility on SLES machines. zypp in python-susepubliccloudinfo Once installed, you can run pint amazon servers –region='us-east-1' pint google servers –region='us-central1' pint microsoft servers –region='eastus'
Converting Mac and Linux Dates Linux #!/bin/bash start_time=$(date +%s) log=$(date -d @$start_time +%Y%m%d-%H%M%S) start=$(date -d @$start_time) echo $start_time echo $log echo $start sleep 10 stop_time=$(date +%s) stop=$(date -d @$stop_time) echo $stop_time echo $stop Mac #!/bin/bash start_time=$(date +%s) log=$(date -r $start_time +%Y%m%d-%H%M%S) start=$(date -r $start_time) echo $start_time echo $log echo $start sleep 10 stop_time=$(date +%s) stop=$(date -r $stop_time) echo $stop_time echo $stop Same output for both 1692292771 20230817-171931 Thu Aug 17 05:19:31 PM UTC 2023 1692292781 Thu Aug 17 05:19:41 PM UTC 2023