Giter Club home page Giter Club logo

ocserv-users-management's Introduction

ocserv-users-management

Web panel to manage ocserv and openconnect users

Requirements(Ubuntu 20.04 or Docker host)

Features:

1- create an account with a limit of gigabytes or monthly usage

2- users: add, edit, update, remove, block and disconnect

3- group: add, edit, update and remove

4- occtl command tools

5- statistics

6- Calculation of users' rx and tx

Installation :

Choose Your Installation Method:

1- Use install.sh script

>>> chmod +x install.sh

>>> ./install.sh

2- Installing panel without script

>>> chmod +x ./configs/panel.sh

>>> HOST=http://YOUR_DOMAIN_OR_IP ./configs/panel.sh

3- Docker host

>>> touch prod.env

>>>  cat << EOF >> prod.env
ORG=End-way
EXPIRE=3650
CN=End-way-Cisco-VPN
OC_NET=172.16.24.0/24

# change it to your ip or domain
CORS_ALLOWED=http://HOST_IP_OR_DOMAIN,https://HOST_IP_OR_DOMAIN

# change it to your ip or domain
HOST=HOST_IP_OR_DOMAIN
DOMAIN=
PORT=20443
EOF

>>> DOCKER_SCAN_SUGGEST=false docker-compose up -d --build

4- frontend developing

>>> docker compose -f docker-compose.dev.yml up --build

create extra admin user in terminal

*docker mode -- in container

python3 /app/manage.py createadmin -u USERNAME -p PASSWORD 

*systemd

/var/www/site/back-end/venv/bin/python3 /var/www/site/back-end/manage.py createadmin -u USERNAME -p PASSWORD 

Admin panel configuration:

1- Launch your web browser.

2- Navigate to http://YOUR-DOMAIN-OR-IP in the address bar.

3- Configure the administrative settings as needed and proceed with the setup.

Migrate accounts from old panel to new panel:

commands

1- --free-traffic: migrate users with free usage traffic

2- --old-path: Path to the old SQLite database

in os

1- rename /tmp/db.sqlite3 to /tmp/

>>> mv /tmp/db.sqlite3 /tmp/db-old.sqlite3

2- run script to migrate users

>>> /var/www/site/back-end/venv/bin/python3 manage.py migrate_to_new --old-path /tmp/db-old.sqlite3

in docker host:

1- rename db.sqlite3 to db-old.sqlite3

>>> mv db.sqlite3 db-old.sqlite3

2- copy db-old.sqlite3 to volumes/db

>>> cp db-old.sqlite3 volumes/db

3- run command in docker container

>>> python3 /app/manage.py migrate_to_new --old-path /app/db/db-old.sqlite3

developer mode

1- create dev.env file

>>> touch dev.env

2- copy to dev.env

>>> cat << EOF >> dev.env
DEBUG=True
ORG=End-way
EXPIRE=3650
CN=End-way-Cisco-VPN
OC_NET=172.16.24.0/24

# change it to your ip or domain
CORS_ALLOWED=http://127.0.0.1:9000

# change it to your ip or domain
HOST=127.0.0.1
DOMAIN=
PORT=20443
EOF

3- run backend service

>>> docker compose -f docker-compose.dev.yml up -d --build

4- run frontend service

>>> cd front-end
>>> npm install && npm run serve

5- swagger documents api

Navigate to http://127.0.0.1:8000/doc/ in the address bar.

ocserv-users-management's People

Contributors

dependabot[bot] avatar farazyb avatar mmtaee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ocserv-users-management's Issues

lastest version creat user problem

after web creat user the user is in ocpasswd but web find nothing.
i tested it in admin and stuff. It looks the same.refresh the page is not work.

backup

فایل migrate_to_new.py
صحیح:
query = 'SELECT "app_ocservuser"."username","app_ocservuser"."password","app_ocservuser"."active",'
query += '"app_ocservuser"."expire_date","app_ocservuser"."desc" FROM "app_ocservuser"'

The VPN configuration received from the secure gateway is invalid.

با احترام
در ابتدا تشکر میکنم بابت این انتشار
بعد از نصب کامل برنامه و ساخت یوزر تست،بعد از اتصال به سرور از طریق کلاینت anyconnect و انجام احراز هویت با این خطا که در عنوان مطرح شده مواجه میشم.روی بیش از 4 سرور مختلف هم تست کردم.ولی نسخه قدیمی تر همین برنامه شما (حدودا 6 ماه پیش) همچین مشکلی رو نداشت.
نحوه نصب من بدین صورت بود
git clone https://github.com/mmtaee/ocserv-users-management.git
cd /root/ocserv-users-management/
chmod +x install.sh && ./install.sh
و انتخاب گزینه دوم که ocserv+panel هست.
ممنون میشم راهنمایی کنید مشکل از کجا میتونه باشه.

