Public
Authored by Andy Mayhew

Let's Encrypt SSL Renewal Expect Script

This is deprecated by these new instructions.

The below snippet seemed to only work for me and I could never reproduce the errors that others experienced.

Edited
ssl-renewal.ex 1.94 KB
  • When running the script I get: wrong # args: should be "while test command" while executing "while { expect "Password:" { stty -echo expect_user -re "(.*)\n" send "$expect_out(1,string)\n" stty echo expect "Are you OK with..." (file "./ssl-renewal.ex" line 20)

    On line 20 of ssl-renew there is only "while true {" Could you help debug this? Thanks in advance ;)

  • Interesting. I've not seen this error before. Can you confirm the version of expect and OS you are using? My only other thought it that line 19 "Are you OK with your IP being logged?" { send "y\r" } is a continuation of line 18, hence line 18 must end with \ with no trailing characters.

  • Version of Expect is 5.45, OS is Mac OS Sierra 10.12.5. And the line is actually 11, not 20 as stated previously...

  • The only thing I can see, is that on line 11, it should read while true { and in your initial comment the true is missing.

    You wrote:

    When running the script I get: wrong # args: should be "while test command" while executing "while { expect "Password:" { stty -echo expect_user -re "(.*)\n" send

    and the code in that section should be

    while true {
    expect "Password:" {
        stty -echo
        expect_user -re "(.*)\n" 
        send "$expect_out(1,string)\n"
        stty echo
        expect "Are you OK with your IP being logged?" { send "y\n" }
    } \
    "Are you OK with your IP being logged?" { send "y\r" }
    ```
  • Thanks for creating this script!

    Unfortunately I'm getting the same error.

    spawn certbot certonly --config certbot.ini -a manual --debug
    wrong # args: should be "while test command"
        while executing
    "while true {
    expect "Password:" {
        stty -echo
        expect_user -re "(.*)\n"
        send "$expect_out(1,string)\n"
        stty echo
        expect "Are you OK ..."
        (file "ssl-renewal.ex" line 11)
    Edited by Jordy van Dortmont
  • Hey, apologies for basically dropping this. Day job got in the way. In the mean time, I've figured out a better, simpler way to automate certbot without resorting to convoluted expect scripts.

    Updated article and snippet

Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment