5 # Configure the API. Must be done after SSL certificates are generated
6 # and before the API web server is brought up.
8 # Mark Huang <mlhuang@cs.princeton.edu>
9 # Copyright (C) 2006 The Trustees of Princeton University
14 # Source function library and configuration
15 . /etc/plc.d/functions
16 . /etc/planetlab/plc_config
23 if [ "$PLC_API_ENABLED" != "1" ] ; then
27 MESSAGE=$"Configuring the API"
30 # Make sure that the API maintenance account is protected by a
32 if [ -z "$PLC_API_MAINTENANCE_PASSWORD" ] ; then
33 PLC_API_MAINTENANCE_PASSWORD=$(uuidgen)
34 plc-config --category=plc_api --variable=maintenance_password --value="$PLC_API_MAINTENANCE_PASSWORD" --save
37 # Make sure that all PLC servers are allowed to access the API
38 # through the maintenance account.
39 PLC_API_MAINTENANCE_SOURCES=($((
40 for ip in $PLC_API_MAINTENANCE_SOURCES ; do
43 for server in API BOOT WWW ; do
44 hostname=PLC_${server}_HOST
45 gethostbyname ${!hostname}
48 PLC_API_MAINTENANCE_SOURCES=${PLC_API_MAINTENANCE_SOURCES[*]}
49 plc-config --category=plc_api --variable=maintenance_sources --value="$PLC_API_MAINTENANCE_SOURCES" --save