Commit graph

80 commits

Author SHA1 Message Date
1a054fd598
make sites optional 2026-02-04 13:05:32 -06:00
c198fdeaa1
add snmp port 2026-02-03 12:51:50 -06:00
f6195cd5c6
sudo redirect fix 2026-02-02 10:54:32 -06:00
1ba55ce451
mikrotik api update 2026-02-02 10:35:44 -06:00
bd6dad85e1
purge more passkey and gettext updates 2026-02-02 10:20:59 -06:00
e46ecbfca2 Replace single name field with first_name and last_name 2026-02-01 15:00:23 -06:00
9ff9c4ddc8
fix: address UserSudoController critical issues
Critical fixes:
- Renamed controller actions to follow Phoenix conventions (verify→new, create→verify)
- Added sudo mode check in GET action using last_sudo_at timestamp
- Added TOTP enrollment check in GET action with redirect
- Changed default return path from /orgs to /users/settings
- Updated route paths from /users/sudo/verify to /users/sudo-verify (dash separator)
- Added success flash message "Identity verified."

Implementation details:
- new/2 (GET): Checks recently_verified_sudo?/1 helper that examines last_sudo_at
  instead of authenticated_at to distinguish sudo verification from regular login
- verify/2 (POST): Adds info flash and defaults to /users/settings
- recently_verified_sudo?/1: Private helper checking last_sudo_at within 10 minutes
- Updated all routes, templates, and tests to use new paths and action names

Tests:
- Added tests for already-in-sudo-mode redirect behavior
- Added test for TOTP enrollment requirement
- Updated all test assertions for new route paths and success messages
- All 15 controller tests passing
- Full test suite passing (4076 tests, 0 failures)
2026-02-01 14:45:05 -06:00
264154a3d8
feat: implement sudo mode MFA-only verification controller
- Add UserSudoController with GET and POST /users/sudo/verify routes
- Create verify.html.heex template for TOTP verification form
- Only accept TOTP codes (6 numeric digits), reject recovery codes
- Update grant_sudo_mode to set authenticated_at virtual field
- Exclude /users/sudo paths from return_to overwriting
- Add comprehensive controller tests (12 test cases)
- Verify redirect behavior, error handling, and session management

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-01 14:34:17 -06:00
7232dab601
live device polling 2026-02-01 13:19:32 -06:00
ad753cf0c6
add headers debug in prod 2026-02-01 10:54:13 -06:00
61a06fc11c
Add firmware version tracking system
- Add firmware context module with upsert, query, and logging functions
- Add FirmwareVersionFetcherWorker to fetch MikroTik RSS daily
- Add Oban cron schedules (2 AM dev, 4 AM prod)
- Add version change detection to Discovery module
- Track firmware history with PubSub broadcasts
- All tests passing

Phase 3-5 of firmware tracking implementation complete.
Next: LiveView UI indicators.
2026-02-01 10:46:27 -06:00
2fab08f5f8
forgot password flow 2026-01-31 17:03:22 -06:00
dff9c26905
fix TOTP enrollment with recovery codes 2026-01-31 14:54:44 -06:00
efc6e7a3ab paginate discovered devices 2026-01-31 10:31:37 -06:00
3c00dcf37c remove passkeys for now 2026-01-31 09:50:35 -06:00
22ae257b60 refactor 2026-01-31 09:35:07 -06:00
6ca22c5dd0 enhance user auditing 2026-01-30 17:38:07 -06:00
25397139c1 nif ci fix complie in ci 2026-01-30 13:01:44 -06:00
2a36917738 mfa enforced on login 2026-01-29 14:31:13 -06:00
09e1d81a9a fix superuser api device limits 2026-01-29 13:01:21 -06:00
c0736d4c2e gdpr consent tracking 2026-01-29 11:12:35 -06:00
8e739283ad refactoring 2026-01-29 10:03:43 -06:00
6ab1333b41 security fixes 2026-01-28 17:02:36 -06:00
1f6151b5a8 filter snmp communities from log 2026-01-28 14:51:47 -06:00
aed15dd6a1 impersonate fixes 2026-01-28 14:41:27 -06:00
a4ea96bebc support prod ip db import 2026-01-28 14:03:35 -06:00
0b27300931 support prod ip db import 2026-01-28 13:48:33 -06:00
234ff7cbd2 add upsert support for geoip imports to prevent duplicates 2026-01-28 13:37:02 -06:00
7ecc986bcd support prod ip db import 2026-01-28 13:20:53 -06:00
d1fd1d4a62 remove Mix.env and support ip database import 2026-01-28 13:08:06 -06:00
220f1edce3 cookie improvements 2026-01-28 12:30:28 -06:00
26041dfe9f add experimental label to alerts 2026-01-28 09:34:21 -06:00
197a515386
marketing page updates 2026-01-27 10:54:20 -06:00
124d68d28d
credo fixes 2026-01-27 09:12:22 -06:00
756a6b4cd4
poller agent fix and trigger device rediscovery 2026-01-26 14:51:32 -06:00
c41b479ed8
more tests 2026-01-26 11:01:47 -06:00
2f24489ecb
add privacy page 2026-01-25 17:12:34 -06:00
a84fc07e42
debug: add detailed logging to health check endpoint
Added logging to identify which component is failing health checks:
- Log database and Redis status on each health check
- Log Redis errors with full error details
- This will help diagnose the production 503 errors
2026-01-24 17:39:56 -06:00
a0ba9285dd
bring in snmpkit 2026-01-23 12:52:17 -06:00
3abd70e133
use password for user regi 2026-01-21 09:13:08 -06:00
c54b5d81bb
more dark mode 2026-01-20 17:23:11 -06:00
d78c42c8f4
test improvements 2026-01-18 17:15:44 -06:00
1f123bbeb9
add honeybadger and snmp overhaul 2026-01-18 16:16:08 -06:00
56093bb493
refactor: use API token auth for profile imports instead of session cookies
Changes profile import endpoint to use standard API token authentication:

