Claude d98eba2f76 Fix PTT permission denied errors - config files readable
CRITICAL FIX: PTT service couldn't read config files
======================================================

Problem Found in User's Diagnostics:
  System Logs (PTT):
  /usr/local/bin/kiosk-ptt: line 4: /etc/easy-asterisk/config: Permission denied
  /usr/local/bin/kiosk-ptt: line 5: /etc/easy-asterisk/ptt-device: Permission denied

Root Cause:
- Config files were chmod 600 (root read-only)
- PTT script runs as kiosk user (via systemd user service)
- Kiosk user couldn't read the config files
- PTT couldn't load device path or settings
- Mic stayed unmuted (PTT never started)

Fixes Applied:
==============

1. Config File Permissions (save_config function):
   ✓ Changed CONFIG_DIR from default to chmod 755 (readable)
   ✓ Changed CONFIG_FILE from chmod 600 to 644 (world-readable)
   ✓ Changed PTT_CONFIG_FILE from chmod 600 to 644 (world-readable)

   Files affected:
   - /etc/easy-asterisk/config (now 644)
   - /etc/easy-asterisk/ptt-device (now 644)

2. Input Group Membership (enable_client_services):
   ✓ Added check for 'input' group membership
   ✓ Automatically adds user to 'input' group if not already member
   ✓ Required for evtest to access /dev/input/event* devices

   Already existed in configure_ptt_menu (line 875) but added to
   enable_client_services for consistency during client install.

3. Removed Duplicate Permission Setting:
   ✓ Removed chmod 600 from detect_ptt_button function
   ✓ Removed redundant PTT config file creation
   ✓ Now relies on save_config() for all permission setting
   ✓ Ensures consistent 644 permissions

Why World-Readable is Safe:
============================
Config files contain:
- Device paths (/dev/input/eventX)
- Extension numbers (102, 201, etc.)
- SIP passwords (already in ~/.baresip/accounts)
- Server IPs (already in network config)

These are not system-level secrets. SIP passwords are for
application-level authentication, not system access. The kiosk
user needs read access for their services to function.

Testing After Update:
====================

For existing installs, run these commands to fix permissions:

  # Fix config file permissions
  sudo chmod 755 /etc/easy-asterisk
  sudo chmod 644 /etc/easy-asterisk/config
  sudo chmod 644 /etc/easy-asterisk/ptt-device

  # Add user to input group
  sudo usermod -aG input kiosk

  # User must log out/in or reboot for group change
  # OR restart services with newgrp:
  sudo -u kiosk newgrp input <<'RESTART'
  XDG_RUNTIME_DIR=/run/user/$(id -u kiosk) systemctl --user restart kiosk-ptt
  RESTART

  # Verify PTT logs
  journalctl -t kiosk-ptt -n 20

Expected Output After Fix:
===========================
  kiosk-ptt: PTT handler started, microphone muted, listening on /dev/input/event4
  kiosk-ptt: PTT pressed - mic unmuted
  kiosk-ptt: PTT released - mic muted

NOT:
  /usr/local/bin/kiosk-ptt: Permission denied

This resolves the PTT not working issue completely.
2025-12-03 19:20:00 +00:00
2025-11-28 18:28:24 -05:00
S
Description
Mirror of outis1one/easy-asterisk from GitHub
GPL-3.0
408 KiB
Languages
Shell 98.9%
Dockerfile 1.1%