Using the CLI in cron - cannot create an item into a vault

Someone172
Someone172
Community Member
edited January 2023 in CLI

Hello,

I wrote to the business support but I was offered to tried a closed beta of a new software, how convenient.

So, I'm having a problem with the CLI when used with cron in a bash script, on Debian 11.
I log successfully, I get vault and user details also, but when creating an item in a specific vault, I get... nothing. No error, no output, nothing.

However, using SSH and launching the script manually, everything works fine.

The command used is : op item create --category login --title XXX --vault XXX username=XXX password=XXX --url=XXX --session XXX

I went up to stracing the process, while on cron and directly.
Here is the difference, when calling the OP binary :
ioctl(2, TIOCGWINSZ, 0x7fff6d12f760) = -1 ENOTTY (Ioctl() inapproprié pour un périphérique) <-- while using cron
ioctl(2, TIOCGWINSZ, {ws_row=54, ws_col=102, ws_xpixel=0, ws_ypixel=0}) = 0 <-- while using the same user session but on SSH, with a terminal.

After digging a bit more, I found out that calling TIOCGWINSZ is asking for the window size of the terminal running the command.
However, in cron, there is no terminal present, thus the ENOTTY error.

I do not understand why the 1password CLI should ask for a terminal window size while setting a password, and I do not understand why only this command fails. The error above is the only difference I can see between script lines I can identify in the strace.

Did someone encounter the problem too? How did you resolve it? Is this a bug or a bad implementation in the 1password CLI?

Thank you,


1Password Version: 2.12.0
Extension Version: Not Provided
OS Version: Debian 11.6
Browser:_ CLI

Comments

  • Someone172
    Someone172
    Community Member

    The problem can be bypassed by using a tool like screen or tmux in the crontab, thus emulating a pseudo-tty.
    Definitely not ideal, but "it works".

  • Hi @Someone172:

    Thanks for reaching out about this here. To avoid duplicating our efforts, continuing the conversation via email would be best. One of my colleagues will reply to you soon. Keep an eye out!

    Jack

    ref: 96169

This discussion has been closed.