display asterisks when typing passwords in bash

Here’s how to display asterisks when typing passwords in Bash. #!/bin/bash unset password prompt="Enter Password:" while IFS= read -p "$prompt" -r -s -n 1 char do if [[ $char == $'\0' ]] then break fi prompt='*' password+="$char" done echo echo "Done. Password=$password"

September 18, 2023 · 1 min · ulysses

gcloud table vs csv format

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

September 18, 2023 · 1 min · ulysses

gcp cloud shell format

If you are getting funky formatting in GCP Cloud Shell, run this to set the format. gcloud config set accessibility/screen_reader False

September 18, 2023 · 1 min · ulysses

active ssl and tls protocols

Here’s the command to list what SSL and TLS protocols are active. openssl ciphers -v | awk '{print $2}' | sort | uniq

September 15, 2023 · 1 min · ulysses

checking what ssl and tls are in use

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.

September 15, 2023 · 1 min · ulysses

what requires openssl

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

September 15, 2023 · 1 min · ulysses

gcp vm licenses

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.

September 14, 2023 · 1 min · ulysses

capture gcp vm serial port output to terminal

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

August 28, 2023 · 1 min · ulysses

gcp vm breakglass ssh

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. ...

August 28, 2023 · 1 min · ulysses

install pint on sles

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'

August 28, 2023 · 1 min · ulysses