Issue with Google recaptcha v3

Hi,
I've recently installed this script on my pre installed ocserv server. I've enabled google recaptcha and inserted all the required keys, but now I get "Captcha challenge failed" and I can not log into admin area. is there any way to disable the recaptcha so I can regain access?

Thanks in advance

add group

please add group in user creation

مشکل در صفحه اول

با سلام و خسته نباشید.
بعد از نصب، هنگامی که آی پی خودم رو در مرورگر وارد میکنم، فقط بالای صفحه لوگوی سیسکو میاد و مینویسه ocserv panel
هیچ قسمتی دیگه ای نمیاد.
برای نصب از دو روش اول استفاده کردم. یعنی با اسکریپت و بدون اسکریپت.
ممنونم میشم راهنمایی کنید.

Bulk add user , expiration day

سلام
ویژگی اضافه کردن تعداد بالا یوزر رو و بجای ثبت تاریخ انقضا بگیم از زمانی که متصل میشه 30 روز داشته باشه در پنل داشته باشیم

code bug

BUG
WEB 'Create Ocserv Group' AND 'Configuration' page All of the 'routes' write to config file is
routes=192.168.0.0/24 is incorrect,
route =192.168.0.0/24 is correct.need fix.

Question
if i want reinstall ocserv how can i backup all data include WEB and ocserv ?

how can i restore admin password.
How do I add more administrators?

could not be installed

Hello, I am unable to install using install.sh on Ubuntu 20 due to the following error
Chmod: cannot access'/ Configs/ocserv. sh ': No such file or directory
Chmod: cannot access'/ Configs/panel. sh ': No such file or directory
./install. sh: line 142:/ Configs/ocserv. sh: No such file or directory
./install. sh: line 143:/ Configs/panel. sh: No such file or directory

I used the following command

wget https://raw.githubusercontent.com/mmtaee/ocserv-users-management/master/install.sh
chmod +x install.sh
./install.sh

2 "Ocserv & Panel (Local)"

May I ask where I did something wrong? thanks

Backend administrator account and password

What is the account number and password for the web management backend?

PS:
I installed the installation guide. My environment is brand new and there are no errors in the installation process.

explanation

here is do not have any explanation how to install it. if possible can you show it us clearly

can not connect to anyconnect user

Hi
Your application has been successfully installed on ubuntu 18.X.
After installation, I faced the following message:
Nginx Is Started.
Ocserv Is Started.
Ocserv_Uwsgi Is Started.

and ocserv status:
Service : Ocserv
Status : Active (Running)
Since : Thu 2022-11-10 20:50:17 UTC
Uptime : 9min Ago

But unfortunately, port 10443 cannot be connected on mobile (IOS / Android)
How can it be solved?

Regards

ارور گت وی

سلام وقت بخیر مهندس جان

دمتون گرم از بابت به وجود آوردن همچین اسکریپتی

من یک مشکلی داشتم همه چیزم کاملا راحت نصب میشه و حتی یک ارور هم توش نیست

ولی موقع اتصال با پوت 20443 تا Establishing VPN session... آخرین برسی میره

ولی بعد ارور گت وی میده و قطع میکنه اتصالو کل احراز یوزر و همه صحیح میره جلو

توی شل اسکریپت موقع وارد کردن host ip و.. هرجور میزارم چه خالی میزارم چه خودش شناسایی کنه بازم به همین حالت ختم میشه

