How to Download SSL Certificate from a URL Using openssl

This is a note to myself because I don’t do this often enough to remember the whole thing…

openssl s_client -showcerts -connect hoge.com:443 < /dev/null | openssl x509 -outform DER > hoge.com.cer

You obviously have to have openssl on your machine. Install Cygwin if you are on Windows and that will give you an ability to execute openssl.

Test-NetConnection

One of the Cmdlet that I use often at work lately is Test-NetConnection. This one is good for your sanity check when you want your server to start to communicate with different endpoints. It supports ping test, TCP test, route tracing, and route selection diagnostics. 

$ Test-NetConnection -ComputerName google.com
ComputerName           : google.com
RemoteAddress          : 172.217.3.174
InterfaceAlias         : Ethernet
SourceAddress          : 192.168.1.23
PingSucceeded          : True
PingReplyDetails (RTT) : 14 ms

If you want to check if certain port is open, you can add -Port parameter to the command above and it checks the specified port.

$ Test-NetConnection -ComputerName google.com -Port 80
ComputerName     : google.com
RemoteAddress    : 172.217.3.174
RemotePort       : 80
InterfaceAlias   : Ethernet
SourceAddress    : 192.168.1.23
TcpTestSucceeded : True

Notice that TcpTestSucceeded data is True now. It means the current machine can reach the port 80 of the endpoint.

Robocopy

When I need to do some xcopy type of operation, I use robocopy. Robocopy is a tool that comes with Windows and it’s basically a replacement to the old xcopy in my opinion. I’m taking a note on it because I tend to forget the options I usually use.

robocopy C:\source C:\dest /E /R:1 /W:1

This one retries just once in case of an error after 1 second. It also copies sub directories even if they are empty. These options are good enough for me unless I’m working more on critical operations.