Pages

Thursday, July 19, 2018

OpenVPN on linux (PIA)

From: https://www.privateinternetaccess.com/archive/forum/discussion/18003/openvpn-step-by-step-setups-for-various-debian-based-linux-oss-with-videos-ubuntu-mint-debian

Install network-manager-openvpn and its dependencies
=============================================
    sudo apt-get install network-manager-openvpn network-manager network-manager-gnome network-manager-openvpn-gnome
    - then press [enter]

*{For Debian and Kali only}
    Enabling Interface Management
    sudo nano /etc/NetworkManager/NetworkManager.conf
    - then press [enter]
        - edit the line "managed=false" to be...
            "managed=true"
        - Save the file and exit by...
            - Press "Ctrl+x"
            - then press "y"
            - then press the [Enter] key

Reboot the computer now!


* After rebooting the computer continue with the following steps...

   
Make a directory and download the crt and pem files
=============================================
In Terminal - Make a directory to store the setup files
    mkdir ~/OpenVPN-setup-PIA
    - then press [enter]

Move into that directory
    cd ~/OpenVPN-setup-PIA
    - then press [enter]

Download the openvpn.zip from privateinternetaccess.com with...
    wget http://www.privateinternetaccess.com/openvpn/openvpn.zip
    - then press [enter]

Extract the files from the zip with...
    unzip openvpn.zip
    - then press [enter]

You can now exit the terminal with...
    exit
    - then press [enter]
  
Import the PIA OpenVPN config file
=============================================
- Right click the Network Manager on the menu bar
    - and click "Edit Connections..."
    - then click "Add"
    - choose "Import a saved VPN configuration..." for the connection type from the drop down menu
    - then click "Create..."
    - double click to go into "OpenVPN-setup-PIA" folder
    - choose which server you would like to setup and connect to
    - then click "Open"
    - Remove only the ":1198" from the "Gateway:" ( if present ) as only the domain name should be in this box
    - for the "User name:" type in your "p1234567" username
    - for the "Password:" type in the password that goes with your "p-xxxxx" username
    - Then click "Advanced..."
    - Check "Use custom gateway port:" and set it to "1198"
    - Click on the "Security" tab
    - Set the "Cipher:" to "AES-128-CBC"
    - Set the "HMAC Authentication:" to "SHA-1"
    - Click "OK"
    - Click "Save"
Reboot the computer now! (optional but recommended )

Now connect to the VPN
=============================================
- Now Left click the Network Manager on the menu bar
    - click "VPN Connections"
    - click Ex. "Mexico" {This will be the name of the server you chose to setup}
    - wait for it to connect
  
- Test by opening your Internet browser and going to...
    https://www.privateinternetaccess.com/pages/whats-my-ip/
    https://ipleak.net/
  
Enjoy!

Friday, May 18, 2018

Running Jupyter Notebooks on a Remote Server via SSH

From: https://techtalktone.wordpress.com/2017/03/28/running-jupyter-notebooks-on-a-remote-server-via-ssh/

Step 1: On your Remote Computer

SSH into your remote server/machine. Open a Jupyter Notebook using the no-browser option (since we don’t need the browser just yet) on the Terminal.
sasha@remote $ jupyter notebook --no-browser --port=8887
I’ve changed the port to 8887 just to make it easier to explain the next step.
Jupyter generally returns to you a token with the URL for your browser for the first time you login to it. If you get one, store this somewhere for later.

Step 2: On your Local Computer

Start an SSH Tunnel, and connect it to the Jupyter notebook you just started on the server.
ssh -N -L localhost:8888:localhost:8887 sasha@remote
-L binds the local_address:port1 to a remote_address:port2. To be specific, it specifies that the connections for the socket on the local host are to be forwarded to the remote host. The socket then listens to the specified bind address.
-N specifies not to execute a remote command. This is useful when forwarding ports.
On your local computer, navigate to localhost:8888. The browser will probably ask you for a token. Put the token the Remote Computer returned to you in the earlier step.

To close the SSH tunnel 

on the local machine
look for the process and kill it manually:
local_user@local_host$ ps aux | grep localhost:8889
local_user 18418  0.0  0.0  41488   684 ?        Ss   17:27   0:00 ssh -N -f -L localhost:8888:localhost:8889 remote_user@remote_host
local_user 18424  0.0  0.0  11572   932 pts/6    S+   17:27   0:00 grep localhost:8889

local_user@local_host$ kill -15 18418
Alternatively, you can start the tunnel without the -f option. The process will then remain in the foreground and can be killed with ctrl-c.
On the remote machine, kill the IPython server with ctrl-c ctrl-c.