This project aims to simplify the Airnity developer life.
It is a Command Line Interface to automate several boring and repetitive tasks.
To install airnity cli, go to the Release Page, and download the binary corresponding to your architecture.
You can then rename the binary to its original name: airnity (or airnity.exe on windows), and move it to a place in your $PATH (eg: ~/.local/bin)
# Open Terminal app
# You are now in your $HOME folder
# Check if you have a ".local/bin" folder
ls .local/bin # (Press Enter)
# if you get a "not found" message create the folder hierarchy
mkdir -p .local/bin # (Press Enter)
# Add this new folder to the list of folders known for containing binaries
echo "export PATH=$HOME/.local/bin:$PATH" >> .zshrc # (Press Enter)
# Go in your download folder
cd ~/Downloads # (Press Enter)
# Move and rename binary
mv airnity-darwin-arm64 ~/.local/bin/airnity # (Press Enter)
# Change permissions to make it executable
chmod +x ~/.local/bin/airnity # (Press Enter)
# then use it with `airnity --help`# Go in your download folder
cd ~/Downloads
# Move and rename binary
mv airnity-linux-amd64 ~/.local/bin/airnity # (Press Enter)
# Change permissions
chmod +x ~/.local/bin/airnity # (Press Enter)
# then use it with `airnity --help`# Open Windows PowerShell (Run as Administrator)
# Go in your download folder
cd $env:USERPROFILE\Downloads # (Press Enter)
# Move and rename binary
Copy-Item "airnity-windows-amd64.exe" "$env:WINDIR\System32\airnity.exe" # (Press Enter)
# then use it with `airnity.exe --help`You are good to go!
This binary requires the following tools and components to be installed:
-
Google Cloud SDK (
gcloud)The
gcloudcommand-line tool is essential for interacting with Google Cloud services. -
gke-gcloud-auth-pluginComponentRequired for authenticating with Google Kubernetes Engine (GKE).
gcloud components install gke-gcloud-auth-plugin
The airnity CLI uses the config file ${HOME}/.airnity.yaml, which is created with default values if it doesn't exist.
You can display the current configuration using the config get command:
airnity config getYou can customize the newly created ${HOME}/.airnity.yaml as needed.
The Airnity CLI provides various commands organized by functionality:
airnity versionDisplay version information including git commit and build details.
# Display current configuration
airnity config get
# Set individual configuration values
airnity config set username "john.doe"
airnity config set wazuh.enrollmentPassword "mypassword"
airnity config set k8s.kubeconfigPath "~/.kube/custom-config"The config set command allows you to update individual configuration values. Valid keys include:
username: Your Airnity username (e.g john.doe if your email is john.doe@airnity.com)k8s.kubeconfigPath: Path to your Kubernetes config filewazuh.enrollmentPassword: Password for Wazuh agent enrollment
# List all available Kubernetes clusters
airnity k8s list clusters
# Generate kubeconfig files for all clusters
airnity k8s get kubeconfigs
# Use private endpoints for GKE clusters
airnity k8s get kubeconfigs --private-endpoints# Check and authenticate GCloud credentials
airnity auth login
# Revoke GCloud tokens
airnity auth logout# Login to GCP Docker registries
airnity docker login# Configure and enroll Wazuh agent
airnity wazuh configure
# Display real-time Wazuh agent logs
airnity wazuh print-logs
# Display current Wazuh agent configuration
airnity wazuh print-config
# Display current Wazuh agent version
airnity wazuh version# Upgrade to the latest version
airnity upgrade
# Use custom proxy for updates
airnity upgrade --proxy-url https://my-proxy.example.comairnity gpg generateThe gpg generate command automates the creation of a GPG keypair along with subkeys for signing, encryption, and authentication. This process isolates the keys within a temporary GNUPGHOME directory, ensuring your default keyring remains untouched. The command will:
- Generate a new master key for certification.
- Generate subkeys for signing, encryption, and authentication.
- Export the master key, subkeys, and public key to
.keyfiles - Generate a revocation certificate
- Copy the generated passphrase to your clipboard for secure storage.
Once the key generation process is complete, the following files will be available in the temporary directory displayed by the script (e.g., /tmp/gnupg_202410141642_Fo2GaO):
master.key: This is your master secret key. Do not share this key with anyone.sub.key: This contains your secret subkeys for signing, encryption, and authentication.pub.key: This is your public key. You can share this with anyone who needs to encrypt messages to you or verify your signatures.revoke.asc: This is a revocation certificate that can be used to invalidate your keys if they are ever compromised or lost.
After key generation, securely store your master key and passphrase. Import the keys into your keyring and verify they're working properly.
For cleanup, delete the temporary folder mentioned above (e.g., /tmp/gnupg_202410141642_Fo2GaO).