Metadata-Version: 2.1
Name: cloudmesh-vpn
Version: 5.0.5
Summary: Virtual Private Network connection in the cloudmesh suite
Author-email: Gregor von Laszewski <laszewski@gmail.com>, "J.P. Fleischer" <jacquespfleischer@gmail.com>
Maintainer-email: Gregor von Laszewski <laszewski@gmail.com>, "J.P. Fleischer" <jacquespfleischer@gmail.com>
License:                                  Apache License
                                   Version 2.0, January 2004
                                http://www.apache.org/licenses/
        
           Copyright 2021,2022 Gregor von Laszewski, University of Virginia
        
           Licensed under the Apache License, Version 2.0 (the "License");
           you may not use this file except in compliance with the License.
           You may obtain a copy of the License at
        
               http://www.apache.org/licenses/LICENSE-2.0
        
           Unless required by applicable law or agreed to in writing, software
           distributed under the License is distributed on an "AS IS" BASIS,
           WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
           See the License for the specific language governing permissions and
           limitations under the License.
        
Project-URL: Homepage, https://github.com/cloudmesh/cloudmesh-vpn
Project-URL: Documentation, https://github.com/cloudmesh/cloudmesh-vpn/blob/main/README.md
Project-URL: Repository, https://github.com/cloudmesh/cloudmesh-vpn.git
Project-URL: Issues, https://github.com/cloudmesh/cloudmesh-vpn/issues
Project-URL: Changelog, https://github.com/cloudmesh/cloudmesh-vpn/blob/main/CHANGELOG.md
Keywords: helper library,cloudmesh
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Environment :: Other Environment
Classifier: Environment :: Plugins
Classifier: Intended Audience :: Information Technology
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: Microsoft :: Windows :: Windows 10
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: User Interfaces
Classifier: Topic :: System
Classifier: Topic :: System :: Distributed Computing
Classifier: Topic :: System :: Shells
Classifier: Topic :: Utilities
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: cloudmesh-cmd5
Requires-Dist: cloudmesh-cmd5
Requires-Dist: cloudmesh-sys
Requires-Dist: cloudmesh-inventory
Requires-Dist: cloudmesh-configuration
Requires-Dist: keyring
Requires-Dist: pexpect
Requires-Dist: pytest

# cms vpn

## Organizations

### Functional

<div style="display: flex; align-items: flex-start;">
    <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/University_of_Virginia_Rotunda_logo.svg/2007px-University_of_Virginia_Rotunda_logo.svg.png" alt="fiu" width="100" style="margin-right: 10px;"/>
    <img src="https://brand.fiu.edu/_assets/images/fiu-alone.png" alt="fiu" width="200" style="margin-right: 10px;"/>
    <img src="https://www.ufl.edu/wp-content/uploads/sites/5/2022/12/UF-logo-500x500-1.png" alt="uf" width="100" style="margin-left: 10px;"/>
</div>

### Untested

* famu
* nyu
* uci
* gmu
* olemiss
* sc

## Install

### Windows

Open powershell as administrator.

Execute these commands:

```bash
python --version
```

If no number shows up, then you do not have Python. Download it from https://www.python.org/downloads/ and check `Add python.exe to PATH` in the installer.

If Python was just installed, open a new powershell as administrator.
Either way, execute:

```bash
mkdir ~/cm & cd ~/cm
pip install cloudmesh-installer
cloudmesh-installer get vpn
```


## Usage

To connect to the UVA Anywhere VPN, run

```bash
cms vpn connect
```

For other organizations, the `--service` flag can be used:

```bash
cms vpn connect --service=ufl
# possible services are uva fiu ufl
```

To disconnect from current VPN, run

```bash
cms vpn disconnect
```

To see info regarding your connection, run

```bash
cms vpn info
```

## Linux

### Requirements

On Linux we use the command `openconnect`. To check if it is available please use

```bash
$ which openconnect
```

If it is not available, you can install it un Ubuntu with 

```bash
$ sudo apt install openssl
$ sudo apt install openconnect
$ sudo apt install network-manager-openconnect
```
and in case you use gnoe also:

```bash
$ sudo apt install network-manager-gnome
$ sudo apt install network-manager-openconnect-gnome
```

### Getting certificates

We have tested this tool only with University of Virginia, but it should be simple to adapt. Just follow the 
instructions to obtain the certificates from your provider.

At UVA you find the certificate and other documentation at 

* <https://www.rc.virginia.edu/userinfo/linux/uva-anywhere-vpn-linux/>

we place all certificates into ~/.ssh/uva

```
mkdir -p You will receive a file ending in .p12. In this example we will assume it is named mst3k.p12.
cd ~/.ssh/uva
wget https://download.its.virginia.edu/local-auth/universal/usher.cer
```

To get a certificate for your device, go to 

* <https://cloud.securew2.com/public/82116/limited/?device=Unknown>

Fill it out and get the key. You will receive a 
file ending in .p12. In this example we will assume it 
is named mst3k.p12 and place it into ~/.ssh/uva/user.p12

It is important for us to rename this key to user.p12
so we have a simpler way of identifying it and writing this documentation.

Now convert the keys and certificates with the following commands

```bash
cd ~/.ssh/uva
openssl pkcs12 -in mst3k.p12 -nocerts -nodes -out mst3k.key
openssl pkcs12 -in mst3k.p12 -clcerts -nokeys -out mst3k.crt
openssl x509 -inform DER -in usher.cer -out usher.crt
```


Now your UVA directory should have the following files in it.

```
ls ~/.ssh/uva/
user.crt  user.key  user.p12  usher.cer  usher.crt
```


### Install and using the command

You can now use the cloudmesh cms vpn command.


```bash
$ pip install cloudmesh-vpn
$ cms help
```

To connect use 


```bash
$ cms vpn connect 
```

To show the status use

```bash
$ cms vpn connect 
```


To disconnect

```bash
$ cms vpn disconnect
```

## Acknowledgments

This work was in part funded by the NSF
CyberTraining: CIC: CyberTraining for Students and Technologies
from Generation Z with the award numbers 1829704 and 2200409.



## Manual Page

<!-- START-MANUAL -->
```
Command vpn
===========

::

  Usage:
        vpn connect [--service=SERVICE] [--timeout=TIMEOUT] [-v] [--choco]
        vpn disconnect [-v]
        vpn status [-v]
        vpn info

  This command manages the vpn connection

  Options:
      -v       debug [default: False]
      --choco  installs chocolatey [default: False]

  Description:
    vpn info
       prints out information about your current location as
       obtained via the vpn connection.

    vpn status
        prints out "True" if the vpn is connected
        and "False" if it is not.

    vpn disconnect
        disconnects from the VPN.

    vpn connect [--service=SERVICE]
        connects to the UVA Anywhere VPN.

        If the VPN is already connected a warning is shown.

        You can connect to other VPNs while specifying their names
        as given to you by the VPN provider with e service option.


```
<!-- STOP-MANUAL -->
