I needed to check a HTTPS URL that required authentication of a client Certificate from the command line.
Using curl was a perfect fit.
curl --insecure --cert-type pem --cert /home/dummyuser/client-cert-stacked.pem --interface eth0:1 "https://192.168.1.2/GetKeepAlive"
Note: I use double quotes " "
around the url because if there are any special characters or spaces it will not be read correctly.
Options | Option Description |
---|---|
-- insecure or - k |
Disable Certificate Verification against a Root/Intermediate |
-- cert or - E |
(HTTPS) Tells curl to use the specified certificate file. The certificate must be in PEM format.
If the optional password isn’t specified, it will be queried for on the terminal. Note that this certificate is the If this option is used several times, the last one will be used. |
-- cert-type |
(SSL) Private key file type (DER, PEM, and ENG are supported). |
-- interface |
Query the URL using a specified interface. |