OpenSSl Useful Commands

Linux Command & Tools

Check SSL Certificate dates


# check site

$ echo | openssl s_client -servername localhost -connect localhost:443 2>/dev/null | openssl x509 -noout -dates

# check file

$  sudo openssl x509 -dates -noout -in ./server.crt

$  sudo openssl x509 -dates -noout -in ./server.pem

Check SSL Certificate expired


# result 0 : not expired

# result 1 : expired

# check site

$ echo | openssl s_client -servername localhost -connect localhost:443 2>/dev/null | openssl x509 -checkend 86400000 -noout ; echo $?

# check file

$  sudo openssl x509 -checkend 86400 -noout -in ./server.pem ; echo $?

Get SSL Certificate Info


# check site

$ echo | openssl s_client -servername localhost -connect localhost:443 2>/dev/null

# check file

$ sudo openssl x509 -text -in ./server.pem

Get SSL Certificate CN only


# check site

$ echo | openssl s_client -servername localhost -connect localhost:443 2>/dev/null | openssl x509 -noout -subject

# check file

$ sudo openssl x509 -noout -subject -in ./server.pem

Use CA Certificate to verify SSL Certificate


$ openssl verify -verbose -CAfile ./ca.cert ./server.cert
./server.cert: OK

Linux Command & Tools
[tmux] installation – tarball and configuration

Previously, I was a screen user, it helped me to open multiple sessions and windows to manage lots of Linux servers. But, its window split feature is not pretty friendly, so, that’s why I started using tmux. Info tmux gitrepo – https://github.com/tmux/tmux tmux packages – https://github.com/tmux/tmux/releases ( you may download favorite version here …

Linux Command & Tools
[Linux Bash Shell] custom bind keys

Shell short keys : https://www.gnu.org/software/bash/manual/html_node/Bindable-Readline-Commands.html#Bindable-Readline-Commands https://ss64.com/bash/syntax-keyboard.html We can use bind command to set the short keys in Bash environment. dump short keys : $ bind -p set short keys from file $ bind -f {key map file} set short key directly $ bind '"\C-p": shell-backward-kill-word' How to know the key code …

Linux Command & Tools
[Linux Commands] How to listen a port via command line to handle http request

NC $ while true; do echo 'HTTP/1.1 200 OK' | nc -l 8080; sleep 0.5; done GET / HTTP/1.1 User-Agent: curl/7.33.0 Host: localhost:8080 Accept: */* $ curl http://localhost:8080 -v * Rebuilt URL to: http://localhost:8080/ * About to connect() to localhost port 8080 (#0) * Trying 127.0.0.1… * Adding handle: conn: …