(((( دیتاسنتر هتزنر هستش روی ابنتو 20.04 چه با تونل چه بدون تونل به همین شکله کلا

ممنون میشم محبت کنی راهنمایی کنی ، دلم نمیاد پنل با این جزئیاتی رو ولکنم 👍💕

استاپ شدن سرویس

سرویس user_stats.service هر از گاهی خود به خود استاپ میشه و دیگه ترافیک یوزرا قابل کنترل نیست
ubuntu 20.04
نصب هم از طریق اسکریپت و ونصب کامل همراه با ocserv و پنل
اروری که میگیرم
Traceback (most recent call last):
File "/var/www/site/back-end/user_stats.py", line 46, in check_stats
ocserv_user = OcservUser.objects.get(username=username)
File "/var/www/site/back-end/venv/lib/python3.8/site-packages/django/db/models/manager.py", line 87, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/var/www/site/back-end/venv/lib/python3.8/site-packages/django/db/models/query.py", line 637, in get
raise self.model.DoesNotExist(
app.models.DoesNotExist: OcservUser matching query does not exist.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/var/www/site/back-end/user_stats.py", line 80, in
check_stats(OcservUser, MonthlyTrafficStat, OcservUserHandler, Logger)
File "/var/www/site/back-end/user_stats.py", line 69, in check_stats
except OcservUser.DoesNotExist():
TypeError: catching classes that do not inherit from BaseException is not allowed

Authentication Failure (pam-auth pam_auth_pass : Authentication failure)

I have successfully installed ocserv on an Ubuntu 20.04 server using the provided install.sh script. However, I encountered an issue when attempting to create a user and log in. The server generates the following error message:

pam-auth pam_auth_pass : Authentication failure

This issue prevents users from authenticating and accessing the VPN server.

Steps to Reproduce:

Install ocserv on an Ubuntu 20.04 server using the install.sh script.
Create a user account using panel.
Attempt to log in with the newly created user account.
Observe the "Authentication failure" error.
Expected Behavior:
I expected to be able to create a user account and log in to the ocserv VPN server without encountering authentication errors.

Additional Information:

Operating System: Ubuntu 20.04
Installation Method: install.sh script provided with ocserv-users-management.
Any relevant logs or error messages should be included here for further diagnosis.
image

Password problem

Dear Masoud Taee! Firstly, thank you very much for your server admin panel!

We have a problem and we just can't figure it out (.
We tried to install your panel, but we were unable to connect through the AnyConnect application Android to the server.
We tried to install it differently, first we installed this script: https://github.com//iw4p/OpenConnect-VPN-Server
And then they installed your panel on top, everything seems to work, but when adding users from your control panel, the application writes an incorrect password (.

In the code, we found a line responsible for adding a password: In this file /var/www/html/ocserv_pannel/app/views.py
This line command = f'/usr/bin/echo -e "{password}\n{password}\n"|sudo /usr/bin/ocpasswd -c /etc/ocserv/ocpasswd {username}'
We tried to change it by analogy with this script: command = f'/usr/bin/echo -e "{password}\n{password}\n"|sudo ocpasswd -c /etc/ocserv/ocpasswd {username}'

But the password is still somehow incorrectly created, and if you add it via ssh, then everything is fine. Could you tell me why the password hash may be written incorrectly to the / etc / ocserv / ocpasswd file when added through your panel?

The panel is great. Thank you very much. But for some reason, passwords are written incorrectly, the password hash is incorrect (. We would be very grateful for your help.

بکاپ و برگرداندن بکاپ به سرور جدید

سلام استاد و خسته نباشید بابت این پنلی که برای Oscerv طراحی کردید
میخاستم بگم چطور میتونیم دیتابیس یا اون فایل db.sqlite3 رو سرور جدید ران کنیم که دقیقا یوزرها همه چی برگرده
با دستوراتی که نوشتید اصن اشنا نبودم
فقط تونستم فایل db.sqlite3 و
ocpasswd
رو یه سرور جدید بعد نصب پنل و کپی کردن این فایل ها و این چهار تا دستور
service nginx restart
service backend restart
service user_stats restart
service ocserv restart
پنل با یوزر ها رو بیارم بالا
اما مشکلی هست هیچ کاری نمیتونم تو پنل انجام بدم
نه میشه یوزری پاک کرد نه ساخت هیچ کاری
ولی یوزر ها متصل میشن اگه تاریخ داشته باشن
مشکل اینه هیچ کاری تو پنل نمیشه کرد
اگه لطف کنید یه کمکی بکنید ممنون میشم

Ubuntu 20.04 for building problems

An error is reported after the process is completed,-e Ocserv_Uwsgi Is Not Running.

-e Nginx Is Started.
-e Ocserv Is Started.
-e Ocserv_Uwsgi Is Not Running.

System Logs & Services

اول مرسی بابت کامیت قبلی
وقتی توی پنل روی ocserv systemd کلیک میشه:
سرویس backend:
Feb 02 22:27:03 PS1705774090 uwsgi[28184]: sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper
Feb 02 22:27:03 PS1705774090 sudo[28184]: pam_unix(sudo:auth): conversation failed
Feb 02 22:27:03 PS1705774090 sudo[28184]: pam_unix(sudo:auth): auth could not identify password for [www-data]
Feb 02 22:27:03 PS1705774090 sudo[28184]: www-data : command not allowed ; TTY=unknown ; PWD=/var/www/site/back-end ; USER=root ; COMMAND=/usr/bin/systemctl status ocserv.service --output=json-pretty
همچنین توی دشبورد نه Online users نه show status چیزی نشون داده نمیشه

How to use the pannel?!

I've installed it. but how can I access the pannel?! where is it? can you add a wiki page please?

search_strings

توی user state
خط search_strings = ["reason: user disconnected", "rx", "tx"]
با search_strings = ["reason: ", "rx", "tx"] جایگزین بشه
چون ممکنه یوزر خودش قطع نکنه کانکشن رو اونوقت توی کانتر نمیافته

lastest version can not creat any group

1.lastest version can not creat any group
2. any creat group or configuration function "ipv4network" write to config format is ipv4-network=192.168.33.0 it is not work well.
the same data format in ocserv.conf is correct "ipv4-network=172.16.24.0/24"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.