{"id":26090524,"url":"https://github.com/0xpixelninja/dhcp-rest-api","last_synced_at":"2026-04-18T08:03:17.517Z","repository":{"id":280890392,"uuid":"943505316","full_name":"0xPixelNinja/dhcp-rest-api","owner":"0xPixelNinja","description":"A FastAPI-powered REST API for managing ISC DHCP Server configurations.","archived":false,"fork":false,"pushed_at":"2025-03-05T21:41:47.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-05T21:53:41.794Z","etag":null,"topics":["configuration-management","fastapi","isc-dhcp-server","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/0xPixelNinja.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-05T20:17:37.000Z","updated_at":"2025-03-05T21:41:50.000Z","dependencies_parsed_at":"2025-03-05T21:53:44.949Z","dependency_job_id":"55aee6a1-2d4d-4d43-bd83-095b6bc59dd4","html_url":"https://github.com/0xPixelNinja/dhcp-rest-api","commit_stats":null,"previous_names":["0xpixelninja/dhcp-rest-api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xPixelNinja%2Fdhcp-rest-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xPixelNinja%2Fdhcp-rest-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xPixelNinja%2Fdhcp-rest-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xPixelNinja%2Fdhcp-rest-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0xPixelNinja","download_url":"https://codeload.github.com/0xPixelNinja/dhcp-rest-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242673793,"owners_count":20167294,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["configuration-management","fastapi","isc-dhcp-server","python"],"created_at":"2025-03-09T09:34:28.330Z","updated_at":"2026-04-18T08:03:17.512Z","avatar_url":"https://github.com/0xPixelNinja.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DHCP REST API\n\nA lightweight REST API for managing ISC DHCP Server configuration, specifically designed for Proxmox environments.\n\n## Background\n\nThis project started as a personal solution to a frustrating problem I encountered while setting up virtual machines in my Proxmox homelab. Managing DHCP reservations for VMs was becoming increasingly tedious - I had to SSH into my DHCP server, manually edit configuration files, and restart services every time I wanted to assign a static IP to a new VM.\n\nAfter dealing with this workflow for months, I decided to build a simple REST API that could automate DHCP host management. What began as a weekend project to solve my own problem has evolved into a tool that I hope others will find useful for their Proxmox and virtualization setups.\n\n## Features\n\n- **Host Management**: Add, update, delete, and list DHCP host reservations\n- **Interface Management**: Configure network interfaces for DHCP service\n- **Security**: Token-based authentication with configurable security headers\n- **Rate Limiting**: Protection against abuse with configurable rate limits\n- **Logging**: Comprehensive logging for debugging and monitoring\n- **Lightweight**: Single binary deployment with minimal dependencies\n\n## Why This Project?\n\nSetting up DHCP for Proxmox VMs typically involves:\n1. Manually editing `/etc/dhcp/dhcpd.conf`\n2. Restarting the DHCP service\n3. Hoping you didn't make a syntax error\n4. Repeating this process for every VM\n\nWith this REST API, you can:\n- Programmatically manage DHCP reservations\n- Integrate with VM provisioning workflows\n- Avoid manual file editing and potential syntax errors\n- Automate IP assignment for new VMs\n\n## Installation\n\n### Prerequisites\n\n- Ubuntu/Debian Linux system\n- Root access\n- ISC DHCP Server (`isc-dhcp-server` package)\n\n### Manual Installation\n\n#### Step 1: Install ISC DHCP Server\n\n```bash\nsudo apt update\nsudo apt install isc-dhcp-server\n```\n\n#### Step 2: Create Basic DHCP Configuration\n\nCreate or update `/etc/dhcp/dhcpd.conf`:\n\n```bash\nsudo nano /etc/dhcp/dhcpd.conf\n```\n\nAdd basic configuration:\n\n```\n# Example subnet (adjust for your network)\nsubnet 0.0.0.0 netmask 0.0.0.0 {\n        deny-unknown-clients;\n        authoritative;\n        default-lease-time 21600000;\n        max-lease-time 432000000;\n}\n\n# Host declarations will be managed by the REST API\n```\n\n#### Step 3: Configure Network Interfaces\n\nEdit `/etc/default/isc-dhcp-server`:\n\n```bash\nsudo nano /etc/default/isc-dhcp-server\n```\n\nSet the interface for DHCP service:\n\n```\n# Replace with your network interface\nINTERFACESv4=\"vmbr0\"\nINTERFACESv6=\"\"\n```\n\n#### Step 4: Download and Install the Binary\n\n```bash\n# Download the latest binary\nsudo wget -O /usr/local/bin/dhcp-rest-api https://raw.githubusercontent.com/0xPixelNinja/dhcp-rest-api/refs/heads/main/bin/dhcp-rest-api-linux\n\n# Make it executable\nsudo chmod +x /usr/local/bin/dhcp-rest-api\n```\n\n#### Step 5: Create Configuration Directory and Token\n\n```bash\n# Create configuration directory\nsudo mkdir -p /etc/dhcp-rest-api\n\n# Generate a secure token (or use your own)\necho \"your-secure-token-here\" | sudo tee /etc/dhcp-rest-api/token\n\n# Secure the token file\nsudo chmod 600 /etc/dhcp-rest-api/token\n```\n\n#### Step 6: Create Systemd Service\n\nCreate `/etc/systemd/system/dhcp-rest-api.service`:\n\n```bash\nsudo nano /etc/systemd/system/dhcp-rest-api.service\n```\n\nAdd the following content:\n\n```ini\n[Unit]\nDescription=DHCP REST API Service\nAfter=network.target\n\n[Service]\nType=simple\nUser=root\nExecStart=/usr/local/bin/dhcp-rest-api\nEnvironment=TOKEN_FILE_PATH=/etc/dhcp-rest-api/token\nEnvironment=PORT=8080\nEnvironment=DHCP_CONF_PATH=/etc/dhcp/dhcpd.conf\nEnvironment=INTERFACES_CONF_PATH=/etc/default/isc-dhcp-server\nEnvironment=ENVIRONMENT=production\nRestart=always\nRestartSec=5\nStandardOutput=journal\nStandardError=journal\n\n[Install]\nWantedBy=multi-user.target\n```\n\n#### Step 7: Start the Service\n\n```bash\n# Reload systemd and start the service\nsudo systemctl daemon-reload\nsudo systemctl enable dhcp-rest-api\nsudo systemctl start dhcp-rest-api\n\n# Check service status\nsudo systemctl status dhcp-rest-api\n```\n\n#### Step 8: Test the Installation\n\n```bash\n# Test health endpoint\ncurl http://localhost:8080/health\n\n# Test authenticated endpoint (replace YOUR_TOKEN with your token)\ncurl -H \"Authorization: Bearer YOUR_TOKEN\" http://localhost:8080/hosts/\n```\n\n## Integration with Proxmox\n\nThis API works perfectly with Proxmox VM provisioning workflows. You can:\n\n1. Create a VM in Proxmox\n2. Get the VM's MAC address\n3. Use this API to create a DHCP reservation\n4. Start the VM with a guaranteed IP address\n\n## Troubleshooting\n\n### Service Issues\n\n```bash\n# Check service status\nsudo systemctl status dhcp-rest-api\n\n# View service logs\nsudo journalctl -u dhcp-rest-api -f\n\n# Check DHCP server status\nsudo systemctl status isc-dhcp-server\n```\n\n## Contributing\n\nThis project is open to contributions! Feel free to:\n- Report bugs\n- Suggest features\n- Submit pull requests\n- Improve documentation\n\n## Support\n\nIf you find this project helpful, please consider starring it on GitHub. For issues or questions, please open a GitHub issue.\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xpixelninja%2Fdhcp-rest-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0xpixelninja%2Fdhcp-rest-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xpixelninja%2Fdhcp-rest-api/lists"}