26 lines
836 B
Bash
26 lines
836 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
exec 2> /var/log/ie-init
|
||
|
|
||
|
IeSshKey=/opt/innovenergy/crypto/InnovEnergy.ssh.public.key
|
||
|
UserSshKey=/home/root/.ssh/authorized_keys
|
||
|
GlobalSshKey=/usr/share/support-keys/authorized_keys
|
||
|
|
||
|
IeTlsCert=/opt/innovenergy/crypto/InnovEnergy.static.tls.cert
|
||
|
CaCerts=/etc/ssl/certs/ca-certificates.crt
|
||
|
|
||
|
grep -q 'InnovEnergy$' "$GlobalSshKey" || cat "$IeSshKey" >> "$GlobalSshKey"
|
||
|
grep -q 'InnovEnergy$' "$UserSshKey" || cat "$IeSshKey" >> "$UserSshKey"
|
||
|
|
||
|
chmod 644 "$UserSshKey"
|
||
|
|
||
|
# check if $CaCerts contains $IeTlsCert
|
||
|
# grep $CaCerts for every line in $IeTlsCert
|
||
|
# gives us lines in common
|
||
|
# ---- (BEGIN/END)CERTIFICATE ---- will always be in common
|
||
|
# check if a line starting with MII is in common
|
||
|
# every TLS cert always starts with MII
|
||
|
|
||
|
grep -F -x -f "$CaCerts" "$IeTlsCert" | grep -q '^MII' || cat "$IeTlsCert" >> "$CaCerts"
|
||
|
|