Tuesday, June 18, 2013

Adding self-signed SSL certficates to Google Chrome

Everytime I connect to my work web email server through our VPN I get a SSL Untrusted Certificate Error in Google Chrome and have to click on that annoying red screen that practically begs me not to Proceed.  It's not a BAD Certificate it's just Self-Signed.  You'd think Google would have done like FireFox did and give you a nice CLICK to ADD option to the offending SSL Certificate.

Well really it's not that big a deal but I just have to find fixes to these kind of things.


1.  Open a TERMINAL window.
2.  TYPE sudo apt-get install libnss3-tools (HIT ENTER).
3.  Open GEDIT or any text editor and cut and paste the below text (in green and no blank lines at the top or bottom):

 #!/bin/sh
#
# usage:  import-cert.sh remote.host.name [port]
#
REMHOST=$1
REMPORT=${2:-443}
exec 6>&1
exec > $REMHOST
echo | openssl s_client -connect ${REMHOST}:${REMPORT} 2>&1 |sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p'
certutil -d sql:$HOME/.pki/nssdb -A -t TC -n "$REMHOST" -i $REMHOST 
exec 1>&6 6>&-

4.  Save this file in your HOME directory as import-cert.sh and close GEDIT.
5.  Import your SSL by typing the following command into your TERMINAL window.

bash import-cert.sh YOUR.SERVER.NAME 443

6.  Done!


NOTES:  Replace YOUR.SERVER.NAME with your sever's fully quilitified domain name.  If your server is using a different PORT (443 is default) then replace the 443 with whatever PORT your company uses.  Make sure you can connect to YOUR SERVER (connect your VPN?)

Other useful certutil commands (TYPE them in a TERMINAL window):

List all certificates in your database:
certutil -L -d sql:$HOME/.pki/nssdb

To delete a certificate
certutil -d sql:$HOME/.pki/nssdb -D -n <certificate nickname>

Replace <certificate nickname> with the name displayed by the List Certificates command.



FULL CREDIT:  The Bash Script is NOT mine.  I did NOT write it, I found it on THIS SITE and it was written by Peter van der Does (according to the website).  Follow the link and read his article for a description of what all this does.



Sunday, June 16, 2013

Get Your Galaxy S3 Working With UBUNTU 12.04 +





ES File Explorer
Ever since I bought my Galaxy SIII, about a year ago, I've been trying to get it to work with Ubuntu with limited success.  I'd mostly given up on getting the phone to connect through the USB cable because I'd found a great Android App that connected to my Ubuntu Box through WiFi and SMB File Shares.

That program is called ES File Explorer and is a very useful, free, Android App.  It will connect to Ubuntu SMB Shares, Window Workgroup Shares, Windows Domain Shares, FTPs and Cloud Storage Services (Gdrive, Box, DropBox, and even SkyDirve) allowing file transfers between your portable device (phone) and your remote storage options.  I highly recommend it as an Android File Manager.

Well I thought I'd try to get my Galaxy S3 to connect with the USB cable again.  Here's the problem, Android 4 + uses MTP protocol (Media Transfer Protocol) instead of just mounting as a removable drive (like a USB Thumb Drive or Camera SD Card).  The MTP protocol was created by Microsoft so we can blame them :-)

Here's what we need to do, we need to get Ubuntu to use the MTP protocol.  We will need to use GVFS, the Gnome Virtual File System, which is built into Ubuntu 13.04 (I think) but has been backported to Ubuntu 12.04 and 12.10.  Lets Add GVFS.

1.  Open a Terminal Window

2.  TYPE   sudo add-apt-repository ppa:langdalepl/gvfs-mtp (hit enter)

3.  TYPE   sudo apt-get update (hit enter)

4.  TYPE  sudo apt-get upgrade (hit enter)

5.  Reboot your Computer.  I REPEAT, REBOOT YOUR COMPUTER !!!

PHONE CHANGES

6.  Turn the USB Debugging Mode ON in your Android Phone/Device.
      a.  On your phone/device goto SETTINGS.
      b.  Scroll down to DEVELOPER OPTIONS and select it.
      c.  About the 4th item down will be a check block labeled USB DEBUGGING
      d.  Check USB DEBUGGING (turn it on)

Done!  Plug your Android 4 + Device into your Ubuntu 12.04 + box and you should now be able to access your Android Device with Nautilus (File Manager).

If your phone memory card doesn't show up, make sure it's on and UNLOCKED. (enter your pass code while your phone is connected)  

NOTE:  Although I've used these steps to connect a Samsung Galaxy S3 on the Sprint Network running Android 4.1.2 to an Ubuntu 12.04 box, this method should work with other Android 4+ devices  like tablets (Nexus 7, 10s) and other Android 4+ phones (HTC One, etc...) and will work on Ubuntu 12.10.  The only thing is, this is about the 3rd time I've tried to do this and I did not Undo the other attempts before trying this.  The other attempts got my phone to show up in Nautilus and listed the file structure but not any files and did not allow file transfers. Some of the prior attempts may have changed things that I did not list here.