I suspect the following is more of a Linux question, but maybe someone here has had the same issue already.
I have a Python script that syncs "Secrets" (user/pass combos) from an IPAM software called NetBox to 1Pass. To launch the
.py script I am using another bash script that is regularly called by a cronjob. When I launch the bash script from the command line, everything works completely fine. However, when launching the bash script (using the full path) from a cronjob, the script fails to run the
op commands correctly. I'm thinking this is related to the
eval and environment variable in some way.
One thing to note, for testing, in order to automate inputting the Master Password for
signin, I have another script from elsewhere that temporarily decrypts the password, adds a plaintext file in base64 named
op.mp and then deletes it after the sync script has run. You'll see that in the first two lines copied below.
cat /home/testuser/nornir/auth/op.mp | base64 --decode | op signin eval $(cat /home/testuser/nornir/auth/op.mp | base64 --decode | op signin testuser) op delete vault netbox op create vault --allow-admins-to-manage true --description "Synced entries from NetBox" netbox /usr/bin/python3 /home/testuser/nornir/update_1pass.py if [ $? -eq 0 ]; then logger --rfc3164 -P 514 -n 10.10.10.10 "NetBox device secrets have been synced with 1Password" else logger --rfc3164 -P 514 -n 10.10.10.10 "Failed to sync NetBox device secrets with 1Password" fi
Any idea what could be causing this to fail specifically by launching the bash/python script via crontab/cronjob? Is there another recommended way to do this?
1Password Version: 1.4.0
Extension Version: Not Provided
OS Version: 4.19.0-8-amd64 #1 SMP Debian 4.19.98-1+deb10u1 (20
Sync Type: Not Provided