{"id":13615346,"url":"https://github.com/z4yx/GoAuthing","last_synced_at":"2025-04-13T21:30:44.124Z","repository":{"id":41381383,"uuid":"136343536","full_name":"z4yx/GoAuthing","owner":"z4yx","description":"Authentication utility for srun4000 (auth.tsinghua.edu.cn / net.tsinghua.edu.cn / Tsinghua-IPv4)","archived":false,"fork":false,"pushed_at":"2025-02-14T04:30:23.000Z","size":6058,"stargazers_count":257,"open_issues_count":4,"forks_count":27,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-12T11:58:50.347Z","etag":null,"topics":["golang","srun","srun4k","tsinghua-university","tunet"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/z4yx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-06-06T14:49:58.000Z","updated_at":"2025-04-07T11:23:16.000Z","dependencies_parsed_at":"2023-11-26T03:27:10.404Z","dependency_job_id":"b589c7de-d04e-402a-8710-4fa2e0a24c22","html_url":"https://github.com/z4yx/GoAuthing","commit_stats":null,"previous_names":[],"tags_count":42,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/z4yx%2FGoAuthing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/z4yx%2FGoAuthing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/z4yx%2FGoAuthing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/z4yx%2FGoAuthing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/z4yx","download_url":"https://codeload.github.com/z4yx/GoAuthing/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248785936,"owners_count":21161377,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["golang","srun","srun4k","tsinghua-university","tunet"],"created_at":"2024-08-01T20:01:12.236Z","updated_at":"2025-04-13T21:30:44.095Z","avatar_url":"https://github.com/z4yx.png","language":"Go","readme":"# GoAuthing\n\n[![Build Status](https://github.com/z4yx/GoAuthing/actions/workflows/go.yml/badge.svg)](https://github.com/z4yx/GoAuthing/actions)\n![GPLv3](https://img.shields.io/badge/license-GPLv3-blue.svg)\n\nA command-line Tunet (auth4/6.tsinghua.edu.cn, Tsinghua-IPv4) authentication tool.\n\n## Download Binary\n\nDownload prebuilt binaries from \u003chttps://github.com/z4yx/GoAuthing/releases\u003e\nOr \u003chttps://mirrors.tuna.tsinghua.edu.cn/github-release/z4yx/GoAuthing/\u003e\n\n## Usage\n\nSimply try `./auth-thu`, then enter your user name and password.\n\n```help\nNAME:\n   auth-thu - Authenticating utility for Tsinghua\n\nUSAGE:\n   auth-thu [options]\n   auth-thu [options] auth [auth_options]\n   auth-thu [options] deauth [auth_options]\n   auth-thu [options] online [online_options]\n\nVERSION:\n   2.3.5\n\nAUTHORS:\n   Yuxiang Zhang \u003cyuxiang.zhang@tuna.tsinghua.edu.cn\u003e\n   Nogeek \u003critou11@gmail.com\u003e\n   ZenithalHourlyRate \u003ci@zenithal.me\u003e\n   Jiajie Chen \u003cc@jia.je\u003e\n   KomeijiOcean \u003coceans2000@126.com\u003e\n   Sharzy L \u003cme@sharzy.in\u003e\n\nCOMMANDS:\n     auth    (default) Auth via auth4/6.tsinghua\n       OPTIONS:\n         --ip value         authenticating for specified IP address\n         --no-check, -n     skip online checking, always send login request\n         --logout, -o       de-auth of the online account (behaves the same as deauth command, for backward-compatibility)\n         --ipv6, -6         authenticating for IPv6 (auth6.tsinghua)\n         --campus-only, -C  auth only, no auto-login (v4 only)\n         --host value       use customized hostname of srun4000\n         --insecure         use http instead of https\n         --keep-online, -k  keep online after login\n         --ac-id value      use specified ac_id\n     deauth  De-auth via auth4/6.tsinghua\n       OPTIONS:\n         --ip value      authenticating for specified IP address\n         --no-check, -n  skip online checking, always send logout request\n         --ipv6, -6      authenticating for IPv6 (auth6.tsinghua)\n         --host value    use customized hostname of srun4000\n         --insecure      use http instead of https\n         --ac-id value   use specified ac_id\n     online  Keep your computer online\n       OPTIONS:\n         --auth, -a  keep the Auth online only\n         --ipv6, -6  keep only ipv6 connection online\n\nGLOBAL OPTIONS:\n   --username name, -u name          your TUNET account name\n   --password password, -p password  your TUNET password\n   --config-file path, -c path       path to your config file, default ~/.auth-thu\n   --hook-success value              command line to be executed in shell after successful login/out\n   --daemonize, -D                   run without reading username/password from standard input; less log\n   --debug                           print debug messages\n   --help, -h                        print the help\n   --version, -v                     print the version\n```\n\nThe program looks for a config file in `$XDG_CONFIG_HOME/auth-thu`, `~/.config/auth-thu`, `~/.auth-thu` in order.\nWrite a config file to store your username \u0026 password or other options in the following format.\n\n```json\n{\n  \"username\": \"your-username\",\n  \"password\": \"your-password\",\n  \"host\": \"\",\n  \"ip\": \"166.xxx.xx.xx\",\n  \"debug\": false,\n  \"useV6\": false,\n  \"noCheck\": false,\n  \"insecure\": false,\n  \"daemonize\": false,\n  \"acId\": \"\",\n  \"campusOnly\": false\n}\n```\n\nUnless you have special need, you can only have `username` and `password` field in your config file. For `host`, the default value defined in code should be sufficient hence there should be no need to fill it. `UseV6` automatically determine the `host` to use. For `ip`, unless you are auth/login the other boxes you have(not the box `auth-thu` is running on), you can leave it blank. For those boxes unable to get correct acid themselves, we can specify the acid for them by using `acId`. Other options are self-explanatory.\n\n## Autostart\n\nIt is suggested that one configures and runs it manually first with `debug` flag turned on, which ensures the correctness of one's config, then start it as system service. For `daemonize` flag, it forces the program to only log errors, hence debugging should be done earlier and manually. `daemonize` is automatically turned on for system service (ref to associated systemd unit files).\n\n### Systemd\n\nTo configure automatic authentication on systemd-based Linux distro, take a look at `docs/systemd` folder. Just modify the path in configuration files, then copy them to `/etc/systemd` folder.\n\nNote that the program should have access to the configuration file.\nFor `system/goauthing.service`, since it is run as `nobody`, `/etc/goauthing.json` can not be read by it, hence you can use the following command to enable access:\n\n```shell\nsetfacl -m u:nobody:r /etc/goauthing.json\n```\n\nOr, to be more secure, you can choose `system/goauthing@.service` or `user/goauthing.service` and store the configuration file in the home directory.\n\n### OpenWRT\n\nFor OpenWRT users, there are two options available: `goauthing` loading the configuration file, and `goauthing@` interacting with the UCI. The init script should go to the `/etc/init.d/` folder. With the latter, use the following procedure to set up:\n\n```shell\ntouch /etc/config/goauthing\nuci set goauthing.config.username='\u003cYOUR-TUNET-ACCOUNT-NAME\u003e'\nuci set goauthing.config.password='\u003cYOUR-TUNET-PASSWORD\u003e'\nuci commit goauthing\n/etc/init.d/goauthing enable\n/etc/init.d/goauthing start\n```\n\n### Docker\n\nFor Docker users, you can run the container with a restart policy. An example docker compose is like this:\n\n```yaml\nservices:\n  goauthing:\n    image: ghcr.io/z4yx/goauthing:latest\n    container_name: goauthing\n    restart: always\n    volumes:\n      - /path/to/your/config:/.auth-thu\n   command: auth -k\n```\n\n## Build\n\nRequires Go 1.11 or above\n\n```shell\nexport GO111MODULE=on\ngo build -o auth-thu github.com/z4yx/GoAuthing/cli\n```\n\n## Acknowledgments\n\nThis project was inspired by the following projects:\n\n- \u003chttps://github.com/jiegec/auth-tsinghua\u003e\n- \u003chttps://github.com/Berrysoft/TsinghuaNet\u003e\n","funding_links":[],"categories":["Go"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fz4yx%2FGoAuthing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fz4yx%2FGoAuthing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fz4yx%2FGoAuthing/lists"}