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

cloudflash-openvpn

v0.1.8

Published

openvpn is a easy to use module that exposes endpoints to configure openvpn on any linux system

Downloads

12

Readme

cloudflash-openvpn

List of APIs

OpenVPN API

Post openvpn server configuration

Verb      URI                Description
POST    /openvpn/server	    Update the openvpn server.conf file.

Example Request and Response

Request JSON

{
    "port": 7000,
    "dev": "tun",
    "proto": "udp",
    "ca": "/etc/ca-bundle.pem",
    "dh": "/etc/dh1024.pem",
    "cert": "/etc/identity/snap.cert",
    "key": "/etc/identity/snap.key",
    "server": "172.17.0.0 255.255.255.0",
    "ifconfig-pool-persist": "/etc/openvpn/ip.map",
    "script-security": "3 system",
    "multihome": true,
    "management": "127.0.0.1 2020",
    "cipher": "AES-256-CBC",
    "tls-cipher": "AES256-SHA",
    "auth": "SHA1",
    "topology": "subnet",
    "route-gateway": "172.17.0.1",
    "client-config-dir": "/config/openvpn/ccd",
    "ccd-exclusive": true,
    "client-to-client": true,
    "route": [
        "192.168.0.0 255.255.255.0",
        "192.168.1.0 255.255.255.0"
    ],
    "push": [
        "route 192.168.3.0 255.255.255.0",
        "comp-lzo no"
    ],
    "tls-timeout": 10,
    "max-clients": 254,
    "persist-key": true,
    "persist-tun": true,
    "status": "/var/log/server-status.log",
    "keepalive": "5 45",
    "comp-lzo": "no",
    "sndbuf": 262144,
    "rcvbuf": 262144,
    "txqueuelen": 500,
    "replay-window": "512 15",
    "duplicate-cn": true,
    "log-append": "/var/log/vpn-general.log",
    "verb": 3,
    "mlock": true
}

Response JSON

{
   "id": "e06f3da5-3d1e-4eae-8647-b18cd59b418d",
   "config":
   {
       "port": 7000,
       "dev": "tun",
       "proto": "udp",
       "ca": "/etc/ca-bundle.pem",
       "dh": "/etc/dh1024.pem",
       "cert": "/etc/identity/snap.cert",
       "key": "/etc/identity/snap.key",
       "server": "172.17.0.0 255.255.255.0",
       "ifconfig-pool-persist": "/etc/openvpn/ip.map",
       "script-security": "3 system",
       "multihome": true,
       "management": "127.0.0.1 2020",
       "cipher": "AES-256-CBC",
       "tls-cipher": "AES256-SHA",
       "auth": "SHA1",
       "topology": "subnet",
       "route-gateway": "172.17.0.1",
       "client-config-dir": "/config/openvpn/ccd",
       "ccd-exclusive": true,
       "client-to-client": true,
       "route":
       [
           "192.168.0.0 255.255.255.0",
           "192.168.1.0 255.255.255.0"
       ],
       "push":
       [
           "route 192.168.3.0 255.255.255.0",
           "comp-lzo no"
       ],
       "tls-timeout": 10,
       "max-clients": 254,
       "persist-key": true,
       "persist-tun": true,
       "status": "/var/log/server-status.log",
       "keepalive": "5 45",
       "comp-lzo": "no",
       "sndbuf": 262144,
       "rcvbuf": 262144,
       "txqueuelen": 500,
       "replay-window": "512 15",
       "duplicate-cn": true,
       "log-append": "/var/log/vpn-general.log",
       "verb": 3,
       "mlock": true
   }
}

Upon error, error code 500 will be returned

Post openvpn client configuration

Verb	URI	        	 	   Description
POST	/openvpn/client	       Update the openvpn server.conf file.

Example Request and Response

Request JSON

{
    "pull": true,
    "tls-client": true,
    "dev": "tun",
    "remote": "raviserver 7000",
    "proto": "udp",
    "ca": "/home/calsoft-admin/openvpn/keys/ca.crt",
    "dh": "/home/calsoft-admin/openvpn/keys/dh1024.pem",
    "cert": "/home/calsoft-admin/openvpn/keys/client1.crt",
    "key": "/home/calsoft-admin/openvpn/keys/client1.key",
    "cipher": "AES-256-CBC",
    "tls-cipher": "AES256-SHA",
    "push":
    [
        "route 192.168.122.0 255.255.255.0"
    ],
    "persist-key": true,
    "persist-tun": true,
    "status": "/var/log/server-status.log",
    "comp-lzo": "no",
    "verb": 3,
    "mlock": true
}

Response JSON

{
   "id": "9c70d5d1-83a5-472b-84eb-708e8a7564f8",
   "config":
   {
       "pull": true,
       "tls-client": true,
       "dev": "tun",
       "remote": "raviserver 7000",
       "proto": "udp",
       "ca": "/home/calsoft-admin/openvpn/keys/ca.crt",
       "dh": "/home/calsoft-admin/openvpn/keys/dh1024.pem",
       "cert": "/home/calsoft-admin/openvpn/keys/client1.crt",
       "key": "/home/calsoft-admin/openvpn/keys/client1.key",
       "cipher": "AES-256-CBC",
       "tls-cipher": "AES256-SHA",
       "push":
       [
           "route 192.168.122.0 255.255.255.0"
       ],
       "persist-key": true,
       "persist-tun": true,
       "status": "/var/log/server-status.log",
       "comp-lzo": "no",
       "verb": 3,
       "mlock": true
   }
}

