npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

fortigate-web-sslvpn

v2.2.0

Published

Make requests through FortiGate SSL VPN using the web mode.

Downloads

22

Readme

fortigate-web-sslvpn

This module focuses on the web mode of FortiGate SSL VPN, if you are looking for the tunnel mode check out openfortivpn.

Motivations

What is the "web mode" ?

According to https://docs.fortinet.com/document/fortigate/7.4.2/administration-guide/869159/ssl-vpn-best-practices, web-only mode provides clientless network access using a web browser with built-in SSL encryption.

You can find a documentation about this mode at https://docs.fortinet.com/document/fortigate/7.4.2/administration-guide/100733/ssl-vpn-web-mode.

Why use it over the "tunnel" mode ?

You may need a script to connect over a service through SSL VPN but you don't want to (or can't) setup FortiClient or openfortivpn on the machine running the script : this is where this module comes in handy.

In my case, I needed to connect to a service through SSL VPN from a serverless API. I couldn't use openfortivpn because it requires root access to setup the VPN tunnel. Also I would've only one connection at a time, while I needed multiple connections at the same time. In that case, using the "web mode" is the only solution.

Installation

You can use any package manager you want, here are some examples:

# NPM
npm install fortigate-web-sslvpn

# Yarn
yarn add fortigate-web-sslvpn

# pnpm
pnpm add fortigate-web-sslvpn

Usage

import { initWebSSLVPNSession } from "fortigate-web-sslvpn";

// Authenticate and create a VPN session.
const vpn = await initWebSSLVPNSession(
  "username",
  "password",
  "https://sslvpn.example.com" // No trailing slash or path.
);

// Use the VPN session to make requests.
const response = await vpn.request("https://service.example.com", {
  method: "POST",
  body: JSON.stringify({ hello: "world" }),
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer DummyTokenForExample"
  }
});

// Returns a `Headers` object containing the response headers.
// Learn more at <https://developer.mozilla.org/docs/Web/API/Headers>
console.log(response.headers);

// Status code of the response as a number, e.g. `200`
console.log(response.status);

// The response body as a string.
console.log(response.data); // e.g. `{"hello":"world"}`

// You can also close the VPN session when you're done.
// Otherwise, it usually expires after 5 minutes.
await vpn.close();