Skip to main content

CLI Installation

This guide provides detailed instructions for installing the Kavach CLI on different operating systems and platforms.

Prerequisites

Before installing the Kavach CLI, ensure you have:

  • GitHub Account - Required for authentication
  • Network Access - To connect to the Kavach backend
  • Administrative Privileges - For system-wide installation (optional)

Installation Methods

Linux (AMD64)

# Download the latest release
curl -L https://github.com/Gkemhcs/kavach-cli/releases/download/v0.1.0-beta.1/kavach-cli_Linux_x86_64.tar.gz -o kavach-cli_Linux_x86_64.tar.gz
tar -xzf kavach-cli_Linux_x86_64.tar.gz

# Make executable
chmod +x kavach

# Move to system PATH (requires sudo)
sudo mv kavach /usr/local/bin/

# Verify installation
kavach --version

Linux (ARM64)

# Download the latest release
curl -L https://github.com/Gkemhcs/kavach-cli/releases/download/v0.1.0-beta.1/kavach-cli_Linux_arm64.tar.gz -o kavach-cli_Linux_arm64.tar.gz
tar -xzf kavach-cli_Linux_arm64.tar.gz

# Make executable
chmod +x kavach

# Move to system PATH (requires sudo)
sudo mv kavach /usr/local/bin/

# Verify installation
kavach --version

macOS (AMD64)

# Download the latest release
curl -L https://github.com/Gkemhcs/kavach-cli/releases/download/v0.1.0-beta.1/kavach-cli_Darwin_x86_64.tar.gz -o kavach-cli_Darwin_x86_64.tar.gz
tar -xzf kavach-cli_Darwin_x86_64.tar.gz

# Make executable
chmod +x kavach

# Move to system PATH (requires sudo)
sudo mv kavach /usr/local/bin/

# Verify installation
kavach --version

macOS (ARM64/Apple Silicon)

# Download the latest release
curl -L https://github.com/Gkemhcs/kavach-cli/releases/download/v0.1.0-beta.1/kavach-cli_Darwin_arm64.tar.gz -o kavach-cli_Darwin_arm64.tar.gz
tar -xzf kavach-cli_Darwin_arm64.tar.gz

# Make executable
chmod +x kavach

# Move to system PATH (requires sudo)
sudo mv kavach /usr/local/bin/

# Verify installation
kavach --version

Windows (AMD64)

Using PowerShell:

# Download the latest release
Invoke-WebRequest -Uri "https://github.com/Gkemhcs/kavach-cli/releases/download/v0.1.0-beta.1/kavach-cli_Windows_x86_64.zip" -OutFile "kavach-cli_Windows_x86_64.zip"

# Extract the zip file
Expand-Archive -Path "kavach-cli_Windows_x86_64.zip" -DestinationPath "."

# Move to system PATH (requires admin privileges)
Move-Item -Path "kavach.exe" -Destination "C:\Windows\System32\"

# Verify installation
kavach.exe --version

Windows (ARM64)

Using PowerShell:

# Download the latest release
Invoke-WebRequest -Uri "https://github.com/Gkemhcs/kavach-cli/releases/download/v0.1.0-beta.1/kavach-cli_Windows_arm64.zip" -OutFile "kavach-cli_Windows_arm64.zip"

# Extract the zip file
Expand-Archive -Path "kavach-cli_Windows_arm64.zip" -DestinationPath "."

# Move to system PATH (requires admin privileges)
Move-Item -Path "kavach.exe" -Destination "C:\Windows\System32\"

# Verify installation
kavach.exe --version

Using Command Prompt:

# Download the latest release
curl -L -o kavach-cli_Windows_x86_64.zip https://github.com/Gkemhcs/kavach-cli/releases/download/v0.1.0-beta.1/kavach-cli_Windows_x86_64.zip

# Extract the zip file
tar -xf kavach-cli_Windows_x86_64.zip

# Move to system PATH (requires admin privileges)
move kavach.exe C:\Windows\System32\

# Verify installation
kavach.exe --version

Method 2: Verify Download Integrity

Before installing, you can verify the integrity of your download using the provided checksums:

Download Checksums File

# Download the checksums file
curl -L -o checksums.txt https://github.com/Gkemhcs/kavach-cli/releases/download/v0.1.0-beta.1/checksums.txt

Verify Downloads

Linux/macOS:

# Verify Linux AMD64
echo "b7798e523d7e323bd8b891110cf0d0edf69e348e22dc0e12911029d6a66ce02d kavach-cli_Linux_x86_64.tar.gz" | sha256sum -c

# Verify Linux ARM64
echo "894489a2beb9bba11977b38eac84c2e3151b990159544d0ed3ea09e9669da36a kavach-cli_Linux_arm64.tar.gz" | sha256sum -c

# Verify macOS AMD64
echo "6a7b5d5d38026caa6160d29e96c98a9c1d198a49e10609f62ba3e6a6f963a60b kavach-cli_Darwin_x86_64.tar.gz" | shasum -a 256 -c

# Verify macOS ARM64
echo "3e75daea233274f7891c585d8844f0667da5ec8a6ffc95cfc1f3ad018d4a5da5 kavach-cli_Darwin_arm64.tar.gz" | shasum -a 256 -c

