z4yx / goauthing Goto Github PK
View Code? Open in Web Editor NEWAuthentication utility for srun4000 (auth.tsinghua.edu.cn / net.tsinghua.edu.cn / Tsinghua-IPv4)
License: GNU General Public License v3.0
Authentication utility for srun4000 (auth.tsinghua.edu.cn / net.tsinghua.edu.cn / Tsinghua-IPv4)
License: GNU General Public License v3.0
当 keepOnline
选项开启时,本工具会在 keepAliveLoop
中定期发送 HTTP 请求至 https://www.tsinghua.edu.cn/
/ https://www.baidu.com/
,在正常情况可以持续保持在线状态。
Lines 207 to 267 in e42c2fd
然而,在某些特殊情况下(如:校园网因某种特殊原因被暂停使用,然后被恢复使用,且在外地出差无法手动重新认证),目前的实现似乎未能实现自动重新认证。
--auto-reauth
)该参数与 --keepOnline
同时使用,当用户添加该参数时,可支持断线重连功能,即:当 keepAliveLoop 遇到错误后,重新进行认证操作。另外,可以添加指数退避策略防止过多的认证请求。
keepAliveLoop
添加断线重连功能同上,当原始的 keepAliveLoop 失败时,说明校园网已掉线(可能是欠费或其他特殊原因),则重新认证。选项二的副作用是:改变了 keepAliveLoop
函数的语义(由 仅保持在线状态 变为 保持在线状态且断线重连)
如果作者觉得合适的话,我可以协助实现该功能。
您好,
请问如何解决由于【IP地址异常,请重新拿地址】,导致的登录失败问题?
谢谢!
Josh
Currently we are still using it for "Tsinghua" & "Tsinghua-5G".
设备:小米AC2100路由器
架构:MIPSBE
SOC:MediaTek MT7621 SoC
错误信息:
./auth-thu.linux.mipsbe: line 1: syntax error: unexpected "("
我使用的系统是Arch Linux,安装了aur中auth-thu-bin这一软件包,包里含有systemd的配置文件/usr/lib/systemd/user/[email protected]
,我用这一命令启动服务systemctl --user start goauthing@<用户名>.service
,之后查看运行状态systemctl --user staus goauthing@<用户名>.service
显示如下错误
● goauthing@***.service - Authenticating utility for auth.tsinghua.edu.cn
Loaded: loaded (/usr/lib/systemd/user/[email protected]; disabled; preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Fri 2022-09-02 18:03:17 CST; 1s ago
Process: 1808 ExecStartPre=/usr/bin/auth-thu --debug -D deauth (code=exited, status=216/GROUP)
Process: 1809 ExecStartPre=/usr/bin/auth-thu --debug -D auth (code=exited, status=216/GROUP)
Process: 1810 ExecStartPre=/usr/bin/auth-thu --debug -D login (code=exited, status=216/GROUP)
Process: 1811 ExecStart=/usr/bin/auth-thu --debug -D online (code=exited, status=216/GROUP)
Main PID: 1811 (code=exited, status=216/GROUP)
CPU: 7ms
用journalctl查看日志如下
Sep 02 17:51:05 ****** systemd[623]: Stopped Authenticating utility for auth.tsinghua.edu.cn.
Sep 02 17:51:05 ****** systemd[623]: Starting Authenticating utility for auth.tsinghua.edu.cn...
Sep 02 17:51:05 ****** systemd[3085]: goauthing.service: Failed to determine supplementary groups: Operation not permitted
Sep 02 17:51:05 ****** systemd[3085]: goauthing.service: Failed at step GROUP spawning /usr/bin/auth-thu: Operation not permitted
Sep 02 17:51:05 ****** systemd[3086]: goauthing.service: Failed to determine supplementary groups: Operation not permitted
Sep 02 17:51:05 ****** systemd[3086]: goauthing.service: Failed at step GROUP spawning /usr/bin/auth-thu: Operation not permitted
Sep 02 17:51:05 ****** systemd[3087]: goauthing.service: Failed to determine supplementary groups: Operation not permitted
Sep 02 17:51:05 ****** systemd[3087]: goauthing.service: Failed at step GROUP spawning /usr/bin/auth-thu: Operation not permitted
Sep 02 17:51:05 ****** systemd[623]: Started Authenticating utility for auth.tsinghua.edu.cn.
Sep 02 17:51:05 ****** systemd[3088]: goauthing.service: Failed to determine supplementary groups: Operation not permitted
Sep 02 17:51:05 ****** systemd[3088]: goauthing.service: Failed at step GROUP spawning /usr/bin/auth-thu: Operation not permitted
Sep 02 17:51:05 ****** systemd[623]: goauthing.service: Main process exited, code=exited, status=216/GROUP
Sep 02 17:51:05 ****** systemd[623]: goauthing.service: Failed with result 'exit-code'.
Sep 02 17:51:10 ****** systemd[623]: goauthing.service: Scheduled restart job, restart counter is at 110.
我的.auth-thu文件是没问题的,因为我直接在命令行运行auth-thu
是可以登录的
请问是怎么回事?谢谢
在 OpenWRT 21.02 版本上,文档中提供的 uci set goauthing.config.username='<YOUR-TUNET-ACCOUNT-NAME>'
运行报错,提示 uci: Invalid argument
;尝试手写配置文件后,goauthing@ init.d 脚本中所用的 config_get
函数也无法获取到相应的配置值。
经测试,一种可能正常工作的组合如下:
命令行:
touch /etc/config/goauthing
uci add goauthing goauthing
uci set goauthing.@goauthing[0].username='<YOUR-TUNET-ACCOUNT-NAME>'
uci set goauthing.@goauthing[0].password='<YOUR-TUNET-PASSWORD>'
uci commit
对应的 /etc/config/goauthing 配置文件格式:
config goauthing
option username '<YOUR-TUNET-ACCOUNT-NAME>'
option password '<YOUR-TUNET-PASSWORD>'
在 init.d 脚本中,需要修改获取配置的命令如下:
start_instance() {
local config=$1
local username password
config_get username $config username
config_get password $config password
...
}
logout() {
local config=$1
local username password
config_get username $config username
config_get password $config password
...
}
Device: MacBook Air M2
macOS version: 13.0 (22A380)
I downloaded the prebuilt binary for macOS arm64. Running ./auth-thu.macos.arm64
from terminal leads to the warning in this picture.
Then I tried open it from Finder. Another warning shows up and still I cannot open it.
So I wanna ask how I can run this on my MacBook. Thanks!
前辈们好!
我最近在 OpenWRT (mips) 上用 GoAuthing,由于 boot 仅支持 /etc/init.d
的 init script(参考),所以自己写了一份,用一阵子了。考虑到身边用路由器的朋友不少,是否有可以提交到 GoAuthing/docs 中?可以的话我就 PR 了。
请问为什么我没有认证的时候,用外面的网络 ping 我的地址是可以 ping 通的,但是我 ping 外面的地址是不能 ping 通的呢?
在树莓派上之前还是可以连通的,这两天突然就上不了网了。使用命令 ip addr
发现有地址166.111.132.231
,但是上不去认证界面,求救。
ping: https://auth4.tsinghua.edu.cn: Temporary failure in name resolution
curl -L https://auth4.tsinghua.edu.cn
发生错误Could not resolve host: auth4.tsinghua.edu.cn
auth-thu --debug
显示下面几行错误DEBUG libauth requests.go:223 GET "https://net.tsinghua.edu.cn"
DEBUG auth-thu main.go:282 Failed to get ac_id: GET "http://net.tsinghua.edu.cn": dial tcp: lookup net.tsinghua.edu.cn on [::1]:53: read udp [::1]:33399->[::1]:53: read: connection refused
DEBUG auth-thu main.go:283 Login may fail with 'IP 地址异常'.
DEBUG libauth requests.go:134 GET "https://auth4.tsinghua.edu.cn/srun_portal_pc.php?ac_id="
...(输入用户名和密码)
ERROR auth-thu main.go:340 Login Failed: Get "https://auth4.tsinghua.edu.cn/cgi-bin/get_challenge?callback=C_a_l_l_b_a_c_k&double_stack=1&ip=&username=hongal20": dial tcp: lookup auth4.tsinghua.edu.cn on [::1]:53: read udp [::1]:60574->[::1]:53: read: connectoin refused
远程办公,但经常掉线,然后就连不上了
❯ auth-thu
2022-11-25 03:05:36 ERROR auth-thu main.go:362 Auth error: Login Failed: Get "https://auth4.tsinghua.edu.cn/cgi-bin/get_challenge?callback=C_a_l_l_b_a_c_k&double_stack=1&ip=&username=zhouyh18": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
I tried to use GoAuthing on my OpenWrt system using ./auth-thu -u <MY_USERNAME> -p <MY_PASSWORD> auth --ipv6
and got the following error:
2023-08-25 15:24:14 ERROR auth-thu main.go:362 Auth error: Login Failed: Get "https://auth6.tsinghua.edu.cn/cgi-bin/get_challenge?callback=C_a_l_l_b_a_c_k&double_stack=1&ip=&username=<MY_USERNAME>": dial tcp: lookup auth6.tsinghua.edu.cn on 127.0.0.1:53: no such host
Directly authing ipv4 is OK in my environment. I wonder if there are any suggestions on how to successfully auth6? Thanks!
Set an interval for authing. It could be useful for some servers in the campus without static IP.
Reproduced on v1.6.1, v.1.7, v1.9.2
Both auth -o
and auth -6 -o
suffer from this issue.
Several days ago when developing v1.7, this wasn't happening. It is suspected that usereg changed somehow in the meantime, which broke auth -o
.
Also reported by @NickCao
Thank you so much for maintaining such a brilliant tool.
Currently, the Go-Authing tool does not include the User-Agent header in its HTTP requests, which could result in these requests being filtered by firewalls.
By adding a User-Agent header, this issue can be resolved. I am eager to address this and submit a pull request to implement the solution.
$ go run cli/main.go -c config.json --debug login
2023-08-27 09:58:12 DEBUG auth-thu main.go:55 Read config file "config.json" succeeded
2023-08-27 09:58:12 DEBUG auth-thu main.go:93 Settings Username: "******"
2023-08-27 09:58:12 DEBUG auth-thu main.go:94 Settings Ip: ""
2023-08-27 09:58:12 DEBUG auth-thu main.go:95 Settings Host: ""
2023-08-27 09:58:12 DEBUG auth-thu main.go:96 Settings HookSucc: ""
2023-08-27 09:58:12 DEBUG auth-thu main.go:97 Settings NoCheck: false
2023-08-27 09:58:12 DEBUG auth-thu main.go:98 Settings V6: true
2023-08-27 09:58:12 DEBUG auth-thu main.go:99 Settings KeepOn: false
2023-08-27 09:58:12 DEBUG auth-thu main.go:100 Settings Insecure: false
2023-08-27 09:58:12 DEBUG auth-thu main.go:101 Settings Daemon: true
2023-08-27 09:58:12 DEBUG auth-thu main.go:102 Settings Debug: true
2023-08-27 09:58:12 DEBUG auth-thu main.go:103 Settings AcID: ""
2023-08-27 09:58:12 DEBUG auth-thu main.go:104 Settings Campus: false
2023-08-27 09:58:12 ERROR auth-thu main.go:399 Login error: IP has been online, please logout.
exit status 1
$ go run cli/main.go -c config.json --debug login
2023-08-27 09:56:21 DEBUG auth-thu main.go:55 Read config file "config.json" succeeded
2023-08-27 09:56:21 DEBUG auth-thu main.go:93 Settings Username: "*****"
2023-08-27 09:56:21 DEBUG auth-thu main.go:94 Settings Ip: ""
2023-08-27 09:56:21 DEBUG auth-thu main.go:95 Settings Host: ""
2023-08-27 09:56:21 DEBUG auth-thu main.go:96 Settings HookSucc: ""
2023-08-27 09:56:21 DEBUG auth-thu main.go:97 Settings NoCheck: false
2023-08-27 09:56:21 DEBUG auth-thu main.go:98 Settings V6: true
2023-08-27 09:56:21 DEBUG auth-thu main.go:99 Settings KeepOn: false
2023-08-27 09:56:21 DEBUG auth-thu main.go:100 Settings Insecure: false
2023-08-27 09:56:21 DEBUG auth-thu main.go:101 Settings Daemon: true
2023-08-27 09:56:21 DEBUG auth-thu main.go:102 Settings Debug: true
2023-08-27 09:56:21 DEBUG auth-thu main.go:103 Settings AcID: ""
2023-08-27 09:56:21 DEBUG auth-thu main.go:104 Settings Campus: false
2023-08-27 09:56:23 ERROR auth-thu main.go:399 Login error: Get "http://net.tsinghua.edu.cn/do_login.php?ac_id=1&action=login&password=%7BMD5_HEX%7D********************************&username=******": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
exit status 1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.