Last active
February 19, 2024 17:15
-
-
Save ouyen/08c7895dde30bc602d92f1a0d4f35c8c to your computer and use it in GitHub Desktop.
pkuvpn.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo PASSWORD | openconnect --script-tun --script "ocproxy -D 7900 -g -k 15" --protocol=pulse vpn.pku.edu.cn -u 1900014514 --reconnect-timeout 60 --passwd-on-stdin |
Author
ouyen
commented
Jan 5, 2023
1900014514 -- 学号
PASSWORD -- 密码
systemd service
view /etc/systemd/system/pkuvpn.service
[Unit]
Description=Connect to my VPN
After=network.target
[Service]
Type=simple
ExecStart=/bin/sh -c 'echo PASSWORD | openconnect --script-tun --script "ocproxy -D 7900 -g -k 15" --protocol=nc vpn.pku.edu.cn -u 1900014514 --reconnect-timeout 60 --passwd-on-stdin'
Restart=always
[Install]
WantedBy=multi-user.target
sudo su
systemctl daemon-reload
systemctl enable pkuvpn.service
systemctl start pkuvpn.service
Dockerfile:
FROM ubuntu:22.04
RUN apt-get update && \
apt-get install -y \
ocproxy openconnect && \
rm -rf /var/lib/apt/lists/*
CMD ["/bin/bash", "-c", "echo $PASSWORD | openconnect --script-tun --script \"ocproxy -D 7900 -g -k 15\" --protocol=nc vpn.pku.edu.cn -u $PKUID --reconnect-timeout 60 --passwd-on-stdin"]
Hi! Thanks a lot for this gist script.
But in recent days, I have found that it doesn't work. I didn't change anything. Are there something changed?
Got HTTP response: HTTP/1.1 302 Moved
GET https://vpnu.pku.edu.cn/dana-na/auth/url_izFvvX9SGEKBRRI9/welcome.cgi?p=failed
frmLogin
3 consecutive empty forms, aborting loop
Failed to complete authentication
change protocol from nc to pulse, and need to build openconnect form source code : work with v9.12, but failed with 8.20-1 ( ubuntu 22.04 apt)
Does this solution work on MacOS? For me, I haven't ever tried to build tools like openconnect by myself before.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment