-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed to using ssh to log os console.
- Created ssh_pw program. - Modified "Stop OS Console Logging" and "Start OS Console Logging" to work with new ssh_pw program. - Created 2 supporting keywords: - "Create OS Console File Path" - "Create OS Console Command String" - Removed "Stop OBMC Console Client" keyword which is no longer needed. - Modified tox.ini to be able to find ssh_pw. Change-Id: Ifd8fc95db16fcbcbbe0a36d7e4d09383e2d1e161 Signed-off-by: David Shaw <dlshaw@us.ibm.com>
- Loading branch information
Showing
3 changed files
with
167 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#!/usr/bin/expect -- | ||
|
||
# ssh using the parms provided by the caller. The benefit provided by this | ||
# program is that it will enter the password for you (i.e. non-interactively). | ||
|
||
# Description of arguments: | ||
# Arg0: The password. | ||
# Arg1: The ssh parm string. This is the totality of ssh parms you wish to | ||
# specify (e.g. userid, host, etc.). | ||
|
||
|
||
############################################################################### | ||
# Main | ||
|
||
# Get arguments. | ||
set password [lindex $argv 0] | ||
set ssh_parms [lreplace $argv 0 0] | ||
|
||
eval spawn ssh ${ssh_parms} | ||
|
||
set timeout 30 | ||
|
||
set max_attempts 3 | ||
|
||
set attempts 0 | ||
while { 1 } { | ||
incr attempts 1 | ||
expect { | ||
-re "assword:" { | ||
send "$password\r" | ||
break | ||
} | ||
-re "Are you sure you want to continue connecting" { | ||
if { $attempts > $max_attempts } { | ||
puts stderr "**ERROR** Exceeded $max_attempts attempts to ssh." | ||
exit 1 | ||
} | ||
send "yes\r" | ||
} | ||
timeout { | ||
puts stderr "**ERROR** Timed out waiting for password prompt." | ||
exit 1 | ||
} | ||
eof { | ||
puts stderr "**ERROR** End of data waiting for password prompt." | ||
exit 1 | ||
} | ||
} | ||
} | ||
|
||
set timeout 3 | ||
expect { | ||
"Permission denied, please try again." { | ||
puts "" | ||
puts "**ERROR** Incorrect userid or password provided to this program." | ||
exit 1 | ||
} | ||
} | ||
|
||
set timeout -1 | ||
|
||
# We don't ever expect to see this string. This will keep this program | ||
# running indefinitely. | ||
expect { | ||
"When in the course of human events, it becomes :" {send "whatever\r"} | ||
} | ||
|
||
exit 0 | ||
|
||
############################################################################### | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters