Skip to main content

Simple user access management for Linux servers. Like apt install but for people.

Project description

addy ๐Ÿง‘โ€๐Ÿ’ป๐Ÿ”‘ โ€“ Git-driven SSH Access Control

Simple user access management for Linux servers. Like apt install but for people.

Inspired by Yahoo's internal yinst package manager that made server user management effortless.

Python 3.8+ License: MIT Tests

After years of manually copying SSH keys and editing sudoers files across servers, I built addy to treat user access like package management. Want to give Alice access? addy install user/alice. Need to grant sudo? addy install sudo/alice. Your Git repository becomes the single source of truth.

โœจ Why I Built This

  • ๐ŸŽฏ Package-like Simplicity: Why should user management be harder than apt install?
  • ๐Ÿ”’ Git-Powered Audit: Every access change is version controlled and traceable
  • ๐Ÿš€ Zero Infrastructure: No databases, no services - just Git and simple commands
  • ๐Ÿ“ฆ Familiar Workflow: Your team already uses Git - now use it for access too
  • ๐Ÿ”„ Production-Ready: Idempotent by design, tested in real environments
  • ๐Ÿงช Well-Tested: 90%+ test coverage because security tools should be reliable

๐Ÿš€ Quick Start

Installation

# Install from PyPI (recommended)
pip install addy

# Or quick install script
curl -fsSL https://raw.githubusercontent.com/abhinavs/addy/main/install.sh | bash

# Or install from source
git clone https://github.com/abhinavs/addy.git
cd addy
pip install -e .

Setup Your Git Repository

Create a Git repository with your team's SSH keys:

your-addy-users-repo/
โ””โ”€โ”€ users/
    โ”œโ”€โ”€ alice.pub
    โ”œโ”€โ”€ bob.pub
    โ””โ”€โ”€ charlie.pub

Each .pub file contains a user's SSH public key.

Configure Addy

# Set your Git repository (can be private)
sudo addy config set git-repo git@github.com:your-org/your-addy-users-repo.git

# For private repos, set up a deploy key
sudo addy config set ssh-key-path /etc/addy/deploy_key

Grant Access

# Give SSH access
sudo addy install user/alice

# Grant sudo privileges
sudo addy install sudo/alice

# Remove access
sudo addy remove user/alice
sudo addy remove sudo/alice

๐Ÿ”ง How It Works

When you run addy install user/alice:

  1. Syncs the latest Git repository
  2. Finds users/alice.pub in the repo
  3. Creates Linux user alice (if needed)
  4. Installs SSH key to ~alice/.ssh/authorized_keys
  5. Sets proper permissions and ownership

When you run addy install sudo/alice:

  1. Checks that user alice exists
  2. Creates /etc/sudoers.d/alice with passwordless sudo
  3. Validates the sudoers file for safety

๐Ÿ“‹ Features

Core Functionality

  • โœ… User Management: Create users and install SSH keys
  • โœ… Sudo Management: Grant/revoke passwordless sudo access
  • โœ… Git Integration: Pull keys from public or private repositories
  • โœ… SSH Key Validation: Verify key format and security
  • โœ… Idempotent Operations: Safe to run repeatedly

Security Features

  • ๐Ÿ” SSH Key Authentication: No password-based access
  • ๐Ÿ›ก๏ธ Sudoers Validation: Uses visudo to prevent syntax errors
  • ๐Ÿ” Permission Management: Proper file ownership and permissions
  • ๐Ÿ“ Audit Trail: Git history shows who granted access when

Developer Experience

  • ๐Ÿงช Comprehensive Testing: Unit tests with mocking
  • ๐Ÿ“š Clear Documentation: Examples and troubleshooting guides
  • ๐Ÿ”ง Easy Installation: One-command setup
  • ๐Ÿ’ป CLI Interface: Intuitive command structure

๐Ÿ“š Usage Examples

Basic Workflow

# Configure addy
sudo addy config set git-repo git@github.com:company/ssh-keys.git

# Grant SSH access to a new employee
sudo addy install user/john

# Give them sudo rights for deployments
sudo addy install sudo/john

# Remove access when they leave
sudo addy remove sudo/john
sudo addy remove user/john

Advanced Configuration

# Use a specific branch
sudo addy config set git-branch production

# Set up private repository access
sudo addy config set ssh-key-path /etc/addy/readonly_deploy_key

# Manually sync repository
sudo addy sync

# View all configuration
sudo addy config list

Automation & CI/CD

Addy integrates seamlessly with automation:

