Merge branch 'master' into master

This commit is contained in:
Alexander 2024-01-09 12:49:34 +07:00 committed by GitHub
commit 7ba2ed6368
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 81 additions and 95 deletions

View file

@ -83,16 +83,9 @@ module.exports = class Server {
}
if (req.path.startsWith('/api/') && req.headers['authorization']) {
const authorizationHash = bcrypt.createHash('bcrypt')
.update(req.headers['authorization'])
.digest('hex');
const passwordHash = bcrypt.createHash('bcrypt')
.update(PASSWORD)
.digest('hex');
if (bcrypt.timingSafeEqual(Buffer.from(authorizationHash), Buffer.from(passwordHash))) {
if (bcrypt.compareSync(req.headers['authorization'], bcrypt.hashSync(PASSWORD, 10))) {
return next();
}
return res.status(401).json({
error: 'Incorrect Password',
});

View file

@ -67,7 +67,7 @@ module.exports = class WireGuard {
throw err;
});
// await Util.exec(`iptables -t nat -A POSTROUTING -s ${WG_DEFAULT_ADDRESS.replace('x', '0')}/24 -o eth0 -j MASQUERADE`);
// await Util.exec(`iptables -t nat -A POSTROUTING -s ${WG_DEFAULT_ADDRESS.replace('x', '0')}/24 -o ' + WG_DEVICE + ' -j MASQUERADE`);
// await Util.exec('iptables -A INPUT -p udp -m udp --dport 51820 -j ACCEPT');
// await Util.exec('iptables -A FORWARD -i wg0 -j ACCEPT');
// await Util.exec('iptables -A FORWARD -o wg0 -j ACCEPT');
@ -95,7 +95,7 @@ module.exports = class WireGuard {
[Interface]
PrivateKey = ${config.server.privateKey}
Address = ${config.server.address}/24
ListenPort = ${WG_PORT}
ListenPort = 51820
PreUp = ${WG_PRE_UP}
PostUp = ${WG_POST_UP}
PreDown = ${WG_PRE_DOWN}