Last active
October 22, 2021 13:43
-
-
Save mikeplate/3b90914b28461520974b15b61c9d0177 to your computer and use it in GitHub Desktop.
Linux Bash Snippets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Start reverse SSH tunnel from internal server to external endpoint on port 443 | |
# Port 8081 on external endpoint will then be connectable to internal server localsql port 1433 | |
ssh -N -R 0.0.0.0:8081:localsql:1433 remoteuser@company-endpoint.westeurope.cloudapp.azure.com -p 443 -i ./remoteuser.pem | |
# Show certificate for SMTP server with implicit TLS | |
openssl s_client -connect smtp.some-server.com:465 -servername smtp.some-server.com | |
# Show certificate for SMTP server with explicit TLS | |
openssl s_client -connect smtp.some-server.com:587 -servername smtp.some-server.com -starttls smtp | |
# Fetch date from an API where URL is stored in sqlite database and set locally as a replacement for NTP | |
sqlite3 /opt/owi/SqlOWI.db "select Value from AppSettings where Key='ApiUrl'" | xargs -i curl -s {}/_api/check | grep -oP \(\?\<=\time\":\"\)[^\"]+ | xargs -i date --set={} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment