- 论坛徽章:
- 0
|
本帖最后由 林间笑客 于 2017-02-22 15:55 编辑
回复 7# nuclearxin
这是交互手动输入的,
Enter keystore password:
Re-enter new password:
What is your first and last name?
[Unknown]: SSS
What is the name of your organizational unit?
[Unknown]: SSS
What is the name of your organization?
[Unknown]: SSS
What is the name of your City or Locality?
[Unknown]: chengdu
What is the name of your State or Province?
[Unknown]: sichuan
What is the two-letter country code for this unit?
[Unknown]: 86
Is CN=SSS, OU=SSS, O=SSS, L=chengdu, ST=sichuan, C=86 correct?
[no]: y
我的代码
/usr/bin/expect <<-EOF
spawn keytool -genkey -alias server -keyalg RSA -keysize 2048 -keystore server.keystore
expect {
"*keystore*" {send "SSS\r";exp_continue}
"?*new*" {send "SSS\r"}
"?*n]:" {send "SSS\r"}
"?*organizational*" {send "SSS\r"}
"?*organization?*" {send "SSS\r"}
"?*Locality?*" {send "chengdu\r"}
"?*Province*" {send "sichuan\r"}
"?*two-letter*" {send "86\r"}
"?*no*" {send "y\r"}
"?*password):" {send "$passwd\r"}
}
expect "*#"
spawn keytool-import -trustcacerts -alias root -file root.crt -keystore server.keystore
expect {
"keystore:*" {send "$passwd\r"}
"*]*" {send "y\r"}
}
expect "*#"
interact
expect eof
EOF
|
|