Windows:

# Verify Windows AMD64
Get-FileHash -Algorithm SHA256 kavach-cli_Windows_x86_64.zip | Where-Object { $_.Hash -eq "5db2aa4577338fda4d0717396929ba6fb2731b2dfb6ae541a341e8bbf9b4f752" }

# Verify Windows ARM64
Get-FileHash -Algorithm SHA256 kavach-cli_Windows_arm64.zip | Where-Object { $_.Hash -eq "06f1d53bf5c1f99430a7b913cec51585badc38291a34bdf4cabd0f4817e87b1d" }
# Download the latest release
curl -L -o kavach.exe https://github.com/Gkemhcs/kavach-cli/releases/download/v0.1.0-alpha.1/kavach-cli_Windows_x86_64.exe

# Move to system PATH (requires admin privileges)
move kavach.exe C:\Windows\System32\

# Verify installation
kavach.exe --version

Method 2: Build from Source

Prerequisites for Building

  • Go 1.21 or later
  • Git

Build Steps

# Clone the repository
git clone https://github.com/Gkemhcs/kavach-cli.git
cd kavach-cli

# Build the binary
go build -o kavach cmd/main.go

# Make executable (Linux/macOS)
chmod +x kavach

# Move to system PATH (requires sudo)
sudo mv kavach /usr/local/bin/

# Verify installation
kavach --version

Configuration

Initial Setup

After installation, the CLI will create its configuration directory on first run:

# Login to create initial configuration
kavach login

This creates the following directory structure:

~/.kavach/
├── credentials.json # Authentication tokens
├── config.yaml # CLI configuration
└── logs/ # Log files

Environment Variables

You can configure the CLI using environment variables:

# Set backend endpoint
export KAVACH_BACKEND_ENDPOINT="https://kavach.gkem.cloud/api/v1/"

# Set authentication endpoints
export KAVACH_DEVICE_CODE_URL="https://kavach.gkem.cloud/api/v1/auth/device/code"
export KAVACH_DEVICE_TOKEN_URL="https://kavach.gkem.cloud/api/v1/auth/device/token"

# Set file paths
export KAVACH_TOKEN_FILE_PATH="~/.kavach/credentials.json"
export KAVACH_LOG_DIR_PATH="~/.kavach/logs/"

Configuration File

The CLI configuration is stored in ~/.kavach/config.yaml:

# CLI Configuration
organization: "my-company"
secretgroup: "backend"
environment: "prod"

# Backend Configuration
backend_endpoint: "https://kavach.gkem.cloud/api/v1/"
device_code_url: "https://kavach.gkem.cloud/api/v1/auth/device/code"
device_token_url: "https://kavach.gkem.cloud/api/v1/auth/device/token"

# File Paths
token_file_path: "~/.kavach/credentials.json"
log_dir_path: "~/.kavach/logs/"

Verification

Check Installation

# Check version
kavach --version

# Check help
kavach --help

# Check configuration
kavach info

Test Authentication

# Login to test authentication
kavach login

# Check status
kavach status

Troubleshooting

Common Issues

1. Permission Denied

# Error: permission denied
# Solution: Make executable
chmod +x kavach

# Or install with sudo
sudo mv kavach /usr/local/bin/

2. Command Not Found

# Error: command not found
# Solution: Check PATH
echo $PATH

# Add to PATH if needed
export PATH=$PATH:/usr/local/bin

3. SSL Certificate Issues

# Error: SSL certificate issues
# Solution: Check system certificates
# For development, you can use HTTP
export KAVACH_BACKEND_ENDPOINT="http://localhost:8080/api/v1/"

4. Network Connectivity

# Error: Network connectivity issues
# Solution: Check network and firewall
curl -I https://kavach.gkem.cloud/healthz

Debug Mode

Enable debug logging for troubleshooting:

# Run with debug logging
kavach --debug login

# Check log files
tail -f ~/.kavach/logs/kavach.log

Uninstallation

Remove Binary

# Remove the binary
sudo rm /usr/local/bin/kavach

# Or if installed in user directory
rm ~/bin/kavach

Remove Configuration

# Remove configuration directory
rm -rf ~/.kavach/

Platform-Specific Notes

Linux

  • Distribution Support: Tested on Ubuntu 20.04+, CentOS 8+, RHEL 8+
  • Dependencies: No additional dependencies required
  • Systemd Integration: Can be installed as a systemd service

macOS

  • Version Support: macOS 10.15+ (Catalina)
  • Architecture: Supports both Intel (AMD64) and Apple Silicon (ARM64)
  • Gatekeeper: May require allowing execution in Security & Privacy settings

Windows

  • Version Support: Windows 10+ (64-bit)
  • PowerShell: Recommended for installation and usage
  • Antivirus: May trigger antivirus software - add to exclusions if needed

Next Steps

After successful installation:

  1. Authentication: Login to Kavach
  2. Quick Start: Get started with your first secrets
  3. Configuration: Configure your environment
  4. Commands: Explore CLI commands

Support

If you encounter issues during installation: