aminsg / Wireguard

Wireguard Panel [ Educational - Borrowed & modified codes - Public ]

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

33399-icq-flower-logo-icon-vector-icon-vector-epsProject Overview: Wireguard Panel

lang languages :

Persian

English


R (1)

  • The original name of this panel is WGDashboard
  • This project is a Wireguard panel that incorporates various codes collected from friends and modified by me. Since i know basic stuff in python language,i had to rely on chatgpt and my friend's code which i have studied and modified some of it and i have learned a lot.
  • It is intended for educational use and i changed some codes in css,html and javascript as well. However, please note that using it is at your own risk but I would be happy if others find it useful.
  • I also helped with the Wireguard tunnel script, and with the help of Opiran, who helped me a lot, we managed to create a well-rounded UDP2Raw tunnel script for this purpose.

check FEATURES

  • This is a modified version of the original WGDashboard
  • There is a limit function for the volume of traffic based internet. [Based on Total Sent data]
  • There is date and time [ I couldn't find a workable way to make it working with date only just yet, i can seperate them but it is not necessary ].
  • There is a Wireguard tunnel script based on udp2raw [ipv4/ipv6] written specifically for this project. [FRP Script for Wireguard will be added soon]
  • Supports Persian language.
  • There are other features that are also available in the original Wireguard panel.
  • There are better versions of this panel made by experienced programmers for sure, but you should spend money [ Please support them if you want a better and smoother experience].

R (2) 1 :Installation:

  • Before proceeding with the Wireguard panel installation, while it's optional please make sure to install the VPS-Optimizer from the opiran GitHub repository :
apt install curl -y && bash <(curl -s https://raw.githubusercontent.com/opiran-club/VPS-Optimizer/main/optimizer.sh --ipv4)

Exclamation-Mark-PNG-Clipart Note: Ensure that you have opened the necessary ports for Wireguard, SSH, and Iran on your UFW firewall if you intend to create a tunnel and not losing access to your server.

For DIGITALOCEAN R (1) Servers, be sure to remove your private ips otherwise you might have a problem [ there is workaround for this, but it is easier to remove your private ip]

  • Make sure to change Peer Remote Endpoint to your VPS ipv4 address and in case of tunnel, change it to your tunnel ipv4 address.

R (1) Installation Steps: [Tested on: Ubuntu 20]

  • Manually create a Wireguard config file, for example, at the default location: /etc/wireguard/wg0.conf. If you need additional ports, add them to the same directory (e.g., /etc/wireguard/wg1.conf).

  • Run the command:

$ apt update
$ apt install wireguard
  • Generate a private key for your Wireguard configuration: Run the following commands:
wg genkey | sudo tee /etc/wireguard/server_private.key
  • View it with :
cat /etc/wireguard/server_private.key
  • Save the server_private.key to a notepad for future use.

2940667803 Create a sample Wireguard config file:

Replace the placeholders with your desired configurations and save it to /etc/wireguard/wg0.conf. Remember to replace "eth0" and "wg0" with the correct interface names.

  • Command : [This is the default location]
nano /etc/wireguard/wg0.conf
[Interface]
Address = 10.66.66.1/24, fd42:42:42::1/64
PostUp = iptables -I INPUT -p udp --dport 50820 -j ACCEPT
PostUp = iptables -I FORWARD -i eth0 -o wg0 -j ACCEPT
PostUp = iptables -I FORWARD -i wg0 -j ACCEPT
PostUp = iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostUp = ip6tables -I FORWARD -i wg0 -j ACCEPT
PostUp = ip6tables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = iptables -D INPUT -p udp --dport 50820 -j ACCEPT
PostDown = iptables -D FORWARD -i eth0 -o wg0 -j ACCEPT
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT
PostDown = iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
PostDown = ip6tables -D FORWARD -i wg0 -j ACCEPT
PostDown = ip6tables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
ListenPort = 50820
PrivateKey = YOUR_GENERATED_PRIVATE_KEY
SaveConfig = true

R (12) Information

  • You can make different ports, just add another wireguard interface eg : wg1 and so on.
  • When adding config in wireguard panel, based on the IPs above... you will use 10.66.66.2/32, fd42:42:42::2/128 for your first user in allowed IPs section and so on.
  • You can use different IPs if you wish.
  • Wireguard port here is 50820/udp [ Be sure to change it if you need another port]

OIP DOWNLOAD SECTION :

  • Download the necessary files from my GitHub repository to your operating system:

Run the following commands:

green-dot-clipart-3 English version [Manual mode]

$ apt update
$ apt install git
$ apt-get -y install python3-pip
$ apt install gunicorn -y
$ cd Wireguard/WireguardEnglish/src
$ sudo chmod u+x wgd.sh
$ pip install -r requirements.txt
$ sudo ./wgd.sh install
$ sudo chmod -R 755 /etc/wireguard
$ ./wgd.sh start or ./wgd.sh restart

R (10) English version [Automatic mode] - Thanks to opiran

apt install wireguard -y && wg genkey | sudo tee /etc/wireguard/server_private.key && apt install python3-pip -y && apt install gunicorn -y && git clone https://github.com/Azumi67/Wireguard.git && cd Wireguard/WireguardEnglish/src/ && chmod u+x wgd.sh && pip install -r requirements.txt && ./wgd.sh install && chmod -R 755 /etc/wireguard && ./wgd.sh restart && cat /etc/wireguard/server_private.key

green-dot-clipart-3 Persian version [Manual mode]

$ apt update
$ apt install git
$ apt-get -y install python3-pip
$ apt install gunicorn -y
$ cd Wireguard/WireguardPersian/src
$ sudo chmod u+x wgd.sh
$ pip install -r requirements.txt
$ sudo ./wgd.sh install
$ sudo chmod -R 755 /etc/wireguard
$ ./wgd.sh start or ./wgd.sh restart

R (10) Persian version [Automatic mode]

apt install wireguard -y && wg genkey | sudo tee /etc/wireguard/server_private.key && apt install python3-pip -y && apt install gunicorn -y && git clone https://github.com/Azumi67/Wireguard.git && cd Wireguard/WireguardPersian/src/ && chmod u+x wgd.sh && pip install -r requirements.txt && ./wgd.sh install && chmod -R 755 /etc/wireguard && ./wgd.sh restart && cat /etc/wireguard/server_private.key
  • Accessing the Wireguard panel:

  • Open your web browser and enter the following link, replacing yourserverip with the actual IP of your server: [ yourserverip:8080 ]

  • Default Username/Password : admin


OIP2 (1) Dashboard Server Configuration:

3022470Create a system service file for the Wireguard dashboard:

Run the command:

$ nano /etc/systemd/system/wg-dashboard.service

Paste the following content into the file:

green-dot-clipart-3 For English version :

  [Unit]
After=network.service

[Service]
WorkingDirectory=/root/Wireguard/WireguardEnglish/src
ExecStart=/usr/bin/python3 /root/Wireguard/WireguardEnglish/src/dashboard.py
Restart=always

[Install]
WantedBy=default.target

green-dot-clipart-3 For Persian version :

[Unit]
After=network.service

[Service]
WorkingDirectory=/root/Wireguard/WireguardPersian/src
ExecStart=/usr/bin/python3 /root/Wireguard/WireguardPersian/src/dashboard.py
Restart=always

[Install]
WantedBy=default.target
  • Enable and start the Wireguard dashboard service:

Run the following commands:

$ sudo chmod 664 /etc/systemd/system/wg-dashboard.service
$ sudo systemctl daemon-reload
$ sudo systemctl enable wg-dashboard.service
$ sudo systemctl start wg-dashboard.service
$ sudo systemctl status wg-dashboard.service

R (3) Script for Tunnel

  • To establish a tunnel for your Wireguard server, follow the steps below:
 bash <(curl -Ls https://raw.githubusercontent.com/opiran-club/wgtunnel/main/udp2raw.sh --ipv4)

Exclamation-Mark-PNG-Clipart There are different methods to establish a tunnel and additional methods for establishing a tunnel will be added to the script when time permits. [ only for Wireguard ]

  • Thanks to opiran admin for helping and giving me a hand in creating the script.

R (5) SEPCIAL THANKS & LINKS :

  • Thanks to OPIRAN for helping me in creating the script and answering my questions. I've put his github link down below:

circle-clipart-chain-link-9OPIRAN Github link

R (6)Original Author

R (9)UDP2RAW Author

  • Thanks to Joshua for answering my questions and helping me in my endeavour and some codes.
  • Thanks to OPIRAN telegram channel.

youtube-131994968075841675 Video Guide for the Tunnel Script

Alt Text


R (7) Telegram Channel

R (6)OPIRAN


OIP Known Bugs and workarounds

  • If you had problems deleting peers, try turning Wireguard off and back on one more time and then delete it. If that didn't work, you can manually delete the private key and click the Save button. Now try to delete it.
  • If you are having problems with the dashboard panel, try using this command in the right directoy. for example for Persian version :
    $ cd Wireguard/WireguardPersian/src/
    $ ./wgd.sh restart
    
  • I think there is a problem with the bulk feature, but i think it can be fixed.
  • Make sure you only install Wireguard using the above commands, as this may cause the connection to stop sending packets. The IPs you have chosen could also be the cause of the problem.

پنل وایرگارد

dash مقدمه :

این پروژه در مورد یک پنل وایرگارد که نسخه اصلی ان به نام WGDashboard میباشد . این پروژه صرفا برای اموزش بوده و چون اطلاعات من در پایتون بالا نیست، دوستانم در این مسیر به من یاری رساندند و بعضی از کدها توسط دوستانم تهیه شده و توسط بنده تغییر و بهینه شده است (از chatgpt هم کمک گرفته شده است)، همچنین تغییراتی در html - javascript -css داده شده است. در آینده در صورت ایده های جدید و در حد توانم به این پنل اضافه خواهم کرد.


check امکانات

  • حجم [بر اساس Total Data sent ]
  • تاریخ و زمان ( تلاش کردم که این دو Input از هم جدا باشند اما در حال حاضر موفق به پیاده سازی آن نشده ام)
  • تمام امکاناتی که نسخه اصلی دارد
  • پشتیبانی از زبان فارسی
  • اسکریپتی که بر پایه udp2raw ipv4/ipv6 میباشد و شما میتوانید به راحتی با آن ، تانل را برقرار کنید و در آینده مدل های دیگر تانل را درصورت امکان به این اسکریپت اضافه خواهم کرد. با سپاس از opiran
  • در صورت تمایل به داشتن پنل بهتر، حتما از برنامه نویسانی که به صورت حرفه ای اینکار را انجام میدهند و پنل بهتری را درست میکنند، حمایت کنید.

R (2) روش نصب گام به گام

  • در گام نخست VPS optimizer گیت هاب اپیران را نصب کنید :
apt install curl -y && bash <(curl -s https://raw.githubusercontent.com/opiran-club/VPS-Optimizer/main/optimizer.sh --ipv4)
  • سپس وایرگارد را نصب کنید.
$ apt update
$ apt install wireguard
  • پرایوت کی بسازید و در یک جا یادداشتش کنید . با دستور زیر میتوانید بسازید
wg genkey | sudo tee /etc/wireguard/server_private.key
  • و با دستور زیر میتوانید کلیدی که ساختید را مشاهده کنید
cat /etc/wireguard/server_private.key

2940667803 نمونه کانفیگ وایرگارد

Exclamation-Mark-PNG-Clipart پورت، wg0 و eth0 در صورت لزوم تغییر دهید

  • با دستور زیر وارد مسیر کانفیگ وایرگارد بشوید. [مسیر پیش فرض است]
nano /etc/wireguard/wg0.conf
  • متن زیر را در آن کپی کنید.
[Interface]
Address = 10.66.66.1/24, fd42:42:42::1/64
PostUp = iptables -I INPUT -p udp --dport 50820 -j ACCEPT
PostUp = iptables -I FORWARD -i eth0 -o wg0 -j ACCEPT
PostUp = iptables -I FORWARD -i wg0 -j ACCEPT
PostUp = iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostUp = ip6tables -I FORWARD -i wg0 -j ACCEPT
PostUp = ip6tables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = iptables -D INPUT -p udp --dport 50820 -j ACCEPT
PostDown = iptables -D FORWARD -i eth0 -o wg0 -j ACCEPT
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT
PostDown = iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
PostDown = ip6tables -D FORWARD -i wg0 -j ACCEPT
PostDown = ip6tables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
ListenPort = 50820
PrivateKey = YOUR_GENERATED_PRIVATE_KEY
SaveConfig = true
  • میتوانید از ایپی های دیگرنیز استفاده کنید.
  • پورت وایرگارد در اینجا 50820 است و میتوانید پورت دیگری را انتخاب کنید.

توجهExclamation-Mark-PNG-Clipart

  • برای ساختن اینترفیس های بیشتر و با پورت های مختلف با روش ذکر شده در بالا انجام بدهید و فقط نام، پورت و ایپی را عوض کنید.
  • دقت کنید برای سرور های دیجیتال اوشن R (1) قبل از نصب، ایپی پرایوت خود را حذف کنید [ راه دیگر هم هست اما این روش نیز شدنی است]
  • به صورت پیش فرض Peer Remote Endpoint بر روی یک عدد بی ربط است. از داخل تنظیمات این مقدار را به ایپی 4 خارج یا سرور ایران در صورت تانل تغییر بدهید.
    • در پنل وایرگارد در قسمت Allowed IPs بر اساس ایپی هایی که در بالا ذکر شد ، میتوانید به طور مثال برای کاربر 1 از 10.66.66.2/32, fd42:42:42::2/128 و کاربر دوم از 10.66.66.3/32, fd42:42:42::3/128 استفاده نمایید.

OIP دانلود

  • پس از اینکه فایل را از گیت هاب در سیستم عامل خودتون دانلود کردید با دستورات زیر پیش نیازها را نصب کنید و پنل را اجرا کنید
  • به صورت Manual R (10)
$ apt update
$ apt install git
$ apt-get -y install python3-pip
$ apt install gunicorn -y
$ cd Wireguard/WireguardPersian/src
$ sudo chmod u+x wgd.sh
$ pip install -r requirements.txt
$ sudo ./wgd.sh install
$ sudo chmod -R 755 /etc/wireguard
$ ./wgd.sh start or ./wgd.sh restart
  • به صورت خودکار green-dot-clipart-3 - با تشکر از ایپران
apt install wireguard -y && wg genkey | sudo tee /etc/wireguard/server_private.key && apt install python3-pip -y && apt install gunicorn -y && git clone https://github.com/Azumi67/Wireguard.git && cd Wireguard/WireguardPersian/src/ && chmod u+x wgd.sh && pip install -r requirements.txt && ./wgd.sh install && chmod -R 755 /etc/wireguard && ./wgd.sh restart && cat /etc/wireguard/server_private.key

-به پنل خودتون با ادرس [serverip:8080] وارد شوید. نام کاربری و رمز عبور پنل به صورت پیش فرض admin میباشد.


OIP2 (1) کانفیگ داشبورد

  • با دستور زیر یک سرویس درست میکنید
$ nano /etc/systemd/system/wg-dashboard.service

و محتویات پایین را داخل این سرویس کپی می نمایید.

[Unit]
After=network.service

[Service]
WorkingDirectory=/root/Wireguard/WireguardPersian/src
ExecStart=/usr/bin/python3 /root/Wireguard/WireguardPersian/src/dashboard.py
Restart=always

[Install]
WantedBy=default.target
  • با دستورات زیر سرویس را فعال و اجرا می نمایید.
$ sudo chmod 664 /etc/systemd/system/wg-dashboard.service
$ sudo systemctl daemon-reload
$ sudo systemctl enable wg-dashboard.service
$ sudo systemctl start wg-dashboard.service
$ sudo systemctl status wg-dashboard.service

R (3) اسکریپت تانل

  • با این اسکریپت به راحتی تانل وایرگارد را برقرار کنید. این تانل udp2raw ipv4/ipv6 میباشد و بعدا در صورت امکان مدل های دیگه هم در اسکریپت های جداگانه اضافه خواهد شد
bash <(curl -Ls https://raw.githubusercontent.com/opiran-club/wgtunnel/main/udp2raw.sh --ipv4)

R (5) قدردانی و لینک ها

  • از ادمین اپیران به خاط همکاری در اسکریپت و پاسخ دادن به سوالاتم سپاسگزارم.

circle-clipart-chain-link-9 گیت هاب اپیرن

R (6) نسخه اصلی پنل

R (9) تانل UDP2RAW

  • از joshua دوست خوبم به خاطر پاسخ به سوالاتم و کمک کردن در بعضی کدها سپاسگزارم.
  • از گروه تلگرام opiranclub همچنین سپاسگزارم.

youtube-131994968075841675 یوتیوب

آموزش اسکریپت :

Alt Text


R (7) تلگرام

R (6) کانال تلگرام اپیران


OIP باگ ها و رفع اشکال

  • اگر نتوانستید کانفیگ ها یا Peers را پاک کنید ، وایرگارد را روشن و خاموش کنید و دوباره تلاش نمایید.در صورت عدم موفقیت ، پرایوت کی هر Peer را پاک و آن را ذخیره و سپس حذف کنید.
  • گاهی تانل ، موفق به فرستادن پکت ها نشود که در این صورت به روش ذکر شده در بالا، وایرگارد را نصب کرده تا دچار این مشکل نشوید که ممکن است گاهی اوقات به دلیل انتخاب نادرست ایپی میباشد.
  • در صورتی که پنل لود نشد، با دستور زیر پنل را دوباره بارگذاری کنید.
 $ cd Wireguard/WireguardPersian/src/
 $ ./wgd.sh restart

About

Wireguard Panel [ Educational - Borrowed & modified codes - Public ]


Languages

Language:Python 32.1%Language:HTML 31.4%Language:JavaScript 28.4%Language:CSS 4.7%Language:Shell 3.3%