mmtaee / ocserv-users-management

ocserv installation and user web-panel management.
98 stars 45 forks source link

Password problem #8

Closed Kyle5577 closed 1 year ago

Kyle5577 commented 3 years ago

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.

mmtaee commented 3 years ago

Dear Kyle5577 , Hi. command = command = f'/usr/bin/echo -e "{password}\n{password}\n"|sudo /usr/bin/ocpasswd -c /etc/ocserv/ocpasswd {username}' this command is for create ocserv username and password in Python script. you should use it without {}. command in ubuntu terminal . for exmple :
/usr/bin/echo -e "PASSWORD\nPASSWORD\n"|sudo /usr/bin/ocpasswd -c /etc/ocserv/ocpasswd USERNAME it works fine.

Kyle5577 commented 3 years ago

Good afternoon! Why then can your panel save the wrong password hash in the file /usr/bin/ocpasswd? Then you try to connect and write - wrong password? What needs to be changed in your script?

mmtaee commented 3 years ago

Plz send me log of your Ocserv service with this command : systemctl status ocserv.service which OS do you use? I suggest you to use Ubuntu 20.04 .

Kyle5577 commented 3 years ago

A little later today I will send a log. Yes Ubuntu 20.04. The fact is that if you create a user via ssh with the same command and enter the password twice in the console, then a different password hash is saved.

mmtaee commented 3 years ago

I have installed new OS Ubuntu 20.04 in my virtual machine and install Ocserv with 'install.sh' from my Github. I added a user (masoud) from Ocserv installation and another (masoud2) from panel. it works, I will send you logs . I think you should restart Ocserv service . I hope that your problem will be solved.

➜ ~ sudo openconnect 192.168.2.184:10443 -u masoud --servercert pin-sha256:/69yz4vlSa0JHh6peOg4e1MyL+AlgyKxwJyWn5zBgIY= POST https://192.168.2.184:10443/ Connected to 192.168.2.184:10443 SSL negotiation with 192.168.2.184 Server certificate verify failed: signer not found Connected to HTTPS on 192.168.2.184 XML POST enabled Please enter your username. POST https://192.168.2.184:10443/auth Please enter your password. Password: POST https://192.168.2.184:10443/auth Got CONNECT response: HTTP/1.1 200 CONNECTED CSTP connected. DPD 60, Keepalive 300 Connected as 172.16.24.220, using SSL + LZ4, with DTLS + LZ4 in progress Established DTLS connection (using GnuTLS). Ciphersuite (DTLS1.2)-(PSK)-(AES-256-GCM). DTLS connection compression using LZ4.

➜ ~ sudo openconnect 192.168.2.184:10443 -u masoud2 --servercert pin-sha256:/69yz4vlSa0JHh6peOg4e1MyL+AlgyKxwJyWn5zBgIY= POST https://192.168.2.184:10443/ Connected to 192.168.2.184:10443 SSL negotiation with 192.168.2.184 Server certificate verify failed: signer not found Connected to HTTPS on 192.168.2.184 XML POST enabled Please enter your username. POST https://192.168.2.184:10443/auth Please enter your password. Password: POST https://192.168.2.184:10443/auth Got CONNECT response: HTTP/1.1 200 CONNECTED CSTP connected. DPD 60, Keepalive 300 Connected as 172.16.24.214, using SSL + LZ4, with DTLS + LZ4 in progress Established DTLS connection (using GnuTLS). Ciphersuite (DTLS1.2)-(PSK)-(AES-256-GCM). DTLS connection compression using LZ4.

Kyle5577 commented 3 years ago

Only I installed your panel on top of this script: https://github.com//iw4p/OpenConnect-VPN-Server For some reason, it will not connect to your version of the script via AnyConnect from the android (. Therefore, I tried to wind your panel on top of another script. But some kind of problem with passwords (.