API Token Changes:
- Add user_id to api_tokens table (tracks who created the token)
- Update ApiTokens.verify_token/1 to return user along with org_id
- Update ApiAuth plug to assign current_user from token

Profile Import Changes:
- Move endpoint from /api/v1/admin/profiles/import to /api/v1/profiles/import
- Check user.is_superuser in controller instead of using RequireSuperuser plug
- Use api_v1 pipeline (Bearer token auth) instead of browser session
- Update documentation to show API token usage

Security:
- Only API tokens created by superusers can import profiles
- Returns 403 Forbidden if token user is not a superuser
- Logs import attempts with user email for audit trail

This provides a consistent API experience using Bearer tokens
instead of requiring browser session cookies.
2026-01-18 09:30:21 -06:00
e0bcd4feda
feat: add profile export/import workflow via API
Add export and import functionality for device SNMP profiles:

Export (local):
- New mix task: mix export_profiles --librenms-path ~/dev/librenms --output profiles.json
- Exports all profiles to JSON format
- Can filter specific profiles with --profiles flag

Import (production):
- New API endpoint: POST /api/v1/admin/profiles/import
- Requires superuser authentication via browser session
- Processes imports in background via Exq worker (maintenance queue)
- Returns job ID for tracking

New modules:
- Mix.Tasks.ExportProfiles - Export profiles to JSON
- ProfileImportWorker - Background job for importing profiles
- ProfilesController - API endpoint for bulk import
- RequireSuperuser plug - Restricts access to superusers
- Importer.import_profile_from_data/2 - Import from data structures

This enables bulk profile management without SSH access to production.
2026-01-18 09:23:38 -06:00
b1fedcda45
updates 2026-01-17 17:49:53 -06:00
c4760ca0dc
Add API v1 endpoints with organization-scoped API tokens
Created API token system for programmatic access:
- API tokens table with organization scoping
- ApiTokens context for token management
- ApiAuth plug for Bearer token authentication
- Tokens shown once on creation, then hashed for security

Implemented RESTful API v1 endpoints:
- SitesController: CRUD operations for sites
- DevicesController: CRUD operations for devices
- All operations scoped to authenticated organization
- Proper authorization checks via site ownership

Technical details:
- Tokens prefixed with "towerops_" for easy identification
- SHA-256 hashing for token storage
- Last used timestamp tracking (async update)
- Optional token expiration support
- Standard JSON error responses (40x status codes)

Routes:
- /api/v1/sites (GET, POST, PATCH, DELETE)
- /api/v1/devices (GET, POST, PATCH, DELETE)

Authentication:
- Authorization: Bearer towerops_xxxxx header required
- Returns 401 for invalid/expired tokens
- Returns 403 for unauthorized resource access
2026-01-17 16:53:31 -06:00
22f81acfa6
credo cleanup 2026-01-17 15:00:52 -06:00
a810e75fc4
rename equipment to device 2026-01-17 14:48:46 -06:00
eb91798729
agent improvements and agent config 2026-01-16 17:26:51 -06:00