Skip to content

A convenient tool for connecting to Koç University's VPN using OpenConnect.

License

Notifications You must be signed in to change notification settings

KUACC-VALAR-HPC-KOC-UNIVERSITY/kuvpn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

188 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KUVPN v2.0.2

KUVPN is a simple CLI tool written in Rust that retrieves the DSID cookie and executes the OpenConnect command to connect to the VPN for Koç University.

Table of Contents

Features

  • Login to vpn.ku.edu.tr on Linux/Mac.
  • Retrieve DSID cookie
  • Execute OpenConnect command
  • Headless Execution
  • Automatic or Manuel Login Navigation
  • Session management
  • CLI Based
  • Openconnect Wrapper

Prerequisites

  • Mandatory: OpenConnect
    • On Ubuntu:
      sudo apt install openconnect

Installation

Binary Install (Recommended)

Install KUVPN with the following command:

curl --proto '=https' --tlsv1.2 -sSfL https://raw.githubusercontent.com/KUACC-VALAR-HPC-KOC-UNIVERSITY/kuvpn/main/install.sh | bash

Note: Always inspect scripts before running commands from the internet!

Binary Install (Manual)

  1. Download: Get the latest binary from the GitHub releases page.

  2. Move the binary: Place it in a directory that's in your $PATH (e.g., /usr/local/bin/):

    sudo mv kuvpn /usr/local/bin/
  3. Make it executable:

    sudo chmod +x /usr/local/bin/kuvpn
  4. Verify installation:

    kuvpn --version

Build & Install from Source

  1. Install Rustup:
    Use the following command (or your package manager) to install Rustup. Although Cargo is available through some package managers, using Rustup is recommended:

    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  2. Install KUVPN from source:

    cargo install --git https://github.com/KUACC-VALAR-HPC-KOC-UNIVERSITY/kuvpn

Usage

Simply run KUVPN with: ( No arguments required )

kuvpn

For help and more details:

kuvpn --help

Command-line Options

Below is the help message displayed when running kuvpn --help:

A convenient tool for connecting to Koç University's VPN using OpenConnect.

Usage: kuvpn [OPTIONS]

Options:
  -u, --url <URL>
          The URL to the page where we will start logging in and looking for DSID
          
          [default: https://vpn.ku.edu.tr]

  -l, --level <LEVEL>
          The level of logging

          Possible values:
          - off:   No logs
          - info:  Informational messages
          - warn:  Warning messages
          - debug: Debugging messages
          - error: Error messages
          - trace: Detailed stacktrace messages
          
          [default: error]

      --domain <DOMAIN>
          The Domain of the DSID found
          
          [default: vpn.ku.edu.tr]

  -g, --get-dsid
          Gives the user the dsid without running openconnect

  -d, --disable-headless
          Gets DSID without headless mode

  -c, --clean
          Delete session information

  -r, --run-command <RUN_COMMAND>
          Command to run openconnect with (e.g., doas, sudo, pkexec, or a custom script)

      --openconnect-path <OPENCONNECT_PATH>
          Path or command name for openconnect. Defaults to 'openconnect'. Can be a relative or absolute path
          
          [default: openconnect]

      --no-auto-login
          Disable automatic login handlers and only poll for DSID in a headful browser

      --email <EMAIL>
          Email for login (optional)

  -h, --help
          Print help (see a summary with '-h')

  -V, --version
          Print version

Troubleshooting: Cookie Rejection

If you get this error, the easiest fix is to clear your session:

Unexpected 302 result from server
Creating SSL connection failed
Cookie was rejected by server; exiting.

You can clear your session like this:

kuvpn -c

Troubleshooting: Unable to login?

If you aren't able to login via the cli'a automation, you can disable the auto login so that you can do it via the browser's gui. To do this run the following command:

kuvpn --no-auto-login --disable-headless

Later, once you login, it will remember your session so you can login without the need for this, on the next logins.

Waiting forever: seeminly doing nothing?

In this case, kuvpn may be trying to download a static chrome to run, you can check logs using -l debug, if after a long time it still fails to download & run chrome, you can install chrome/chromium by hand to the machine, to bypass this issue.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contributing

Contributions are welcome! If you have ideas, bug fixes, or improvements, please open an issue or submit a pull request.

About

A convenient tool for connecting to Koç University's VPN using OpenConnect.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •