remove nodejs auth with python auth daemon

This commit is contained in:
deflax 2021-10-10 22:12:06 +00:00
parent ff658f7496
commit 0632abdba7
7 changed files with 15 additions and 1277 deletions

View file

@ -10,3 +10,8 @@
6. Encoder server = `rtmp://example:1935/live` key = `live?key=supersecret`
7. Open a browser and go to `https://example.com` to view your live stream via hls.js
### Powered by
https://github.com/zom-bi/zomstream

View file

@ -1,6 +0,0 @@
FROM node:12
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY server.js ./
CMD ["npm", "start"]

1229
auth/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,16 +0,0 @@
{
"name": "auth",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "nodemon server.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"express": "^4.17.1",
"nodemon": "^2.0.7"
}
}

View file

@ -1,22 +0,0 @@
const express = require('express');
const app = express();
app.use(express.urlencoded());
app.post("/auth", function (req, res) {
/* This server is only available to nginx */
const streamkey = req.body.key;
/* You can make a database of users instead :) */
if (streamkey === "supersecret23") {
res.status(200).send();
return;
}
/* Reject the stream */
res.status(403).send();
});
app.listen(8000, function () {
console.log("Listening on port 8000!");
});

View file

@ -34,10 +34,16 @@ services:
#entrypoint: sh -c 'while true; do sleep 1; done'
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 15d & wait $${!}; done;'"
auth:
build: ./auth
auth: # PSK Authentication Service
image: python:3
user: nobody
command: python /code/auth.py
volumes:
- "./auth:/code"
# set the PSK Password for the Auth Daemon here
environment:
- password=ex4mple_p4ss
hostname: auth
container_name: auth
restart: always
networks:
- internal

View file

@ -35,7 +35,7 @@ http {
add_header Access-Control-Allow-Origin * always;
}
location /stat {
location /stats {
rtmp_stat all;
rtmp_stat_stylesheet stat.xsl;
#auth_basic Restricted Content; # Create a valid .htpasswd before uncommenting this.