Command-line tool to manage and interact with Harica platform
Project description
TCS-GARR Client
Overview
The TCS-GARR Client is a command-line tool for managing and interacting with Harica platform. It offers features like listing, downloading, issuing certificates, approving requests, and generating domain validation tokens, all via the Harica API.
Warning ⚠️
Consortium GARR is not affiliated with HARICA, and the present work has not been endorsed by or agreed with HARICA.
Consortium GARR provides this code to the community for sharing purposes but does not commit to providing support, maintenance, or further development of the code. Use it at your own discretion.
Prerequisites
Before using the TCS-GARR client, please ensure the following:
-
Create a local account on the Harica platform: You must create a local account on Harica at https://cm.harica.gr. Do not use federated IDEM credentials, as they do not support API access.
- If you're already logged in with federated IDEM credentials, you can create a new local account using an email alias. Federated users do not have a password and therefore cannot use the API.
-
Administrator and Approver Permissions: To use the API, your local account must have Administrator and Approver permissions. To obtain these:
- Enable 2FA (Two-Factor Authentication) on your profile page.
- Save the TOTP seed provided after enabling 2FA, as you will need it for future authentication. TOTP seed is like
otpauth://totp/HARICA:...omissis... - After enabling 2FA, request an existing administrator to elevate your account to Administrator and Approver.
Once these steps are completed, you are ready to use the TCS-GARR client.
Installation
You can install the TCS-GARR client in a virtual environment or via pipx.
Virtual Environment
-
Open a terminal or command prompt and navigate to the directory where you want to install the package. Then, run the following command to create a virtual environment:
mkdir <path> python -m venv venv
This will create a folder named
venvin your project directory, containing a self-contained Python environment. -
Activate the virtual environment based on your operating system:
source venv/bin/activate
-
Install the package
pip install tcs-garr
Pipx
-
Open a terminal and install the package
PIPX_BIN_DIR=/usr/local/bin pipx install tcs-garr
Configuration
After installation, the first time you run the client, you will need to initialize the configuration file with your credentials by running:
tcs-garr init
This will create a tcs-garr.conf file in your home directory under .config/tcs-garr path. This file will contain your Harica username, password, TOTP seed, and folder for issued certificates and will have secure permissions.
If configuration file is not found, system will notify you to initialize the configuration using the tcs-garr init command.
Usage
Once the setup is complete, you can use the TCS-GARR client for various operations. The command syntax follows this pattern:
tcs-garr [command] [options]
To view all available commands and options:
tcs-garr --help
usage: tcs-garr [-h] [--debug] {list,request,init,download,approve,whoami,validate,domains,cancel} ...
Harica Certificate Manager
positional arguments:
{list,request,init,download,approve,whoami,validate,domains,cancel}
list Generate a report from Harica
request Request a new certificate
init Generate Harica config file
download Download a certificate by ID
approve Approve a certificate by ID
whoami Get logged in user profile
validate Create validation token for domains
domains List available domains
cancel Cancel a request by ID
options:
-h, --help show this help message and exit
--debug Enable DEBUG logging.
Available Commands
-
Initialize configuration:
tcs-garr initThis command initializes the configuration file with your credentials (email, password, and TOTP seed).
-
Get user profile:
tcs-garr whoamiThis command retrieves the profile of the logged-in user.
-
List all certificates:
tcs-garr list --help usage: tcs-garr list [-h] [--expired-since EXPIRED_SINCE] [--expiring-in EXPIRING_IN] options: -h, --help show this help message and exit --expired-since EXPIRED_SINCE List certificates which expiry date is X days before now. --expiring-in EXPIRING_IN List certificates which expiry date is X days after now.
This command will list all available certificates. You can filter them by date range using the
--expired-sinceand--expiring-inoptions. -
Download a certificate:
tcs-garr download --help usage: tcs-garr download [-h] --id ID [--output-filename OUTPUT_FILENAME] [--force] [--download-type {pemBundle,certificate}] options: -h, --help show this help message and exit --id ID ID of the certificate to download. --output-filename OUTPUT_FILENAME Optional filename to save the certificate inside default output_folder. --force, -f Force overwrite if the output file already exists. --download-type {pemBundle,certificate} Type of download: 'pemBundle' or 'certificate'. Default is 'pemBundle'.
Replace
IDwith the ID of the certificate you wish to download. You can usepemBundleorcertificateas arguments for specific download formats. -
Request a new certificate:
tcs-garr request --help usage: tcs-garr request [-h] (--csr CSR | --cn CN) [--alt_names ALT_NAMES] options: -h, --help show this help message and exit --csr CSR Path to an existing CSR file. --cn CN Common name of the certificate. --alt_names ALT_NAMES Comma-separated alternative names (only used with --cn).
The
requestcommand is used to submit a new certificate request to Harica.You can either provide an existing Certificate Signing Request (
--csr) or specify the details for generating a new CSR, including the Common Name (--cn) and any Subject Alternative Names (--alt_names). If a new CSR is created using the--cnand--alt_namesoptions, a private key will also be automatically generated.After submitting the certificate request, the request must be approved by another Administrator before the certificate can be downloaded. Ensure that an administrator is available to review and approve your request.
-
Approve a certificate:
usage: tcs-garr approve [-h] (--id ID | --list-pending | --all) options: -h, --help show this help message and exit --id ID ID of the certificates (comma separated) to approve. --list-pending List all pending requests. --all Approve all pending requests.
You can list all pending requests using the
--list-pendingoption or approve all pending requests using the--alloption.You can also approve a specific certificate by providing its ID using the
--idoption. -
Cancel a certificate request:
tcs-garr cancel --help usage: tcs-garr cancel [-h] --id ID options: -h, --help show this help message and exit --id ID ID of the request to cancel.
Replace
IDwith the ID of the certificate you wish to cancel. -
Generate validation token for domains:
usage: tcs-garr validate [-h] --domains DOMAINS options: -h, --help show this help message and exit --domains DOMAINS Comma separated list of domains.
This command generates validation tokens for the specified domains. Replace
DOMAINSwith a comma-separated list of domains you need to validate.
License
This project is licensed under the GNU General Public License v3.0. See the LICENSE file for details.
Contributing and Further Development
Contributions, further developments, error reports (and possibly fixes) are welcome.
For more info, please read the CONTRIBUTING file.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tcs_garr-0.9.0.tar.gz.
File metadata
- Download URL: tcs_garr-0.9.0.tar.gz
- Upload date:
- Size: 30.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7d534d8ecab5067e5ad98ac4b5706e88cfe883e93dea4a105dcf2a3f89dc33b
|
|
| MD5 |
1b51f8a2e245f3f8c8fc7d89ed7e0e09
|
|
| BLAKE2b-256 |
c745102e1be3336c9a30776ddcc08ad36e47d52b2a2778681dad07ce2ee66609
|
File details
Details for the file tcs_garr-0.9.0-py3-none-any.whl.
File metadata
- Download URL: tcs_garr-0.9.0-py3-none-any.whl
- Upload date:
- Size: 29.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
370d38d8f66e38cd568520e6fafe306c2a182dbea4f3d334c604ac6bfa580b9b
|
|
| MD5 |
3550d1aea9a71bc6414d4d133ea73f00
|
|
| BLAKE2b-256 |
d07dbb7cdfd6799a065dfd040923d558d41aa0536afd0e77aac3b3d4f455b175
|