A Python-based automation tool using Playwright to automatically log into FreeDNS accounts, helping to keep them active.
FreeDNS (freedns.afraid.org) may deactivate accounts after extended periods of inactivity. This tool automates the login process to ensure your account remains active.
- Ubuntu 22.04 LTS or later
- Python 3.8+
- Internet connection
The setup.sh script installs system dependencies and creates a Python virtual environment. This phase requires sudo permissions only for installing system packages.
chmod +x setup.sh
./setup.shPermissions needed:
sudoaccess forapt-getcommands to install system packages- Write access to current directory for creating the virtual environment
After installation, activate the virtual environment:
source freedns-automation/bin/activateThe script can be run with user-level permissions:
# Using command line arguments
python freedns_login.py -u your_username -p your_password
# Using environment variables
export FREEDNS_USERNAME='your_username'
export FREEDNS_PASSWORD='your_password'
python freedns_login.pyThe automation script runs perfectly fine with regular user permissions. Here's how to set up a cron job:
- Edit your user's crontab:
crontab -e- Add one of these example entries:
# Run weekly on Sundays at 2:17 AM (recommended for most users)
17 2 * * 0 cd /home/your_user/git/freedns-automation && /home/your_user/git/freedns-automation/freedns-automation/bin/python /home/your_user/git/freedns-automation/freedns_login.py
# Run monthly on the 1st at 3:42 AM
42 3 1 * * cd /home/your_user/git/freedns-automation && /home/your_user/git/freedns-automation/freedns-automation/bin/python /home/your_user/git/freedns-automation/freedns_login.py
# Run every 3 months on the 1st at 4:23 AM (Jan, Apr, Jul, Oct)
23 4 1 */3 * cd /home/your_user/git/freedns-automation && /home/your_user/git/freedns-automation/freedns-automation/bin/python /home/your_user/git/freedns-automation/freedns_login.pyFor better security, store credentials in a separate file:
- Create a credentials file (readable only by you):
touch ~/.freedns_creds
chmod 600 ~/.freedns_creds- Add credentials to the file:
echo 'export FREEDNS_USERNAME="your_username"' >> ~/.freedns_creds
echo 'export FREEDNS_PASSWORD="your_password"' >> ~/.freedns_creds- Use this crontab entry:
# Run weekly with credentials from file
17 2 * * 0 source /home/your_user/.freedns_creds && cd /home/your_user/git/freedns-automation && /home/your_user/git/freedns-automation/freedns-automation/bin/python /home/your_user/git/freedns-automation/freedns_login.py| Phase | Required Permissions | Purpose |
|---|---|---|
| Installation | sudo (temporary) | Install system packages via apt-get |
| Configuration | User-level | Create virtual environment, install Python packages |
| Execution | User-level | Run the automation script |
| Cron Setup | User-level | Schedule automated runs |
- Credentials: Never commit credentials to version control
- File Permissions: If storing credentials in files, ensure they're readable only by you (
chmod 600) - Headless Mode: For production/cron use, modify
freedns_login.pyline 10 toheadless=True - Logs: When running via cron, redirect output to a log file for debugging
- Check cron logs:
grep CRON /var/log/syslog-
Ensure full paths are used in crontab (cron has minimal PATH)
-
For debugging, add logging to your crontab:
17 2 * * 0 source /home/your_user/.freedns_creds && cd /home/your_user/git/freedns-automation && /home/your_user/git/freedns-automation/freedns-automation/bin/python /home/your_user/git/freedns-automation/freedns_login.py >> /home/your_user/freedns_automation.log 2>&1When running via cron in headless mode, you might need to set display variables:
17 2 * * 0 export DISPLAY=:0 && source /home/your_user/.freedns_creds && cd /home/your_user/git/freedns-automation && /home/your_user/git/freedns-automation/freedns-automation/bin/python /home/your_user/git/freedns-automation/freedns_login.pyThis project is provided as-is for educational and personal use.