Automated SMS reception and forwarding for Netgear LM1200 4G LTE Modem β 2FA/OTP codes directly to Telegram.
- π± Automatic SMS polling (every 5 minutes via systemd timer)
- π¨ Optional Telegram forwarding for 2FA/OTP codes
- πΎ Local JSON storage (monthly rotated files)
- π State management (no duplicates, no lost messages)
- π Hash-based deduplication (robust against ID resets)
- π Python 3.10+ with async/await
- π systemd security hardening
- π Optional SMS Encryption (AES-256 via Fernet)
- π Retry Logic (exponential backoff for transient errors)
- π₯ Health-Check Endpoint (monitoring integration)
IMPORTANT: SMS reception requires specific modem configuration:
- β Network Mode: "Auto" (NOT "LTE Only"!)
- β SMS Alerts: Enabled in modem settings
Without these settings, SMS will NOT be received. See docs/TROUBLESHOOTING.md for details.
- Netgear LM1200 4G LTE Modem with active SIM card
- Linux system with Python 3.10+ and systemd
jqcommand-line JSON processor (for SMS parsing)- (Optional) Telegram Bot Token for SMS forwarding
Install jq:
# Debian/Ubuntu
sudo apt install jq
# RHEL/Fedora
sudo dnf install jq-
Clone repository:
git clone https://github.com/fidpa/netgear-lm1200-sms-gateway cd netgear-lm1200-sms-gateway -
Install dependencies:
python3 -m venv venv source venv/bin/activate pip install -r requirements.txt -
Configure modem (CRITICAL!):
- Open modem web UI: http://192.168.0.201
- Set Network Mode to "Auto" (Network β LTE Settings β Band Selection)
- Enable SMS Alerts (Settings β General β Alerts β "On")
-
Create configuration:
sudo mkdir -p /etc/netgear-sms-gateway sudo cp config/config.example.env /etc/netgear-sms-gateway/config.env sudo nano /etc/netgear-sms-gateway/config.env
-
Install systemd units:
sudo cp systemd/*.{service,timer} /etc/systemd/system/ # IMPORTANT: Edit service file and replace YOUR_USERNAME with your actual username sudo nano /etc/systemd/system/netgear-sms-poller.service # Change: User=YOUR_USERNAME β User=yourname # Change: Group=YOUR_USERNAME β Group=yourname sudo systemctl daemon-reload sudo systemctl enable --now netgear-sms-poller.timer
-
Create symlink (REQUIRED):
sudo ln -sf "$(pwd)/src/netgear_sms_wrapper.sh" /usr/local/bin/netgear-sms-poller -
Test:
# Send test SMS to modem SIM card # Wait 5 minutes or trigger manually: sudo systemctl start netgear-sms-poller.service # Check logs: journalctl -u netgear-sms-poller.service -n 50
- Documentation Index - Overview & quick links
- Setup Guide - Detailed installation & configuration
- API Reference - Complete API documentation
- Troubleshooting - Common issues & solutions
# /etc/netgear-sms-gateway/config.env
NETGEAR_IP=192.168.0.201
NETGEAR_ADMIN_PASSWORD=your_admin_password
SMS_STATE_DIR=/var/lib/netgear-sms-gatewayTELEGRAM_BOT_TOKEN=123456789:ABC...
TELEGRAM_CHAT_ID=12345678
TELEGRAM_PREFIX="[SMS Gateway]"
RATE_LIMIT_SECONDS=300LOG_LEVEL=DEBUG # Shows detailed hash checks, ID comparisonsRequires: pip install cryptography>=42.0.0
SMS_ENCRYPTION_ENABLED=true
SMS_ENCRYPTION_KEY_FILE=/etc/netgear-sms-gateway/.encryption.keyGenerate key: ./src/netgear_sms_poller.py generate-key
See docs/ENCRYPTION.md for full guide.
Note: Gateway works without encryption - install only if you need this feature.
./src/netgear_sms_poller.py health
# Returns: 0 (healthy), 1 (degraded), 2 (down)See docs/MONITORING.md for integration examples.
- Credentials stored in
/etc/netgear-sms-gateway/config.env(chmod 600) - systemd sandboxing: ProtectSystem=strict, PrivateTmp=yes
- SMS content stored in
/var/lib/netgear-sms-gateway/(restricted access)
For vulnerability reporting and security best practices, see SECURITY.md.
- β 2FA/OTP code reception (banking, services)
- β Automated SMS backup/archival
- β SMS-to-Telegram bridge for mobile access
- β Home automation SMS triggers
Contributions welcome! Please see CONTRIBUTING.md for guidelines.
MIT License - see LICENSE file for details.
- svbnet/netgear-sms - SMS API for Netgear LTE modems
- Home Assistant NETGEAR LTE Integration