Last updated: 2024-01-19

Command Line Utilities

Coming soon

Linux

Coming soon

Java

Coming soon

Containers, K8s, Cloud

Coming soon

Liferay

Coming soon

SSL, TLS, OpenSSL security

Coming soon

Creating a self signed certificate in one line

Creat a new certificate for 'example.com' which is valid for 365 days. The key is in server.key and the cert is in server.crt


openssl req -nodes -x509 -newkey rsa:4096 -keyout server.key -out server.crt -days 365 -subj '/CN=example.com'
								

Working with PKCS12 (.pfx, .p12) certificate store

Export to PKCS12 file, certificate and key in X509 (pem) format


openssl pkcs12 -export -in server.crt -inkey server.key -out server.p12
							

Import from PKCS12 to X509 (pem) format


openssl pkcs12 -in server.p12 -nocerts -nodes -out server.key
openssl pkcs12 -in server.p12 -clcerts -nokeys -out server.crt
							

Showing certificate, key information

Certificate key and CA (certificate authority) verification


openssl verify -verbose -CAfile ca.crt server.crt
							

Oracle

Coming soon

Miscellaneous

Just dumping various notes

Check SMTP STARTTLS


openssl s_client -showcerts -connect smtp.server:25 -starttls smtp
							

replace ^M (0x0d)


sed -i 's/\r//' tomcat/conf/server.xml
							

HTTP readiness check with curl. This one is for Elasticsearch availability


#!/bin/bash

while [ true ]; do
  ES_STATUS="$(curl -s -w '%{http_code}' --insecure --connect-timeout 5 --max-time 10 -o /dev/null --noproxy '*' 'http://10.10.11.1:9200/_cluster/health?wait_for_status=green&timeout=5s')";
  if [ $ES_STATUS -eq "200" ]
  then
  	break;
  fi

  echo 'waiting for elasticsearch';
  sleep 5;
done;
							

Section Item 8.2

Password generation with simple shell commands


< /dev/urandom tr -dc A-Za-z0-9 | head -c${1:-16};echo;