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
17 local_config=/etc/planetlab/configs/site.xml
24 if [ "$PLC_API_ENABLED" != "1" ] ; then
28 MESSAGE=$"Configuring the API"
31 # Make sure that the API maintenance account is protected by a
33 if [ -z "$PLC_API_MAINTENANCE_PASSWORD" ] ; then
34 PLC_API_MAINTENANCE_PASSWORD=$(uuidgen)
35 plc-config --category=plc_api --variable=maintenance_password --value="$PLC_API_MAINTENANCE_PASSWORD" --save=$local_config $local_config
39 # Make sure that all PLC servers are allowed to access the API
40 # through the maintenance account.
41 PLC_API_MAINTENANCE_SOURCES=($((
42 for ip in $PLC_API_MAINTENANCE_SOURCES ; do
45 for server in API BOOT WWW ; do
46 hostname=PLC_${server}_HOST
47 gethostbyname ${!hostname}
50 PLC_API_MAINTENANCE_SOURCES=${PLC_API_MAINTENANCE_SOURCES[*]}
51 plc-config --category=plc_api --variable=maintenance_sources --value="$PLC_API_MAINTENANCE_SOURCES" --save=$local_config $local_config