Examine x509 Certificate
A quick way to examine a certificate in plain text…
openssl x509 -text -in cert.pem
Convert Separate Key/Cert Files to a PFX
The reverse of the process of extracting the key/certs from a PFX can be achieved via…
openssl pkcs12 -export -in [certificate.crt] -inkey [private.key] -out [package.pfx]
Upper To Lower To Upper Case Command Line
Nice trick to pipe command line data through to convert it’s alpha characters to upper or lower case.
From UPPER to lower…
tr [:upper:][:lower:]
From lower to UPPER…
tr [:lower:][:upper:]
For example…
ls /directory | tr [:lower:][:upper:] | sort
Enable Syntax Highlighting In VIM (vi) In Mac OSX
To enable the syntax highlight feature of Vim (vi) on Mac OSX, edit the /usr/share/vim/vimrc file and add the “syntax on” config. To do this from Terminal.app …
sudo vi /usr/share/vim/vimrc
…add a new line, “syntax on” and then save and close the file.
Convert DMG To ISO & ISO to DMG
To convert a Mac .dmg to a .iso image file, open Terminal.app and then run the following command…
hdiutil convert /path/to/filename.dmg -format UDTO -o /path/to/filename.iso
To convert a .iso image file to a Mac .dmg, also in Terminal.app run the following command…
hdiutil convert /path/to/filename.iso -format UDRW -o /path/to/filename.dmg
Strip Leading Zeros In Shell
Nice trick to strip leading zeros from an IP address at the command line (it turn 002.203.017.001 to 2.203.17.1)…
echo 002.203.017.001 | awk -F “.” ‘{print int($1)”.”int($2)”.”int($3)”.”int($4)}’
Convert PFX to Seperate Key/Cert Files
Using openssl to extract key and certificate files from a .pfx
To extract the private key…
openssl pkcs12 -in [filename.pfx] -nocerts -out [private.key]
To extract the certificate…
openssl pkcs12 -in [filename.pfx] -clcerts -nokeys -out [certificate.crt]
To decrypt the private key…
openssl rsa -in [private.key] -out [decrypted.key]
Symbols, Mac OSX Keyboard Shortcuts
Mac OSX keyboard shortcut combinations for many common symbols…
™ (trademark) = Option + 2
£ (pound) = Option + 3
¢ (cent) = Option + 4
∞ (infinity) = Option + 5
§ (section) = Option + 6
¶ (paragraph) = Option + 7
• (dot) = Option + 8
€ (euro) = Shift + Option + 2
° (degree) = Shift + Option + 8
¥ (yen) = Option + y
÷ (division) = Option + /
± (plus/minus) = Option + =
≥ (greater than or equal to) = Option + >
≤ (less than or equal to) = Option + <
√ (square root) = Option + v
π (pi) = Option + p
≈ (approx.) = Option + x
∆ (delta) = Option + j
∑ (sum) = Option + w
Ω (ohm) = Option + z
µ (micro) = Option + m
© (copyright) = Option + g
® (registered) = Option + r
† (dagger) = Option + t
HTTP(S) PUT w/Basic Authentiation via Curl
Need to use a secure HTTP PUT over SSL using Basic Auth?
curl -T file.txt -u https://[hostname]/[uri]
Add a -v to see that connection with verbose output.
Flush DNS Cache, Mac OSX
As a DNS admin, I frequently need to flush my local DNS cache in order to confirm that a change I made on a DNS server was correct. To do this on Mac OSX, open your Terminal.app and run the following command…
dscacheutil -flushcache