Coder Social home page Coder Social logo

udm-proxy's Introduction

Proxy for UDM Pro

Create a reverse proxy for UDM Pro.

Work based upon unifi-utilities/unifios-utilities#149

Prerequisities

Setup

Follow the steps below to get going

  1. Download or clone this repository into /mnt/data/proxy.

  2. Customize on_boot.d/30-proxy.sh to your needs.

  3. Symlink container proxy boot script

    $ ln -sf /mnt/data/proxy/on_boot.d/30-proxy.sh /mnt/data/on_boot.d/.

  4. Run boot script (to create/update network and create CNI configuration for container)

    $ /mnt/data/on_boot.d/30-proxy.sh

    It will fail when trying to run the container, but thats okay, its just for setting op needed configuration before initial image run.

  5. Register the container with podman

    $ podman run -d --systemd=false --network proxy --name proxy -v "/mnt/data/proxy/Caddyfile:/etc/proxy/Caddyfile" xpherism/udm-proxy

  6. Run boot script again and we are done :-)

Remember to change the etc/caddy/Caddyfile to your requirements and add additional mounts to podman run if needed.
The default caddefile proxies unifi.my.domain to 10.0.0.1 (ie. unifi controller) If you keep the proxy settings for the unifi controller, then you need do following first to avoid redirect recursion

$ ln -sf /mnt/data/proxy/etc/unifi-core/config.yaml /mnt/data/unifi-os/unifi-core/.

This disabled http->https redirect from unifi controller which is the cause of the above problem.

Image

Container image xpherism/udm-proxy is caddy built with the following modules

Feel free to use the vanilla caddy docker image or roll your own depending on your needs.

To update container image, simple do

$ podman stop proxy && podman rm proxy and run boot script again :-)

For more information

To build your own image, simple fork this repository and change what you need and simple run

$ docker build --platform arm64 -t udm-proxy .

TODO

  • Add DNS proxy DoH or DoT to xpherism:udm-proxy docker image
  • If bored make a simple UI to reverse proxy :-)

udm-proxy's People

Contributors

nickalleyne avatar xpherism avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

udm-proxy's Issues

Instructions in ReadMe seem to be incorrect

Hi there,

It seems the instructions in readme are incorrect, particularly around the symlink, and ensuring it is in onboot.d .

Unless I am doing it completely wrong, the symlinking is not linking where it should be for the booting, and even the initial run.

Thanks for looking into this!

Unable to pull docker image with Podman

Hi there,

I have been trying to pull the docker image with Podman (Step 5), but been unable to, getting the below error message:

# podman run -d --systemd=false --network proxy --name proxy -v "/mnt/data/proxy/Caddyfile:/etc/proxy/Caddyfile" xpherism:udm-proxy
Trying to pull docker.io/library/xpherism:udm-proxy...
  denied: requested access to the resource is denied
Trying to pull quay.io/xpherism:udm-proxy...
  error parsing HTTP 404 response body: invalid character '<' looking for beginning of value: "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">\n<title>404 Not Found</title>\n<h1>Not Found</h1>\n<p>The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.</p>\n"
Trying to pull registry.fedoraproject.org/xpherism:udm-proxy...
  manifest unknown: manifest unknown
Error: unable to pull xpherism:udm-proxy: 3 errors occurred:
        * Error initializing source docker://xpherism:udm-proxy: Error reading manifest udm-proxy in docker.io/library/xpherism: errors:
denied: requested access to the resource is denied
unauthorized: authentication required

        * Error initializing source docker://quay.io/xpherism:udm-proxy: Error reading manifest udm-proxy in quay.io/xpherism: error parsing HTTP 404 response body: invalid character '<' looking for beginning of value: "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">\n<title>404 Not Found</title>\n<h1>Not Found</h1>\n<p>The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.</p>\n"
        * Error initializing source docker://registry.fedoraproject.org/xpherism:udm-proxy: Error reading manifest udm-proxy in registry.fedoraproject.org/xpherism: manifest unknown: manifest unknown

I am new-ish to docker, so tried to ensure I was logged in with my docker account on the UDM, both through docker and through podman, but to no avail.

If I do a docker pull xpherism/udm-proxy it completes successfully.

Note that I do not have my Caddyfile fully setup yet, but I dont believe that is required at this stage

Any ideas?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.