Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: How to incorporate Expect in Perl Script? OR Pass the password via perl script?

by atcroft (Abbot)
on Jul 13, 2022 at 03:11 UTC ( [id://11145462]=note: print w/replies, xml ) Need Help??


in reply to How to incorporate Expect in Perl Script? OR Pass the password via perl script?

Just to reinforce what tybalt89 said, there are several Expect-related modules in perl. Among them are:

If I've left out someone's favorite, I apologize--I think I have used each of those in the past on various projects. I should note there are also several modules that play nicely with Expect, such as Net::OpenSSH and its variants.

I would suggest you take Corion's suggestion to heart and consider looking at (passwordless) SSH key access. Under OpenSSH keys can be locked down to allow only from a particular set of hosts and/or to allow execution of only certain commands you specify, both of which may prove useful in increasing the security of the system you are assembling.

Hope that helps.

  • Comment on Re: How to incorporate Expect in Perl Script? OR Pass the password via perl script?

Replies are listed 'Best First'.
Re^2: How to incorporate Expect in Perl Script? OR Pass the password via perl script?
by Fletch (Bishop) on Jul 13, 2022 at 10:48 UTC

    There’s also IPC::Run which will let you drive a subprocess while looking for responses with regexen.

    And seconding being careful locking down what can be run especially something accessible via a web server. Might even consider a harder separation like maybe enqueuing requests that something else (not running as your httpd user) then runs with the elevated access separately (Minion, or dropping in a db, or a file in a directory monitored by something to run things, …).

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11145462]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (1)
As of 2024-04-25 03:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found