Compare commits

..

6 Commits

Author SHA1 Message Date
John Hays aae8d44b94 Made http redirect configurable in dashboard.ini
8 months ago
John Hays cccf2be043 Punctuation
8 months ago
John Hays aaa65a7a80 Fixed titles
8 months ago
John Hays 668735608f dstar UFW rules
8 months ago
John Hays e3e9beb40a Documented UFW rules
8 months ago
John Hays 511ce019cd Added http to https redirection
8 months ago

@ -52,6 +52,8 @@ It should also run under the newer/faster [Bun Runtime](https://bun.sh/)
If it comes up successfully, go to a browser and put in a HTTPS request to your domain name. If you get a dashboard, you have done everything correctly.
The install will redirect http to https, if you don't want the redirect, see the end of [index.js](index.js)
I have included a systemd service file in the util subdirectory which can be copied to /lib/systemd/system
```
sudo cp util/dsgwdashboard.service /lib/systemd/system

@ -1,4 +1,4 @@
const http = require("http");
const https = require("https");
const fs = require("fs");
const ini = require("ini");
const lineReader = require('line-reader');
@ -12,6 +12,8 @@ const inifile = ini.parse(fs.readFileSync('/usr/local/etc/dashboard.ini', 'utf-8
const host = inifile.config.host;
const port = inifile.config.port;
const links = inifile.logs.links;
const redirecthttp = inifile.config.redirecthttp;
const httpport = inifile.config.httpport;
const linkqueue = parseInt(inifile.params.linkqueue);
const heardqueue = parseInt(inifile.params.heardqueue);
const headers = inifile.logs.headers;
@ -32,8 +34,12 @@ updatelinks();
let serverPort = inifile.config.port;
const server = http
const server = https
.createServer(
{
key: fs.readFileSync("key.pem"),
cert: fs.readFileSync("cert.pem"),
},
app
)
.listen(serverPort, ()=>{
@ -79,7 +85,7 @@ function updatelinks() {
};
let i = 0;
while (i < lines.length) {
if(lines[i] != "" && lines[i].match(linksregex)) {
if(lines[i] != "") {
var mylinks = lines[i].match(linksregex);
// console.log(JSON.stringify(lines[i]));
var linkrec = {'timestamp':mylinks[1].substr(0,19)+'Z' , 'protocol':mylinks[2] , 'device':mylinks[4],
@ -131,3 +137,14 @@ const tailheaders = new Tail(headers, {startPos : 'end'}, line => {
});
tailheaders.start();
// See dashboard.ini in /usr/local/etc
if (redirecthttp){
var http = require("http");
http
.createServer(function (req, res) {
res.writeHead(301, { Location: "https:"+host });
res.end();
})
.listen(httpport);
}

6
package-lock.json generated

@ -13,6 +13,7 @@
"configparser": "^0.3.10",
"express": "^4.18.2",
"express-ws": "^5.0.2",
"http": "^0.0.1-security",
"ini": "^4.1.1",
"jquery": "^3.7.1",
"line-reader": "^0.4.0",
@ -479,6 +480,11 @@
"node": ">= 0.4"
}
},
"node_modules/http": {
"version": "0.0.1-security",
"resolved": "https://registry.npmjs.org/http/-/http-0.0.1-security.tgz",
"integrity": "sha512-RnDvP10Ty9FxqOtPZuxtebw1j4L/WiqNMDtuc1YMH1XQm5TgDRaR1G9u8upL6KD1bXHSp9eSXo/ED+8Q7FAr+g=="
},
"node_modules/http-errors": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",

@ -4,6 +4,7 @@
"configparser": "^0.3.10",
"express": "^4.18.2",
"express-ws": "^5.0.2",
"http": "^0.0.1-security",
"ini": "^4.1.1",
"jquery": "^3.7.1",
"line-reader": "^0.4.0",

@ -1,4 +1,4 @@
# Configuration and Management
I have localized all of the configuration files in **/usr/local/etc**:
@ -38,3 +38,14 @@ To view the systemctl manual - type<br/>
**man systemctl**
Also spend some time with [DStarGateway README](https://github.com/F4FXL/DStarGateway/blob/develop/README.md) (and the README.md in each subdirectory)
# Firewall
If using [ufw](https://wiki.ubuntu.com/UncomplicatedFirewall), [dstar](dstar) rules are aavailable.
```
cd util
sudo cp dstar /etc/ufw/applications.d
sudo ufw reload
sudo ufw status verbose
```

@ -5,6 +5,8 @@ links=/var/log/dstargateway/Links.log
dgwconfig=/usr/local/etc/dstargateway.cfg
host= #enter your domain name here (this should also have a cert for https)
port=443
redirecthttp=true #switch to false if using http
httpport=80
[urls]
sponsorname= #sponsor name
cosponsorname= #cosponsor name

@ -0,0 +1,4 @@
[dstar]
title=D-STAR
description=Ports for D-STAR
ports=20005,40001/tcp|12345,12346,20010,20001:20009,30001,30051:30059,30061:30065,40000,53001/udp
Loading…
Cancel
Save