mirror of https://github.com/wg-easy/wg-easy
committed by
GitHub
32 changed files with 1341 additions and 349 deletions
@ -1,3 +1,4 @@ |
|||
# Copyright (c) Emile Nijssen (WeeJeWel) |
|||
# Founder and Codeowner of WireGuard Easy (wg-easy) |
|||
* @WeeJeWel |
|||
# Maintained by Philip Heiduck (pheiduck) |
|||
* @pheiduck |
|||
|
|||
@ -0,0 +1,38 @@ |
|||
--- |
|||
name: 🐛 Bug Report |
|||
description: Create a report to help us improve |
|||
title: "[Bug]: " |
|||
labels: |
|||
- "bug" |
|||
|
|||
body: |
|||
- type: markdown |
|||
attributes: |
|||
value: | |
|||
**Thanks :heart: for taking the time to fill out this bug report!** |
|||
We kindly ask that you search to see if an issue [already exists](https://github.com/wg-easy/wg-easy/issues?q=is%3Aissue+sort%3Acreated-desc+) for the bug you encountered. |
|||
|
|||
- type: textarea |
|||
id: what-happened |
|||
attributes: |
|||
label: Describe the bug |
|||
placeholder: Tell us what you see! |
|||
value: "A bug happened!" |
|||
validations: |
|||
required: true |
|||
|
|||
- type: textarea |
|||
id: what-should-happen |
|||
attributes: |
|||
label: Expected behavior |
|||
placeholder: Tell us what you expected! |
|||
value: "Work just fine!" |
|||
validations: |
|||
required: true |
|||
|
|||
- type: textarea |
|||
id: logs |
|||
attributes: |
|||
label: Relevant log output |
|||
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. |
|||
render: shell |
|||
@ -0,0 +1,48 @@ |
|||
--- |
|||
name: 🛠️ Feature Request |
|||
description: Suggest an idea to help us improve |
|||
title: "[Feat]: " |
|||
labels: |
|||
- "enhancement" |
|||
|
|||
body: |
|||
- type: markdown |
|||
attributes: |
|||
value: | |
|||
**Thanks :heart: for taking the time to fill out this feature request report!** |
|||
We kindly ask that you search to see if an issue [already exists](https://github.com/wg-easy/wg-easy/issues?q=is%3Aissue+sort%3Acreated-desc+) for your feature. |
|||
|
|||
We are also happy to accept contributions from our users. For more details see [here](https://github.com/wg-easy/wg-easy/blob/master/contributing.md). |
|||
|
|||
- type: textarea |
|||
attributes: |
|||
label: Description |
|||
description: | |
|||
A clear and concise description of the feature you're interested in. |
|||
validations: |
|||
required: true |
|||
|
|||
- type: textarea |
|||
attributes: |
|||
label: Suggested Solution |
|||
description: | |
|||
Describe the solution you'd like. A clear and concise description of what you want to happen. |
|||
validations: |
|||
required: true |
|||
|
|||
- type: textarea |
|||
attributes: |
|||
label: Alternatives |
|||
description: | |
|||
Describe alternatives you've considered. |
|||
A clear and concise description of any alternative solutions or features you've considered. |
|||
validations: |
|||
required: false |
|||
|
|||
- type: textarea |
|||
attributes: |
|||
label: Additional Context |
|||
description: | |
|||
Add any other context about the problem here. |
|||
validations: |
|||
required: false |
|||
@ -1,38 +0,0 @@ |
|||
--- |
|||
name: Bug report |
|||
about: Create a report to help us improve |
|||
title: '' |
|||
labels: '' |
|||
assignees: '' |
|||
|
|||
--- |
|||
|
|||
**Describe the bug** |
|||
A clear and concise description of what the bug is. |
|||
|
|||
**To Reproduce** |
|||
Steps to reproduce the behavior: |
|||
1. Go to '...' |
|||
2. Click on '....' |
|||
3. Scroll down to '....' |
|||
4. See error |
|||
|
|||
**Expected behavior** |
|||
A clear and concise description of what you expected to happen. |
|||
|
|||
**Screenshots** |
|||
If applicable, add screenshots to help explain your problem. |
|||
|
|||
**Desktop (please complete the following information):** |
|||
- OS: [e.g. macOS 12.1] |
|||
- Browser [e.g. chrome, safari] |
|||
- Version [e.g. 22] |
|||
|
|||
**Smartphone (please complete the following information):** |
|||
- Device: [e.g. iPhone6] |
|||
- OS: [e.g. iOS 8.1] |
|||
- Browser [e.g. stock browser, safari] |
|||
- Version [e.g. 22] |
|||
|
|||
**Additional context** |
|||
Add any other context about the problem here. |
|||
@ -0,0 +1,5 @@ |
|||
contact_links: |
|||
- name: Get Help |
|||
url: https://github.com/wg-easy/wg-easy/discussions/new?category=q-a |
|||
about: If you can't get something to work the way you expect, open a question in the discussions. |
|||
blank_issues_enabled: false |
|||
@ -0,0 +1,28 @@ |
|||
<!--- Provide a general summary of your changes in the Title above --> |
|||
|
|||
## Description |
|||
<!--- Describe your changes in detail --> |
|||
|
|||
## Motivation and Context |
|||
<!--- Why is this change required? What problem does it solve? --> |
|||
<!--- If it fixes an open issue, please link to the issue here. --> |
|||
|
|||
## How has this been tested? |
|||
<!--- Please describe in detail how you tested your changes. --> |
|||
<!--- Include details of your testing environment, tests ran to see how --> |
|||
<!--- your change affects other areas of the code, etc. --> |
|||
|
|||
## Screenshots (if appropriate): |
|||
|
|||
## Types of changes |
|||
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> |
|||
- [ ] Bug fix (non-breaking change which fixes an issue) |
|||
- [ ] New feature (non-breaking change which adds functionality) |
|||
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) |
|||
|
|||
## Checklist: |
|||
<!--- Go over all the following points, and put an `x` in all the boxes that apply. --> |
|||
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> |
|||
- [ ] My code follows the code style of this project. |
|||
- [ ] My change requires a change to the documentation. |
|||
- [ ] I have updated the documentation accordingly. |
|||
@ -0,0 +1,36 @@ |
|||
# wg-password |
|||
|
|||
`wg-password` (wgpw) is a script that generates bcrypt password hashes for use with `wg-easy`, enhancing security by requiring passwords. |
|||
|
|||
## Features |
|||
|
|||
- Generate bcrypt password hashes. |
|||
- Easily integrate with `wg-easy` to enforce password requirements. |
|||
|
|||
## Usage with Docker |
|||
|
|||
To generate a bcrypt password hash using docker, run the following command : |
|||
|
|||
```sh |
|||
docker run ghcr.io/wg-easy/wg-easy wgpw YOUR_PASSWORD |
|||
PASSWORD_HASH='$2b$12$coPqCsPtcFO.Ab99xylBNOW4.Iu7OOA2/ZIboHN6/oyxca3MWo7fW' // literally YOUR_PASSWORD |
|||
``` |
|||
|
|||
**Important** : make sure to enclose your password in **single quotes** when you run `docker run` command : |
|||
|
|||
```bash |
|||
$ echo $2b$12$coPqCsPtcF <-- not correct |
|||
b2 |
|||
$ echo "$2b$12$coPqCsPtcF" <-- not correct |
|||
b2 |
|||
$ echo '$2b$12$coPqCsPtcF' <-- correct |
|||
$2b$12$coPqCsPtcF |
|||
``` |
|||
|
|||
**Important** : Please note: don't wrap the generated hash password in single quotes when you use `docker-compose.yml`. Instead, replace each `$` symbol with two `$$` symbols. For example: |
|||
|
|||
``` yaml |
|||
- PASSWORD_HASH=$$2y$$10$$hBCoykrB95WSzuV4fafBzOHWKu9sbyVa34GJr8VV5R/pIelfEMYyG |
|||
``` |
|||
|
|||
This hash is for the password 'foobar123', obtained using the command `docker run ghcr.io/wg-easy/wg-easy wgpw foobar123` and then inserted an additional `$` before each existing `$` symbal. |
|||
|
Before Width: | Height: | Size: 105 KiB After Width: | Height: | Size: 104 KiB |
@ -1,9 +1,17 @@ |
|||
services: |
|||
wg-easy: |
|||
image: wg-easy |
|||
build: |
|||
dockerfile: ./Dockerfile |
|||
command: npm run serve |
|||
volumes: |
|||
- ./src/:/app/ |
|||
# - ./data/:/etc/wireguard |
|||
ports: |
|||
- "51820:51820/udp" |
|||
- "51821:51821/tcp" |
|||
cap_add: |
|||
- NET_ADMIN |
|||
- SYS_MODULE |
|||
environment: |
|||
# - PASSWORD=p |
|||
- WG_HOST=192.168.1.233 |
|||
|
|||
@ -1,8 +1,10 @@ |
|||
{ |
|||
"version": "1.0.1", |
|||
"scripts": { |
|||
"sudobuild": "DOCKER_BUILDKIT=1 sudo docker build --tag wg-easy .", |
|||
"build": "DOCKER_BUILDKIT=1 docker build --tag wg-easy .", |
|||
"serve": "docker compose -f docker-compose.yml -f docker-compose.dev.yml up", |
|||
"sudostart": "sudo docker run --env WG_HOST=0.0.0.0 --name wg-easy --cap-add=NET_ADMIN --cap-add=SYS_MODULE --sysctl=\"net.ipv4.conf.all.src_valid_mark=1\" --mount type=bind,source=\"$(pwd)\"/config,target=/etc/wireguard -p 51820:51820/udp -p 51821:51821/tcp wg-easy", |
|||
"start": "docker run --env WG_HOST=0.0.0.0 --name wg-easy --cap-add=NET_ADMIN --cap-add=SYS_MODULE --sysctl=\"net.ipv4.conf.all.src_valid_mark=1\" --mount type=bind,source=\"$(pwd)\"/config,target=/etc/wireguard -p 51820:51820/udp -p 51821:51821/tcp wg-easy" |
|||
} |
|||
} |
|||
File diff suppressed because it is too large
@ -0,0 +1,54 @@ |
|||
'use strict'; |
|||
|
|||
// Import needed libraries
|
|||
import bcrypt from 'bcryptjs'; |
|||
|
|||
// Function to generate hash
|
|||
const generateHash = async (password) => { |
|||
try { |
|||
const salt = await bcrypt.genSalt(12); |
|||
const hash = await bcrypt.hash(password, salt); |
|||
// eslint-disable-next-line no-console
|
|||
console.log(`PASSWORD_HASH='${hash}'`); |
|||
} catch (error) { |
|||
throw new Error(`Failed to generate hash : ${error}`); |
|||
} |
|||
}; |
|||
|
|||
// Function to compare password with hash
|
|||
const comparePassword = async (password, hash) => { |
|||
try { |
|||
const match = await bcrypt.compare(password, hash); |
|||
if (match) { |
|||
// eslint-disable-next-line no-console
|
|||
console.log('Password matches the hash !'); |
|||
} else { |
|||
// eslint-disable-next-line no-console
|
|||
console.log('Password does not match the hash.'); |
|||
} |
|||
} catch (error) { |
|||
throw new Error(`Failed to compare password and hash : ${error}`); |
|||
} |
|||
}; |
|||
|
|||
(async () => { |
|||
try { |
|||
// Retrieve command line arguments
|
|||
const args = process.argv.slice(2); // Ignore the first two arguments
|
|||
if (args.length > 2) { |
|||
throw new Error('Usage : wgpw YOUR_PASSWORD [HASH]'); |
|||
} |
|||
|
|||
const [password, hash] = args; |
|||
if (password && hash) { |
|||
await comparePassword(password, hash); |
|||
} else if (password) { |
|||
await generateHash(password); |
|||
} |
|||
} catch (error) { |
|||
// eslint-disable-next-line no-console
|
|||
console.error(error); |
|||
// eslint-disable-next-line no-process-exit
|
|||
process.exit(1); |
|||
} |
|||
})(); |
|||
@ -0,0 +1,5 @@ |
|||
#!/bin/sh |
|||
# This script is intended to be run only inside a docker container, not on the development host machine |
|||
set -e |
|||
# proxy command |
|||
node /app/wgpw.mjs "$@" |
|||
Loading…
Reference in new issue