]> WPIA git - infra.git/blob - manager/config
fix: use certificate authentication to request new gigi-certificates
[infra.git] / manager / config
1 ### Documentation for configuration options
2
3 ## Variables
4
5 # (required) Base domain for infra system installation.
6 #to=
7
8 # (required) Hostname or IP address of the infra system.
9 #domain=
10
11 # Additional packages that should be installed.
12 devPkgs=""
13
14 # How to connect to the signer backend.
15 #
16 # Either the name for the serial device or "self" to indicate that a signer container should be set up.
17 signerLocation=self
18
19 ## Functions
20
21 # Run a command in the infra system, accepting additional ssh-options.
22 function ssh_target {
23     ssh -i vm-key "$to" "$@"
24 }
25
26 # Install nre-files to the target system.
27 #
28 # * Extract all "signer-server" to modules/cassiopeia_signer/files in the target system.
29 # * Extract all "signer-client" to modules/cassiopeia_client/files in the target system.
30 # * Extract all "gigi" to modules/ner/files in the target system.
31 function install_nre {
32     ./installNRE "$targetHost"
33 }
34
35 # Configure variables for puppet.
36 #
37 # The default implementation prompts the user for all required variables.
38 function configure {
39     ssh_target -t 'bash conf-puppet --force'
40     ssh_target 'sed -i "s%\$signerLocation = '".*'"'%\$signerLocation = '"'$signerLocation'"'%" environments/production/manifests/ip.pp'
41 }
42
43 # Reset a vm to its base snapshot.
44 #
45 # The default implementation asks the user to do so.
46 function do_reset_vm {
47     read -rp "Please reset your VM and confirm by pressing enter." _
48 }
49
50 # Execute the gigi bootstrapping process. By default the process interacts with the user.
51 #
52 # This function can be overridden to execute "execute-bootstrap-user-auto" in order to automate this bootstrapping process.
53 # Make sure to provide "bootstrapper_details" to provide the necessary answers.
54 # To fully automate bootstrapping, you need to provide a way to extract the activation link (see "read_activation_link").
55 function execute-bootstrap-user {
56     ssh_target -t 'bash bootstrap-user'
57 }
58
59 # Obtain the activation link in the variable "$link".
60 #
61 # This is required for activating the first bootstrappers account.
62 # This is only required for automated bootstrap user.
63 function read_activation_link {
64     read -rp "Link: " link
65     printf '%s\n' "$link"
66 }
67
68 # Assign to the variable "admin_email" the email address of the gigi user account that should issue certificates for the system.
69 function read_admin_email {
70     read -rp "Gigi user account email for certificates: " admin_email
71 }
72
73 # Assign to the variable "admin_password" the password of the gigi user account that should issue certificates for the system.
74 function read_admin_password {
75     read -rsp "Gigi password: " admin_password
76 }
77
78 # Connect to gigi using $1 as local url part, the remaining args as additional curl arguments, "root.crt" as root certificate, "$folder/cookie-jar" as cookie-jar.
79 function mcurl {
80     local url="$1"
81     shift
82     curl -s --cacert root.crt -b $folder/cookie-jar "https://www.$domain/$url" "$@"
83 }
84
85 # See mcurl, but use client-certificate from 'gigi-key.pem'
86 function mscurl {
87     local url="$1"
88     shift
89     curl -s -E gigi-key.pem --cacert root.crt -b $folder/cookie-jar "https://secure.$domain/$url" "$@" | tee -a .weblog
90 }
91
92 # Connect via ssh into the "hop" container.
93 function admin_ssh {
94     ssh -i admin-key -p 2222 "admin@$to" "$@"
95 }
96
97 # Install backup is a hook to be triggered before the sytem is set up
98 function install_backup {
99     :
100 }
101
102 function populate_system {
103     # default is create fresh data using bootstrap-user
104     execute-bootstrap-user
105 }