Author: Gregory A. Lussier
I needed a simple script to update DD-WRT's SSHD Authorized Keys on multiple devices. I am releasing this draft version but will be updating the code structure and scalability.
- manager.py: the script itself
- data.json: contains public keys along with information about the user associated to each key
- Connect via SSH and execute
nvram get sshd_authorized_keys
- Get the current authorized keys from the nvram and store them as an array
- Build a suitable string (ssh-rsa public key file) from
data.json
- Write the string to a text file
- Upload the text file to the DD-WRT device
- Remote execute a command on the DD-WRT device to add each public key to its nvram
- Commit the nvram changes