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
12 # Source function library and configuration
13 . /etc/plc.d/functions
14 . /etc/planetlab/plc_config
15 local_config=/etc/planetlab/configs/site.xml
22 if [ "$PLC_API_ENABLED" != "1" ] ; then
26 MESSAGE=$"Configuring the API"
29 # Make sure that the API maintenance account is protected by a
31 if [ -z "$PLC_API_MAINTENANCE_PASSWORD" ] ; then
32 PLC_API_MAINTENANCE_PASSWORD=$(uuidgen)
33 plc-config --category=plc_api --variable=maintenance_password --value="$PLC_API_MAINTENANCE_PASSWORD" --save=$local_config $local_config
38 # Make sure that all PLC servers are allowed to access the API
39 # through the maintenance account.
40 PLC_API_MAINTENANCE_SOURCES=($((
41 for ip in $PLC_API_MAINTENANCE_SOURCES ; do
44 for server in API BOOT WWW ; do
45 hostname=PLC_${server}_HOST
46 gethostbyname ${!hostname}
49 PLC_API_MAINTENANCE_SOURCES=${PLC_API_MAINTENANCE_SOURCES[*]}
50 plc-config --category=plc_api --variable=maintenance_sources --value="$PLC_API_MAINTENANCE_SOURCES" --save=$local_config $local_config