github.com/jlmucb/cloudproxy@v0.0.0-20170830161738-b5aa0b619bc4/go/apps/simple_http_server/run.sh (about)

     1  #!/bin/sh
     2  # Change these exports to run it under different folder
     3  export DOMAIN=./Domain # Root domain
     4  export BINPATH=$GOPATH/bin # Where to find the relevant bins
     5  export TEMPLATE=allowall.cfg # Tao configuration template
     6  export PASSWORD=httptest #password for SoftTao
     7  
     8  # Build all the source
     9  go install ./...
    10  
    11  if [[ -e $DOMAIN ]]
    12  then
    13    echo "$DOMAIN exists"
    14  else
    15    mkdir $DOMAIN
    16    mkdir $DOMAIN/policy_keys
    17    echo "$DOMAIN created"
    18  fi
    19  
    20  # copy the relevant files to domain
    21  cp $BINPATH/simple_http_server $DOMAIN/http_server
    22  cp $TEMPLATE $DOMAIN/
    23  
    24  # Create a domain for the server; server relevant files are stored here.
    25  if [[ -e $DOMAIN/simpleserver ]]
    26  then
    27    echo "$DOMAIN/simpleserver exists"
    28  else
    29    mkdir $DOMAIN/simpleserver
    30    echo "$DOMAIN/simpleserver created"
    31  fi
    32  
    33  # Create a domain for the linux_host
    34  if [[ -e $DOMAIN/linux_tao_host ]]
    35  then
    36    echo "$DOMAIN/linux_tao_host exists"
    37  else
    38    mkdir $DOMAIN/linux_tao_host
    39    echo "$DOMAIN/linux_tao_host created"
    40  fi
    41  
    42  # Create the key for SoftTao. This generates a cert and a private key
    43  # for SoftTao, and put it in $DOMAIN/linux_tao_host
    44  KEY_NAME="$($BINPATH/tao domain newsoft -soft_pass $PASSWORD \
    45    -config_template $DOMAIN/$TEMPLATE $DOMAIN/linux_tao_host)"
    46  echo "host_name: \"$KEY_NAME\"" | tee -a $DOMAIN/$TEMPLATE
    47  
    48  # Create the domain and relevant files
    49  # Create policy keys that can be used to sign and authenticate different
    50  # policies that can be used to determine which code runs.
    51  # Without a liberal guard, one should run something like to generate correct policies.
    52  # $BINPATH/tao domain policy -add_host -add_programs -add_linux_host -add_guard -tao_domain \
    53  #      $DOMAIN -pass xxx -config_template $DOMAIN/$TEMPLATE
    54  $BINPATH/tao domain init -tao_domain $DOMAIN -config_template $DOMAIN/$TEMPLATE \
    55    -pub_domain_address "127.0.0.1" -pass $PASSWORD
    56  
    57  # Produces a certificate for SoftTao root key. In a real deployment, this will
    58  # be replaced by TPM certificates. This also specifies the type of applications
    59  # that will be hosted. In this example, it's "process", but could be containers
    60  # or something else.
    61  $BINPATH/tao host init -tao_domain $DOMAIN -hosting process -root -pass $PASSWORD
    62  
    63  # Start linux host on SoftTao. Needs to run as root to start the server
    64  sudo -E $BINPATH/tao host start -tao_domain $DOMAIN -host linux_tao_host -pass $PASSWORD &
    65  sleep 3
    66  
    67  # Start the http server
    68  $BINPATH/tao run -tao_domain $DOMAIN \
    69    $DOMAIN/http_server -domain_config $DOMAIN/tao.config -path $DOMAIN/simpleserver
    70  
    71  # clean up..
    72  # sudo rm -f $DOMAIN/linux_tao_host/admin_socket
    73  # WARNING: THE FOLLOWING COMMAND WILL KILL EVERYTHING WITH $DOMAIN IN THE PROCESS NAME
    74  # If you are sure there are no other processes with domain in the name,
    75  # you can use this to clear all tao related processess
    76  # pkill -f $DOMAIN