# In your deployment script
sudo addy install user/deployment-bot
sudo addy install sudo/deployment-bot

# In your offboarding script
sudo addy remove sudo/departing-employee
sudo addy remove user/departing-employee

๐Ÿ—๏ธ Git Repository Structure

Your Git repository should follow this structure:

your-addy-users-repo/
โ”œโ”€โ”€ users/
โ”‚   โ”œโ”€โ”€ alice.pub      # Alice's SSH public key
โ”‚   โ”œโ”€โ”€ bob.pub        # Bob's SSH public key
โ”‚   โ””โ”€โ”€ charlie.pub    # Charlie's SSH public key
โ””โ”€โ”€ README.md          # Optional: document your access policies

Supported Key Types

  • ssh-rsa (RSA keys)
  • ssh-ed25519 (Ed25519 keys)
  • ecdsa-sha2-* (ECDSA keys)

โš™๏ธ Configuration

Setting Description Default
git-repo Git repository URL Required
git-branch Git branch to use main
ssh-key-path SSH private key for Git access None

๐Ÿงช Testing

Addy has a comprehensive test suite:

# Install development dependencies
pip3 install -r requirements-dev.txt

# Run tests
pytest

# Run with coverage
pytest --cov=addy --cov-report=html

# Run specific test categories
pytest -m unit          # Unit tests only
pytest -m integration   # Integration tests only
pytest -m "not slow"    # Skip slow tests

๐Ÿ”’ Security Considerations

  • Private Repositories: Use deploy keys with read-only access
  • SSH Key Management: Rotate keys regularly, remove unused keys
  • Sudo Access: Grant sparingly, audit regularly
  • Git History: Provides complete audit trail of access changes
  • File Permissions: Addy sets secure permissions automatically

๐Ÿ› Troubleshooting

Common Issues

Git clone/pull fails:

# Check your repository URL
sudo addy config get git-repo

# Verify SSH key permissions (if using deploy key)
sudo ls -la /etc/addy/deploy_key

User creation fails:

# Check if user already exists
id username

# Verify sufficient permissions
sudo addy sync

SSH key validation errors:

# Test key format locally
ssh-keygen -l -f /path/to/key.pub

# Check repository structure
git clone your-addy-users-repo && ls -la users/

Debug Mode

# Enable verbose logging
sudo addy --verbose sync
sudo addy --verbose install user/alice

๐Ÿค Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Setup

git clone https://github.com/abhinavs/addy.git
cd addy

# Create and activate virtual environment (recommended)
python3 -m venv venv
source venv/bin/activate

# Install dependencies
pip install -r requirements-dev.txt
pip install -e .

# Run tests
pytest

# Code formatting
black addy/
flake8 addy/

Note: If you encounter "externally managed environment" errors, you must use a virtual environment as shown above. This is required on systems with Homebrew Python or similar package managers.

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™‹โ€โ™‚๏ธ Support

๐Ÿ—บ๏ธ Roadmap

  • Audit Logging: Track all access grants/revocations
  • Web Dashboard: View current access and audit logs
  • Key Expiration: Automatic access revocation
  • SSH Certificates: SSO-style authentication
  • Webhook Integration: Automated access management

Built with โค๏ธ by @abhinavs for system administrators who believe user management shouldn't be painful.

Inspired by the elegance of Yahoo's yinst package manager - because granting server access should be as simple as installing packages.

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

addy-1.0.3.tar.gz (27.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

addy-1.0.3-py3-none-any.whl (17.7 kB view details)

Uploaded Python 3

File details

Details for the file addy-1.0.3.tar.gz.

File metadata

  • Download URL: addy-1.0.3.tar.gz
  • Upload date:
  • Size: 27.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for addy-1.0.3.tar.gz
Algorithm Hash digest
SHA256 d9d30f94ba3edff8e2829670145b19af11176cad69bc71c3fbf814e1196b1838
MD5 6980343f5f06f09990a887f59fe68fd2
BLAKE2b-256 d9a67c77bb1ba1577871d504decf4bf65a00e2d643f4cac1522e72b5e6e12f67

See more details on using hashes here.

File details

Details for the file addy-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: addy-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 17.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for addy-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 74922a96be2ea9193bfa166976a314cda6ac8b44f7b73d8ed7d90ec5aef74a6d
MD5 5063a04c491c0b6347bee026965ad91e
BLAKE2b-256 f8285c3973bc538a49c5945b1caaf0b107f560f325989815ea8dcad60f59997d

See more details on using hashes here.

Supported by

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