forked from redgeoff/openvpn-server-vagrant
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-key.sh
executable file
·53 lines (47 loc) · 1.03 KB
/
build-key.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/expect
# Usage: build-key.sh name
# The following command doesn't work so we need to use expect
# yes "" | ./build-key ${name}
set name [lindex $argv 0];
# Get the password for the VPN account
stty -echo
send_user -- "VPN User Password: "
expect_user -re "(.*)\n"
send_user "\n"
stty echo
set pass $expect_out(1,string)
# Confirm the password for the VPN account
stty -echo
send_user -- "Confirm VPN User Password: "
expect_user -re "(.*)\n"
send_user "\n"
stty echo
set confirm_pass $expect_out(1,string)
spawn ./build-key-pass $name
send -- "$pass\r"
send -- "$confirm_pass\r"
expect "Country Name"
send "\n"
expect "State or Province Name"
send "\n"
expect "Locality Name"
send "\n"
expect "Organization Name"
send "\n"
expect "Organizational Unit Name"
send "\n"
expect "Common Name"
send "\n"
expect "Name"
send "\n"
expect "Email Address"
send "\n"
expect "A challenge password"
send "\n"
expect "An optional company name"
send "\n"
expect "Sign the certificate"
send "y\n"
expect "1 out of 1 certificate"
send "y\n"
expect "$ "