summaryrefslogtreecommitdiffstats
path: root/security/skip/scripts/post-install
blob: 97ea9b07a3513f0ef6319d73b62339fdc2cf3004 (plain)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/sh

# This is an interactive script to setup SKIP keys, etc.

SKIP_ETC="${PREFIX}/etc/skip"
SKIP_BIN="${PREFIX}/bin"

Confirm()
{
  while true; do
  {
    YESNO="$2"
    echo -n "$1? [${YESNO}] "
    read NEWYESNO
    if [ "${NEWYESNO}" != "" ]; then
      YESNO=${NEWYESNO}
    fi
    if [ "${YESNO}" != "y" -a "${YESNO}" != "n" ]; then
      echo "Please answer y or n."
    else
      break
    fi
  }
  done
  if [ "${YESNO}" != "y" ]; then
    return 1
  else
    return 0
  fi
}

init_skip_dbs ()
{
  echo "Initializing SKIP certification database..."
  ${SKIP_BIN}/skipdb init -o

  echo "Initializing SKIP authorities database..."
  ${SKIP_BIN}/skipca init -r

  echo "Initializing SKIP local identities database..."
  ${SKIP_BIN}/skiplocal init -o
}

generate_key ()
{
  echo "Generating Diffie-Hellman public/private key pair..."
  ${SKIP_BIN}/skiplocal keygen
}

activate_skip ()
{
  echo "Adding SKIP to primary network interface..."
  ${SKIP_BIN}/skipif -a
}

# main()

cat << xxENDxx

You now have a chance to:

 o Initialize your SKIP databases.
 o Generate a Diffie-Hellman public/private key pair.
 o Add SKIP to your primary network interface.

Notes:

 o If you have an existing working SKIP configuration that
   you want to keep, you should choose NOT to proceed.
   Proceeding will overwrite any existing SKIP configuration.
 o If you choose not to proceed, you will have to initialize
   the SKIP certification, authorities, and local identities
   databases manually.
 o SKIP will be active, but disabled, until you reboot and
   enable it manually using the skiphost command as described
   in step 5 of doc/INSTALL.

xxENDxx

Confirm "Do you want to proceed" "y" || exit 0

init_skip_dbs;
generate_key;
activate_skip;
OpenPOWER on IntegriCloud