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

@dmikey/fastify-mtls-proxy

v1.0.5

Published

This proxy server seamlessly accepts client certificates and keys to forward upstream.

Downloads

13

Readme

@dmikey/fastify-mtls-proxy

This proxy server seamlessly accepts client certificates and keys to forward upstream.

why?

In secure environments such as browsers, self signed certificates are not honored to ensure that certificate authorities are vetted and thus ideally those using certificates are subject to some form of regulation.

However with-in self managed mTLS environments, self signed certificates make much sense to validate the client application's commands are under control of the client party and not snarfed by a mitm. The ability to generate x509 certificates through Subtle.crypto means the progression of continued security at the user custody level.

This server allows that communication to easily facilitate. Using natural proxy forwarding requests can use a traditional proxy model, supported by libraries like Axios, curl and others.

quick setup

install the package

yarn add @dmikey/fastify-mtls-proxy

setup the server to receive mTLS requests to forward.

import fastify from "fastify";
import mTLSProxyPlugin, { Options } from "@dmikey/fastify-mtls-proxy";

const app = fastify();
app.register(mTLSProxyPlugin, {} as Options);

how to use

Send a request to your server as you would to the original upstream. Specify proxy_cert and proxy_key in the post body.

bash using curl

curl --proxy "http://localhost:3000" "http://www.httpbin.org/ip"

or to make a secure request over the insecure proxy

curl --proxy-insecure "http://localhost:3000" "https://www.google.com"

typescript using the axios library

import axios from "axios";

axios
  .post("http://localhost:3000/ip", {
    headers: {
      host: "http://www.httpbin.org/",
    },
  })
  .then(function (response) {
    console.log(response);
  })
  .catch(function (error) {
    console.log(error);
  });

If you can not modify the headers, and can only modify the host of the platform you are trying to proxy through, using a query string parameter is available.

curl "http://localhost:3000/ip?upstream=http://httpbin.org/ip"
curl "http://localhost:3000/ip?upstream=https://www.httpbin.org"

Sending mTLS connection information along with the upstream request.

import axios from "axios";

axios
  .post("http://localhost:3000/", {
    headers: {
      host: "https://certauth.cryptomix.com",
    },
  })
  .then(function (response) {
    console.log(response);
  })
  .catch(function (error) {
    console.log(error);
  });

how pathing works

When using a requesting a resource, the pathing should be requested from the proxy.

Example a resource that is available at http://foo.com/my-resource would be requested as http://proxy.com/my-resource?upstream=http://foo.com/my-resource

advanced configuration

using the Options type, you can define

thanks

to the original work by all the contributors to the original modules.