cryptopro icon indicating copy to clipboard operation
cryptopro copied to clipboard

Replace expect with yes

Open chenger opened this issue 6 years ago • 1 comments

./lib/root.exp "$file" вызывает вот это: https://github.com/dbfun/cryptopro/blob/master/scripts/lib/root.exp Cейчас делал для кубера это, можно сделать вот так: yes o | /opt/cprocsp/bin/amd64/certmgr -inst -all -store uroot -file /opt/cacer.p7b; yes сам понажимает o, и yes есть в большинстве образов, в отличии от expect Поэтому можно из Dockerfile выпилить установку expect

chenger avatar Jan 31 '20 08:01 chenger

Да, можно. В этом образе не нужен, но вообще если стоит пароль на подписание, expect нужен. Через yes такой случай не обходится:

#!/usr/bin/expect
 
#
# Обход проблемы с интерактивным вводом пароля для подписания
#
 
set timeout 3
 
set thumbprint [lindex $argv 0]
set password [lindex $argv 1]
set src_file [lindex $argv 2]
set dest_file [lindex $argv 3]
 
spawn cryptcp -sign -thumbprint $thumbprint -nochain -der $src_file $dest_file
 
expect "Password:" { send "$password\r" }
 
expect {
  "Password:" { exit 1 }
  "(o) OK, (c) Cancel" {
    send "o\r"
    exp_continue
  }
  eof { exit 0 }
}

dbfun avatar Jan 31 '20 12:01 dbfun