Code Monkey home page Code Monkey logo

Comments (25)

iw4p avatar iw4p commented on June 2, 2024 3

You're welcome.
Iran's infrastructure system now can detect suspicious connections, and they put these types of servers into their blacklist. Therefore, the servers become useless. If it's an Iranian server, be careful how you are going to tunnel it. But if it's a Non-Iranian server you can get it from DigitalOcean or AWS or ... so when it is detected by the Iran government, just terminate and create new one with new IP address.

from openconnect-cisco-anyconnect-vpn-server-onekey-ocserv.

iw4p avatar iw4p commented on June 2, 2024 1

I'm sure the script is working fine on Ubuntu 16 and 18. But I have not tested on 20 or 22.
And If live in Iran, consider that ports, time of testing and trying and also server providers and ISP matter.

from openconnect-cisco-anyconnect-vpn-server-onekey-ocserv.

Saulul avatar Saulul commented on June 2, 2024 1

Maybe changing ports can help. e.x use 22 for ocserv, not ssh.

Thank you for the reply, how can I change the port # for ocserv? Is it possible in the Docker method?

from openconnect-cisco-anyconnect-vpn-server-onekey-ocserv.

Saulul avatar Saulul commented on June 2, 2024 1

Thanks again for the detailed reply @iw4p , I will try what you proposed. Another thing is that since 2 days ago the Iranian Government is heavily blocking any sort of UDP packets with their firewall which has basically made any VPN protocol using UDP impossible. Is there a way to force OpenConnect to only use TCP on 443? I'm guessing they won't be just outright blocking every TCP packet on 443 as that would cripple access to any website using SSL.

from openconnect-cisco-anyconnect-vpn-server-onekey-ocserv.

iw4p avatar iw4p commented on June 2, 2024

Hello,
Try OpenConnect client.

from openconnect-cisco-anyconnect-vpn-server-onekey-ocserv.

sMohammad14 avatar sMohammad14 commented on June 2, 2024

sorry, in previous post client pc app is OpenConnect not AnyConnect...
I tested it on OpenConnect Adroid version, but not work again
you write tested on ubuntu 18 and 16, my server is ubuntu, that is ok?

from openconnect-cisco-anyconnect-vpn-server-onekey-ocserv.

iw4p avatar iw4p commented on June 2, 2024

Are you sure you can ping your server with your current IP?

from openconnect-cisco-anyconnect-vpn-server-onekey-ocserv.

sMohammad14 avatar sMohammad14 commented on June 2, 2024

no I cant!!!
but I connected to in via putty and connection work perfectly...
I open port 25 for ping but not pinging...
even disable UFW, but not work ping command

from openconnect-cisco-anyconnect-vpn-server-onekey-ocserv.

iw4p avatar iw4p commented on June 2, 2024

from openconnect-cisco-anyconnect-vpn-server-onekey-ocserv.

sMohammad14 avatar sMohammad14 commented on June 2, 2024

i reset my modem and my IP was changes. now i can pinging server and its ok
i allow port 443/tcp and 443/udp (your default script port) but OpenConnect not connect again with ssl negotiation problem

UPDATE:
i used below command to see open ports:
lsof -i -P -n | grep LISTEN
and then see:
systemd-r 749 systemd-resolve 14u IPv4 20984 0t0 TCP 127.0.0.53:53 (L ISTEN)
sshd 833 root 3u IPv4 21621 0t0 TCP *:9822 (LISTEN)
sshd 833 root 4u IPv6 21632 0t0 TCP *:9822 (LISTEN)
docker-pr 1423 root 4u IPv4 24627 0t0 TCP *:443 (LISTEN)
docker-pr 1428 root 4u IPv6 24633 0t0 TCP *:443 (LISTEN)

NOTE: I was changed my SSH port number to 9822

from openconnect-cisco-anyconnect-vpn-server-onekey-ocserv.

iw4p avatar iw4p commented on June 2, 2024

Have you ever test the script way? Users often have problem with anyconnect and when they change their client to openconnect their connection work fine.

from openconnect-cisco-anyconnect-vpn-server-onekey-ocserv.

sMohammad14 avatar sMohammad14 commented on June 2, 2024

I test your original script on ubuntu 18.04, and it was worked. (but disconnect after some minutes, I thinks it was for port number 443)

I clone script's git on ubuntu 22 then edit ocserv.conf file to value 1 for client at same filed and set max clients filed value to 1000, then build and run image, but not work for SSL problem.
I delete modified image and clone and build original project, but problem not solved

from openconnect-cisco-anyconnect-vpn-server-onekey-ocserv.

sMohammad14 avatar sMohammad14 commented on June 2, 2024

yes live in Iran
i think it is a server problem because now only I can pinging server and it work perfectly!, and all connection was failed, even now I cant connect via SSH on 9822 port number

Thanks a lot for spending time for me dear compatriot

from openconnect-cisco-anyconnect-vpn-server-onekey-ocserv.

sMohammad14 avatar sMohammad14 commented on June 2, 2024

I see a video from your script in youtube ,he run codes on Ubuntu 22.04 LTS, for me is 20.04 LTS, and you say code works on 18 and 16.
It may be that code not works on 20.04 but work on previous and next version of 22.04?

from openconnect-cisco-anyconnect-vpn-server-onekey-ocserv.

iw4p avatar iw4p commented on June 2, 2024

No, I don't think so. Double check that ipv4.ip_forward is equal to 1, sometimes it wrote 11 by mistake.
Use command sysctl -a|grep net.ipv4.ip_forward to check the IP forwarding status.
If net.ipv4.ip_forward=1, the IP forwarding is enabled.
If net.ipv4.ip_forward=0, use this link to enable it.
And can I have the link of that YouTube video?

from openconnect-cisco-anyconnect-vpn-server-onekey-ocserv.

sMohammad14 avatar sMohammad14 commented on June 2, 2024

I send a message to my VPS provider for solve connection problem (SSH) and waiting for response...
Why not? Click This Link

from openconnect-cisco-anyconnect-vpn-server-onekey-ocserv.

iw4p avatar iw4p commented on June 2, 2024

OK.
Thank you!

from openconnect-cisco-anyconnect-vpn-server-onekey-ocserv.

Saulul avatar Saulul commented on June 2, 2024

Hello @iw4p ,

I am having the same issue (in Iran). I used the Docker method on Ubuntu 20.04, I can ping my server from my client. But when trying to connect to the server with OpenConnect-GUI or AnyConnect it seems to fail on SSL negotiation. see image below:
image

Then out of curiosity I tried something else, I first connected to ExpressVPN and then tried to connect to my OpenConnect server using OpenConnect-GUI and low and behold, the connection is established successfully. So I think there might be something going on with the Iranian ISPs blocking this protocol. I have no idea what they might be doing as it's not my area of expertise.
image

Do you have any ideas of changes to make in the config to avoid this? It's definitely not them blacklisting my server's IP address because I can ping it just fine and I tried multiple droplets on DigitalOcean.

Thanks

from openconnect-cisco-anyconnect-vpn-server-onekey-ocserv.

iw4p avatar iw4p commented on June 2, 2024

Hi @Saulul
Thank you for sharing this great and interesting result. Government uses DPI, they usually don't block IP addresses or doing classic ways. Maybe changing ports can help. e.x use 22 for ocserv, not ssh.

from openconnect-cisco-anyconnect-vpn-server-onekey-ocserv.

iw4p avatar iw4p commented on June 2, 2024

Maybe changing ports can help. e.x use 22 for ocserv, not ssh.

Thank you for the reply, how can I change the port # for ocserv? Is it possible in the Docker method?

Of course, you can change the port (from these lines) and then docker build and docker run
it manually. But the fact is a closed source application like AnyConnect is just worked on 443, because it is defined on the app, so it has no idea that you are going to connect to it with other port number.
I suggest you to clone the project, modify your parameters you think they are important and then try to docker build the Dockerfile and then run it (Don't run it like what I said on README because it gets the Dockerfile from the internet, so when you locally change ocserv.conf, you have to manually build your docker file on your local too)
build command (must be in the same directory as Dockerfile): sudo docker build -t ocserv .
Run command (Be careful to change 443 ports): docker run --name ocserv --privileged -p 443:443 -p 443:443/udp -d ocserv
123:456
123 is your docker port and ocserv.conf port
456 is your exposed port, outside of docker and out of your server

from openconnect-cisco-anyconnect-vpn-server-onekey-ocserv.

iw4p avatar iw4p commented on June 2, 2024

You're welcome @Saulul
I'm not sure you, can comment UDP line.
The better way is using V2Ray (Use CDN like China).

from openconnect-cisco-anyconnect-vpn-server-onekey-ocserv.

ttvd94 avatar ttvd94 commented on June 2, 2024

The better way is using V2Ray (Use CDN like China).

The problem with V2Ray is that there's no way to control number of connected clients since it works as a proxy not a VPN.

from openconnect-cisco-anyconnect-vpn-server-onekey-ocserv.

iw4p avatar iw4p commented on June 2, 2024

The better way is using V2Ray (Use CDN like China).

The problem with V2Ray is that there's no way to control number of connected clients since it works as a proxy not a VPN.

Not a good solution, but you can add alterId and clients update their config through the subscription. Or you can make a watcher for v2ray log file and program a logic to manage users.

from openconnect-cisco-anyconnect-vpn-server-onekey-ocserv.

ttvd94 avatar ttvd94 commented on June 2, 2024

Of course that is a good workaround @iw4p, but I'm not into that much of scripting right now. I'm looking for a plug-and-play solution.

Btw, I'm not sure how alterId's gonna help maintaining clients.

from openconnect-cisco-anyconnect-vpn-server-onekey-ocserv.

iw4p avatar iw4p commented on June 2, 2024

When you change alterId, all of your clients need to have the new alterId, otherwise they can not connect to your server anymore. With subscription method you can force users to keep their confing file update. So if a client give its config to someone else, they'll not be able to have the new config when you update alterId via subscription.

from openconnect-cisco-anyconnect-vpn-server-onekey-ocserv.

Related Issues (20)

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.