Skip to main content

Log in to DGUT campus internet

Project description

dgut-inet-auth

Log in to Dongguan University of Technologies campus internet.

Installation

$ pip install -U dgut-inet-auth

Usage

Create a config file with this structure

your user id
your password

Then run

$ dgut-inet-auth <config file>

Return values:

  • Exit code 0, json output: successfully logged in.
  • Exit code 0, no output: already authenticated, skip.
  • Exit code 1: network is unreachable.

Use with systemd

Create service unit:

# /etc/systemd/system/dgut-inet-auth.service
[Unit]
After=network.target
Description=DGUT campus internet authentication

[Service]
ExecStart=dgut-inet-auth /path/to/dgut-inet-auth.conf
Type=oneshot

Create timer unit:

# /etc/systemd/system/dgut-inet-auth.timer
[Unit]
Description=Auto authentication for DGUT campus internet

[Timer]
OnCalendar=minutely

[Install]
WantedBy = timers.target

Enable systemd timer

# systemctl daemon-reload
# systemctl enable --now dgut-inet-auth.timer

Use with Nix flakes

{
  inputs.dgut-inet-auth.url = "github:chuangzhu/dgut-inet-auth";
  outputs = { self, nixpkgs, dgut-inet-auth }: {
    # Replace your-host-name to your machine
    nixosConfigurations.your-host-name = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      modules = [
        dgut-inet-auth.nixosModules.dgut-inet-auth
        {
          services.dgut-inet-auth.enable = true;
          # Specify your config file here
          services.dgut-inet-auth.configPath = ./dgut-inet-auth-config-file;
        }
      ];
    };
  };
}
  • services.dgut-inet-auth.enable: enable systemd timer for auto authentication.
  • services.dgut-inet-auth.configPath: config file location.
  • services.dgut-inet-auth.checkInterval: systemd.time(7) expression for timer interval.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dgut-inet-auth-0.2.tar.gz (3.2 kB view details)

Uploaded Source

File details

Details for the file dgut-inet-auth-0.2.tar.gz.

File metadata

  • Download URL: dgut-inet-auth-0.2.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.6

File hashes

Hashes for dgut-inet-auth-0.2.tar.gz
Algorithm Hash digest
SHA256 7730a5781ca9cf0f8f90eb387478384a0d8384a1d608c4a97ffcb694b3f3d5bf
MD5 16f42da0dc8daaea18a5518d5df09466
BLAKE2b-256 4776f73eff7c25d736ffa60d7a215f8c2153d9eda6ee7f1dc32b79356a058ac2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page