Add a User to VPN

Verb	URI	        	               Description
POST	/openvpn/server/:server/users	 Add user into client-config-directory

Example Request and Response

Request JSON

{
	"id": "d6bd1f89-dfee-44a6-8863-8a0802ee7acd",
	"email": "[email protected]",
	"push": 
     [
	   "dhcp-option DNS x.x.x.x",
	   "ip-win32 dynamic",
	   "route-delay 5"
	]
}

Response JSON

{
   "result": true
}

Upon error, error code 500 will be returned

Delete a User from VPN

Verb	URI	                               Description
DELETE	/openvpn/server/:id/users/:user	   Delete user from client-config-directory

On Success returns 200 with JSON data

Example Request and Response

Response JSON

{ deleted: true }

Describe openvpn

Verb	URI	                 Description
GET	/openvpn/server/:id	   Show OpenVPN server info 

Example Request and Response

Response JSON

{
   "id": "d6bd1f89-dfee-44a6-8863-8a0802ee7acd",
   "users":
   [
       null,          
       {
           "id": "4ac5b5bb-884c-43ae-a9ca-271de189acb1",
           "email": "[email protected]",
           "push":
           [
               "dhcp-option DNS x.x.x.x",
               "ip-win32 dynamic",
               "route-delay 5"
           ]
       },
       {
           "id": "4ac5b5bb-884c-43ae-a9ca-271de189acb1",
           "email": "[email protected]",
           "push":
           [
               "dhcp-option DNS x.x.x.x",
               "ip-win32 dynamic",
               "route-delay 5"
           ]
       },
       {
           "id": "d6bd1f89-dfee-44a6-8863-8a0802ee7acd",
           "email": "[email protected]",
           "push":
           [
               "dhcp-option DNS x.x.x.x",
               "ip-win32 dynamic",
               "route-delay 5"
           ]
       }
   ],
   "connections":
   [
       {
           "cname": "snap_3375.1024",
           "remote": "67.100.39.69:38371",
           "received": "1435527",
           "sent": "1129202",
           "since": "Mon Jun 25 05:23:26 2012",
           "ip": "10.1.20.0/24"
       }
   ]
}

Describe openvpn server

Verb	URI	                 Description
GET	/openvpn/server	   Show openvpn server configuration. 

Example Request and Response

Response JSON

{
    "servers": 
    [
        {
            "id": "9e830e8d-6312-409d-b781-d2e005027f59",
            "config": 
            {
                "port": 700,
                "dev": "tun",
                "proto": "udp",
                "ca": "/etc/ca-bundle.pem",
                "dh": "/etc/dh1024.pem",
                "cert": "/etc/identity/snap.cert",
                "key": "/etc/identity/snap.key",
                "server": "172.17.0.0 255.255.255.0",
                "script-security": "3 system",
                "multihome": true,
                "management": "127.0.0.1 2020",
                "cipher": "AES-256-CBC",
                "tls-cipher": "AES256-SHA",
                "auth": "SHA1",
                "topology": "subnet",
                "route-gateway": "172.17.0.1",
                "client-config-dir": "/config/openvpn/ccd",
                "ccd-exclusive": true,
                "client-to-client": true,
                "route":
                [
                    "192.168.0.0 255.255.255.0",
                    "192.168.1.0 255.255.255.0"
                ],
                "push": 
                [
                    "route 192.168.3.0 255.255.255.0",
                    "comp-lzo no"
                ],
                "max-clients": 254,
                "persist-key": true,
                "persist-tun": true,
                "status": "/var/log/server-status.log",
                "keepalive": "5 45",
                "comp-lzo": "no",
                "sndbuf": 262144,
                "rcvbuf": 262144,
                "txqueuelen": 500,
                "replay-window": "512 15",
                "verb": 3,
                "mlock": true
            }
        }
   ]
}

Describe openvpn client

Verb	URI	                 Description
GET	/openvpn/client	   Show openvpn client configuration. 

Example Request and Response

Response JSON

{
   "clients":
   [
       {
           "id": "989b12e6-564d-488d-9796-4ded01bcfbad",
           "config":
           {
               "pull": true,
               "tls-client": true,
               "dev": "tun",
               "remote": "raviserver 7000",
               "proto": "udp",
               "ca": "/home/calsoft-admin/openvpn/keys/ca.crt",
               "dh": "/home/calsoft-admin/openvpn/keys/dh1024.pem",
               "cert": "/home/calsoft-admin/openvpn/keys/client1.crt",
               "key": "/home/calsoft-admin/openvpn/keys/client1.key",
               "cipher": "AES-256-CBC",
               "tls-cipher": "AES256-SHA",
               "push":
               [
                   "route 192.168.122.0 255.255.255.0"
               ],
               "persist-key": true,
               "persist-tun": true,
               "status": "/var/log/server-status.log",
               "comp-lzo": "no",
               "verb": 3,
               "mlock": true
           }
       }
   ]
}

Delete client configuration

Verb	URI	                               Description
DELETE	openvpn/client/:client	   Delete user from client-config-directory

On Success returns 200 with JSON data

Example Request and Response

Response JSON

{
   "deleted": true
}

Delete server configuration

Verb	URI	                               Description
DELETE	openvpn/server/:server	   Delete user from client-config-directory

On Success returns 200 with JSON data

Example Request and Response

Response JSON

{
   "deleted": true
}