Commit 1c30be19 authored by kelsey's avatar kelsey
Browse files

Further progress based on the v0.1.0 draft.

parent 2481287e
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
SUBDIRS = libucl

# Don't install the local libucl when make install is run
install installdirs: SUBDIRS := $(filter-out libucl, $(SUBDIRS))

LIBUCL_LDADD = libucl/src/.libs/libucl.a

ACLOCAL_AMFLAGS = -I m4
AM_CPPFLAGS = \
	-DLIBDEMO_PKI_DIR=\"$(pki_dir)\" \
	-DLIBDEMO_PKI_PRIVATE_DIR=\"$(pki_private_dir)\" \
	-I$(top_srcdir)/libtlmsp-cfg \
	-I$(top_srcdir)/libtlmsp-util \
	-I$(top_srcdir)/libucl/include
@@ -46,6 +45,8 @@ libdemo_a_SOURCES = \
	libdemo/connection.h \
	libdemo/container_queue.c \
	libdemo/container_queue.h \
	libdemo/pki.c \
	libdemo/pki.h \
	libdemo/print.c \
	libdemo/print.h \
	libdemo/splice.c \
@@ -96,3 +97,11 @@ pkginclude_HEADERS = \
	libtlmsp-cfg/libtlmsp-cfg.h \
	libtlmsp-util/libtlmsp-util.h



install-data-local:
	$(mkinstalldirs) $(datadir)/examples
	-for file in $(srcdir)/examples/*.ucl; do \
		basefile=$$(basename $$file); \
		$(INSTALL_DATA) $$file $(datadir)/examples/$$basefile; \
	done
+214 −20
Original line number Diff line number Diff line
# tlmsp-tools

Tools for creating and testing TLMSP (ETSI TS 103 523-2) clients, middleboxes, and servers.
Tools for creating and testing TLMSP (ETSI TS 103 523-2) clients, middleboxes,
and servers.

Executable   | Purpose
-------------|---------------
* [Overview](#overview)
* [Building](#building)
  + [Dependencies](#dependencies)
  + [Initial build](#initial-build)
  + [Update build](#update-build)
  + [Debug build](#debug-build)
* [Running](#running)
  + [Configuration](#configuration)
  + [tlmsp-client, tlmsp-mb, tlmsp-server](#tlmsp-client--tlmsp-mb--tlmsp-server)
  + [apache-httpd](#apache-httpd)
  + [curl](#curl)

## Overview

tlmsp-tools provides several libraries and executables:

tlmsp-tools component   | Description
------------------------|-------------------
tlmsp-client            | Client program
tlmsp-mb                | Middlebox program
tlmsp-server            | Server program
libdemo                 | Common components for tlmsp-{client, mb, server}
libtlmsp-cfg            | Library for parsing and accessing UCL-based configuration files
libtlmsp-util           | Utility routines of interest to multiple TLMSP programs
libucl                  | Local build of libucl, as it isn't available on all platforms

# Building
<br>
tlmsp-tools also serves to coordinate the building of additional TLMSP-enabled
packages:
<br><br>

```
git clone git@forge.etsi.org:cyber/tlmsp-tools.git
git clone git@forge.etsi.org:cyber/tlmsp-openssl.git
mkdir tlmsp-install
cd tlmsp-tools/build
./initial-build.sh $(realpath ../../tlmsp-install)
```
Additional components | Description
----------------------|---------------------
apache-httpd          | Apache httpd version that can serve pages over TLMSP
curl                  | curl version that can fetch pages over TLMSP
openssl               | OpenSSL modified to support TLMSP; used by apache, curl, and tlmsp-tools

The tools can then be run directly out of tlmsp-tools/, or more
generally by adding the tlmsp-install/bin path to PATH and
tlmsp-install/lib path to LD\_LIBRARY\_PATH.
## Building

## Dependencies
### Dependencies

tlmsp-tools requires:
 * autotools
 * clang
 * libev
 * libpcre2.
 * libpcre2
 * parallel

apache-httpd additionally requires:
 * libexpat
 * libpcre (old version)

On Ubuntu 18.04 LTS, the following obtains all of the necessary
pieces:
`sudo apt-get install autoconf clang gettext libpcre2-dev libtool libev-dev pkg-config`

`sudo apt-get install autoconf clang gettext libexpat1-dev libpcre3-dev libpcre2-dev libtool-bin libev-dev parallel pkg-config`

### Initial build
```
# Starting in some <directory_root>, resulting in installation to 
# <directory_root>/install
mkdir tlmsp
cd tlmsp
git clone git@forge.etsi.org:cyber/tlmsp-tools.git
cd tlmsp-tools/build
./build.sh

# You will now have
# tlmsp/
#     install/
#     apache-httpd/
#     curl/
#     openssl/
#     tlmsp-tools/
```

Adjust your `PATH` to include `<directory_root>/tlmsp/install/bin` ahead of
any system paths that may contain executables with the same names.

Adjust your `LD_LIBRARY_PATH` to include
`<directory_root>/tlmsp/install/lib` ahead of any other system paths that
may contain libraries with the same names.

Set TLMSP_UCL to `<directory_root>/tlmsp/install/share/tlmsp-tools/examples`.

Scripts that can be sourced in shell init files to set up the environment as 
described above are installed in `<directory_root>/tlmsp/install/share/tlmsp-tools`.

Self-signed certificates and corresponding private keys (sufficient to satisfy
the default requirements for a client, server, and maximum number of
middleboxes) are installed under `<install_dir>/etc/pki` and
`<install_dir>/etc/pki/private`, respectively.

### Update build

After an initial build has been done, the following will pick up all source
changes, reconfigure, rebuild, and reinstall.

```
# While in tlmsp-tools/build
git pull
./build.sh -u
```

### Debug build

Add '-d' to the build.sh options used in order to configure and build with
compiler optimizations disabled, and compiler debug symbols and per-package
extra debug mechanisms engaged.

## Running

### Configuration

All of the programs obtain their TLMSP-related configuration from a file whose
format is described in `tlmsp-tools/libtlmsp-cfg/everything.ucl`.  The
configuration file defines:

* The TLMSP entities
* The PKI configuration for each entity
* The network topology
* The TLMSP contexts being used
* The access rights of each middlebox for each context
* For tlmsp-client, tlmsp-mb, and tlmsp-server, match-action specifications
  ('activities') that determine their behavior

The following table summarizes the blocks from the configuration file that each
program consumes.

Program      | Contexts | Client | Middleboxes | Server | Activities | Notes
:------------|:--------:|:------:|:-----------:|:------:|:----------:|:---------
tlmsp-client |    X     |   X    |      X      |   X    |      X     |
tlmsp-mb     |          |        |      X      |   X    |      X     | Context and server address details normally obtained from the wire; when transparent middleboxes are configured, the transparency emulation sometimes requires a peek at the server block in the config file.
tlmsp-server |    X     |        |      X      |   X    |      X     | 
apache-httpd |    X     |        |      X      |        |            | Server address and PKI config come from the apache configuration
curl         |    X     |   X    |      X      |   X    |            | Client used only for client address; Server used only for address to validate command line URL

<br>

Sample configuration files are installed in `<install_dir>/share/tlmsp-tools/examples`.

### tlmsp-client, tlmsp-mb, tlmsp-server

The server and middlebox(es) can be started in any order.  The client, of course, needs to be started last.

```
# -P turns on 'presentation' style logging, which narrates the match-action activity in a relatively uncluttered way
tlmsp-server -c config.ucl -P
```
```
# middleboxes require specification of which one in the given config file to run
tlmsp-mb -c config.ucl -t mbox1 -P

# or which ones
tlmsp-mb -c config.ucl -t mbox1 -t mbox2 -P

# or all
tlmsp-mb -c config.ucl -a -P
```
```
tlmsp-client -c config.ucl -P
```

Aside from configurable logging, these three programs will print out summary
statistics in response to a specific signal.  Under FreeBSD, this is SIGINFO,
which can be delivered to a process controlling a terminal by using Ctrl+T.
Under Linux, one has to resort to `kill -SIGUSR1 <pid>` from another terminal.

### apache-httpd

The apache-httpd configuration is installed at `<install_dir>/etc/apache24/httpd.conf`
and includes `<install_dir>/etc/apache24/httpd_tlmsp.conf`, which in turn 
defines two virtual hosts:

* One on `localhost:4443` configured to use `${TLMSP_UCL}/apache.ucl`
* One on `localhost:4444` configured to use `${TLMSP_UCL}/apache.1mbox.ucl`

The apache-httpd TLMSP integration requires the UCL file to define two contexts,
one with the tag 'header' and one with the tag 'body', into which it places
response headers and bodies, respectively.

Pages are served out of `<install_dir>/share/apache24/htdocs` and logs can be
found in `<install_dir>/var/logs`.

```
# Start apache in the single-worker, foreground mode
httpd -X
```
```
# If using the server on port 4444, a middlebox will need to be started
tlmsp-mb -c ${TLMSP_UCL}/apache.1mbox.ucl -t mbox1 -P
```
```
# Run tlmsp-client, here against the server on port 4443
tlmsp-client -c ${TLMSP_UCL}/apache.ucl -P

# or use curl, again assuming against the server on port 4443
curl --tlmsp ${TLMSP_UCL}/apache.ucl https://localhost:4443 -k -v
```

Either client should successfully fetch the default index.html that installs
with apache, which consists of:

```
<html><body><h1>It works!</h1></body></html>
```

### curl

The curl TLMSP integration requires the UCL file to define two contexts, one
with the tag 'header' and one with the tag 'body', into which it places request
headers and bodies, respectively.

Also, the server hostname and port indicated in the URL on the command line
must match the hostname and port indicated by the server address in the UCL file.
curl continues to require an explicit URL in TLMSP mode so that different request
paths can be specified without having to edit the UCL file.

```
tlmsp-server -c ${TLMSP_UCL}/curl.ucl -P
```
```
curl --tlmsp ${TLMSP_UCL}/curl.ucl https://localhost:10254 -k -v
```

build/build.sh

0 → 100755
+464 −0
Original line number Diff line number Diff line
#!/bin/sh
#
# This script is for performing configuration, build, and install of
# TLMSP-enabled openssl, tlmsp-tools, and TLMSP-enabled apache and
# curl.
#
# The process is as follows:
#   - Obtain all missing sources
#   - If -u was given, update existing sources
#   - Configure all sources, unless -n was given and all sources were
#       already present
#   - Build all sources
#   - Install all sources
#   - If -u was not given, generate keys and certificates
#

usage() {
    echo "Usage: $0 [options] [make_args]"
    echo ""
    echo "Options:"
    echo "    --                 Use ahead of <make_args> if first make_arg begins with -"
    echo "    -d                 Configure for and perform debug builds"
    echo "    -h                 Print this help message"
    echo "    -i  <install_dir>  Set installation directory [default: ${script_dir}/../install]"
    echo "    -n                 Skip configure stages if all sources were present"
    echo "    -u                 Update existing sources"
}


# echo given message to stdout such that it stands out
announce() {
    echo ">>>" $@
}

# like announce, but for critical messages
alert() {
    echo "!!!" $@
}

require_success() {
    eval $@
    if [ $? -ne 0 ]; then
	alert "command failed:" $@
	exit 1
    fi
}

require_file() {
    local filename="$1"
    local fail_msg="$2"

    if [ ! -f ${filename} ]; then
	alert ${fail_msg}
	exit 1
    fi
}

require_repo() {
    local destdir="$1"
    local repo="$2"
    local branch_or_tag="$3"
    local origdir

    origdir=$(pwd)
    if [ ! -d ${destdir} ]; then
	announce "Cloning ${repo} to ${destdir}"
	require_success git clone ${repo} ${destdir}
	require_success cd ${destdir}
	announce "Checking out ${branch_or_tag}"
	require_success git checkout ${branch_or_tag}

	if [ "${no_configure}" = "yes" ]; then
	    announce "Configure stages will be run as not all source trees were present"
	    no_configure=
	fi
    else
	announce "Repo ${repo} appears to already be cloned to ${destdir}"
	if [ "${update_build}" = "yes" ]; then
	    require_success cd ${destdir}
	    announce "Updating sources in ${destdir}"
	    git status | head -n 1 | grep -q 'HEAD detached'
	    if [ $? -eq 0 ]; then
		announce "No update required - sources are parked at tag ${branch_or_tag}"
	    else
		require_success git pull
	    fi
	fi
    fi
    cd ${origdir}
}

# Assumes it is being run in the top directory of a package
maybe_clean() {
    # If not doing an update build and there is a Makefile, clean
    if [ "${force_clean}" = "yes" -o \( "${update_build}" != "yes" -a -f Makefile \) ]; then
	# If configure will be run, clean all the configure-generated
	# files too, otherwise normal clean
	if [ "${do_configure}" = "yes" ]; then
	    announce "Performing distclean"
	    # OK if it fails, so no require_success here
	    make distclean
	else
	    announce "Performing clean"
	    # OK if it fails, so no require_success here
	    make clean
	fi
    fi
}

build_script_dir=$(pwd)
require_file "${build_script_dir}/$(basename $0)" \
	     "This script is intended to be run from the directory that contains it"

tlmsp_tools_dir=$(realpath ${build_script_dir}/..)
install_dir=${tlmsp_tools_dir}/../install
src_root=$(realpath ${tlmsp_tools_dir}/..)
debug=
update_build=
no_configure=
force_clean=yes
max_middleboxes=251
apache_httpd_first_port=4443

orig_args=$@
args=`getopt dhi:nu $*`
if [ $? -ne 0 ]; then
    usage $0
    exit 1
fi
set -- $args
while true; do
    case "$1" in
	-d)
	    debug=yes
	    shift
	    ;;
	-h)
	    usage $0
	    exit 0
	    ;;
	-i)
	    shift
	    install_dir=$1
	    shift
	    ;;
	-n)
	    no_configure=yes
	    shift
	    ;;
	-u)
	    update_build=yes
	    shift
	    ;;
	--)
	    shift; break
	    ;;
    esac
done

openssl_dir=${src_root}/tlmsp-openssl
openssl_repo=https://forge.etsi.org/rep/cyber/tlmsp-openssl.git
openssl_branch_or_tag=master-tlmsp

curl_dir=${src_root}/tlmsp-curl
curl_repo=https://forge.etsi.org/rep/cyber/tlmsp-curl.git
curl_branch_or_tag=master-tlmsp

apache_httpd_dir=${src_root}/tlmsp-apache-httpd
apache_httpd_repo=https://forge.etsi.org/rep/cyber/tlmsp-apache-httpd.git
apache_httpd_branch_or_tag=master-tlmsp

# dir set after overrides below
apache_apr_repo=https://github.com/apache/apr.git
apache_apr_branch_or_tag=1.7.0

# dir set after overrides below
apache_apr_util_repo=https://github.com/apache/apr-util.git
apache_apr_util_branch_or_tag=1.6.1

pki_public=${install_dir}/etc/pki
pki_private=${install_dir}/etc/pki/private

# If available, load overrides for default source tree and tag/branch
# names
if [ -f ./local-build-config.sh ]; then
    . ./local-build-config.sh
fi
apache_apr_dir=${apache_httpd_dir}/srclib/apr
apache_apr_util_dir=${apache_httpd_dir}/srclib/apr-util

silent_rules=--disable-silent-rules

os=`uname -s`
if [ $os = "FreeBSD" ]; then 
    num_cpus=`sysctl -n kern.smp.cpus`
    apache_httpd_configure_LDFLAGS="LDFLAGS=-L/usr/local/lib"
    apache_httpd_make_EXTRA_LIBS="EXTRA_LIBS=-liconv"
elif [ $os = "Linux" ]; then
    num_cpus=`grep -c ^processor /proc/cpuinfo`
else
    num_cpus=1
fi
max_cpus=10
if [ ${num_cpus} -gt ${max_cpus} ]; then
    num_cpus=${max_cpus}
fi

make_j=-j$(( ${num_cpus} * 2 ))

if [ ! -d ${install_dir} ]; then
    announce "Creating installation directory ${install_dir}"
    require_success mkdir -p ${install_dir}
fi

if [ ! -d ${pki_public} ]; then
    announce "Creating public pki directory ${pki_public}"
    require_success mkdir -p ${pki_public}
fi
if [ ! -d ${pki_private} ]; then
    announce "Creating private pki directory ${pki_private}"
    require_success mkdir -p ${pki_private}
    require_success chmod 700 ${pki_private}
fi

# Simplify names of directories that may have just been created as
# this can't be done before they exist
install_dir=$(realpath ${install_dir})
pki_public=$(realpath ${pki_public})
pki_private=$(realpath ${pki_private})

# Check to see if tlmsp-tools has advanced upstream
tlmsp_tools_update_check_failed=
if [ "${update_build}" = "yes" ]; then
    git remote update
    if [ $? -eq 0 ]; then
	git status -uno | grep -q 'branch is up to date'
	if [ $? -ne 0 ]; then
	    alert "======================================="
	    alert "tlmsp-tools needs to be updated:"
	    alert "git pull and re-run $0 ${orig_args}"
	    alert "======================================="
	    exit 1
	fi
    else
	tlsmp_tools_update_check_failed=yes
    fi
fi

# Fetch all sources
for s in openssl curl apache_httpd apache_apr apache_apr_util; do
    eval destdir=\$${s}_dir
    eval repo=\$${s}_repo
    eval branch_or_tag=\$${s}_branch_or_tag

    announce "Fetching ${repo} (${branch_or_tag}) to ${destdir}"
    require_repo ${destdir} ${repo} ${branch_or_tag}
done

do_configure=
if [ "${no_configure}" != "yes" ]; then
    do_configure=yes
fi

require_file "${openssl_dir}/include/openssl/tlmsp.h" \
	     "The OpenSSL source directory ${openssl_dir} does not include TLMSP support"

require_success cd ${openssl_dir}
maybe_clean
if [ "${do_configure}" = "yes" ]; then
    announce "Configuring OpenSSL"
    require_success ./config \
		    ${debug:+-d} \
		    --prefix=${install_dir}
fi
announce "Building OpenSSL"
require_success make ${make_j} "$@"
announce "Installing OpenSSL"
require_success make install_sw

require_success cd ${tlmsp_tools_dir}
maybe_clean
tlmsp_tools_ucl_dir=${install_dir}/share/tlmsp-tools/examples
if [ "${do_configure}" = "yes" ]; then
    announce "Configuring tlmsp-tools"
    require_success ./buildconf.sh \
		    -i ${install_dir} \
		    ${debug:+-d}
fi
announce "Building tlmsp-tools"
require_success make ${make_j} "$@"
announce "Installing tlmsp-tools"
require_success make install

require_success cd ${curl_dir}
maybe_clean
if [ "${do_configure}" = "yes" ]; then
    announce "Configuring curl"
    require_success ./buildconf
    require_success ./configure \
		    --prefix=${install_dir} \
		    --with-ssl=${install_dir} \
		    --with-tlmsp-tools=${install_dir} \
		    ${silent_rules} \
		    ${debug:+--enable-debug} \
		    ${debug:+--disable-curldebug}
fi
announce "Building curl"
require_success make ${make_j} "$@"
announce "Installing curl"
require_success make install

require_success cd ${apache_httpd_dir}
maybe_clean
apache_httpd_conf_dir=${install_dir}/etc/apache24
if [ "${do_configure}" = "yes" ]; then
    announce "Configuring Apache HTTPD"
    require_success ./buildconf
    require_success ./configure \
		    ${apache_httpd_configure_LDFLAGS} \
		    --with-included-apr \
		    --with-ssl=${install_dir} \
		    --with-tlmsp-tools=${install_dir} \
		    --prefix=${install_dir} \
		    --includedir=${install_dir}/include/apache24 \
		    --datadir=${install_dir}/share/apache24 \
		    --sysconfdir=${apache_httpd_conf_dir} \
		    --localstatedir=${install_dir}/var \
		    --mandir=${install_dir}/share/man \
		    --libexecdir=${install_dir}/libexec/apache24 \
		    --with-port="127.0.0.1:${apache_httpd_first_port}\ https" \
		    ${debug:+--enable-debugger-mode}
fi
announce "Building Apache HTTPD"
require_success make ${make_j} ${apache_httpd_make_EXTRA_LIBS} "$@"
announce "Installing Apache HTTPD"
require_success make install

announce "Adjusting Apache HTTPD configuration files"
cd ${build_script_dir}
require_success sed -E -i.orig '"s/#(LoadModule ssl_module.+)/\\1/"' ${apache_httpd_conf_dir}/httpd.conf
require_success rm ${apache_httpd_conf_dir}/httpd.conf.orig
include_str="IncludeOptional ${apache_httpd_conf_dir}/httpd_tlmsp.conf"
grep -q "${include_str}" ${apache_httpd_conf_dir}/httpd.conf
if [ $? -ne 0 ]; then
    echo >> ${apache_httpd_conf_dir}/httpd.conf
    echo ${include_str} >> ${apache_httpd_conf_dir}/httpd.conf
fi
conf_file=${apache_httpd_conf_dir}/httpd_tlmsp.conf
if [ -f ${conf_file} ]; then
    timestamp=$(date +%Y%m%d-%H%M%S)
    backup_file=${conf_file}.${timestamp}
    if [ -f ${backup_file} ]; then
	sleep 2
	timestamp=$(date +%Y%m%d-%H%M%S)
	backup_file=${conf_file}.${timestamp}
    fi
    announce "Backing up existing ${conf_file} to ${backup_file}"
    require_success cp ${conf_file} ${backup_file}
fi
cat > ${conf_file} <<EOF

# Avoid warning about accept filters due to running from userland
AcceptFilter https none

<VirtualHost 127.0.0.1:${apache_httpd_first_port}>
    ServerName localhost
    SSLEngine on
    SSLCertificateFile "${pki_public}/server-cert.pem"
    SSLCertificateKeyFile "${pki_private}/server-key.pem"
    TLMSPConfigFile "${tlmsp_tools_ucl_dir}/apache.ucl"
</VirtualHost>

Listen 127.0.0.1:$(( ${apache_httpd_first_port} + 1 )) https

<VirtualHost 127.0.0.1:$(( ${apache_httpd_first_port} + 1 ))>
    ServerName localhost
    SSLEngine on
    SSLCertificateFile "${pki_public}/server-cert.pem"
    SSLCertificateKeyFile "${pki_private}/server-key.pem"
    TLMSPConfigFile "${tlmsp_tools_ucl_dir}/apache.1mbox.ucl"
</VirtualHost>

Listen 127.0.0.1:$(( ${apache_httpd_first_port} + 2 )) https

<VirtualHost 127.0.0.1:$(( ${apache_httpd_first_port} + 2 ))>
    ServerName localhost
    SSLEngine on
    SSLCertificateFile "${pki_public}/server-cert.pem"
    SSLCertificateKeyFile "${pki_private}/server-key.pem"
    TLMSPConfigFile "${tlmsp_tools_ucl_dir}/apache.2mbox.ucl"
</VirtualHost>

Listen 127.0.0.1:$(( ${apache_httpd_first_port} + 3 )) https

<VirtualHost 127.0.0.1:$(( ${apache_httpd_first_port} + 3 ))>
    ServerName localhost
    SSLEngine on
    SSLCertificateFile "${pki_public}/server-cert.pem"
    SSLCertificateKeyFile "${pki_private}/server-key.pem"
    TLMSPConfigFile "${tlmsp_tools_ucl_dir}/apache.251mbox.ucl"
</VirtualHost>

EOF

conf_dir=${install_dir}/ssl
require_success mkdir -p ${conf_dir}
conf_file=${conf_dir}/openssl.cnf
announce "Installing minimal openssl.cnf at ${conf_file}"
cat > ${conf_file} <<EOF
[ req ]
distinguished_name = req_dn

[ req_dn ]

EOF

if [ "${update_build}" != "yes" ]; then
    announce "Generating keys and certificates"
    require_success ./make_demo_cert.sh -c ${pki_public} -k ${pki_private} -t client
    require_success ./make_demo_cert.sh -c ${pki_public} -k ${pki_private} -t server
    require_success parallel ${make_j} \
		    ./make_demo_cert.sh \
		    -c ${pki_public} \
		    -k ${pki_private} \
		    -t mbox{} \
		    ::: $(seq ${max_middleboxes})
fi

setup_env_root=${install_dir}/share/tlmsp-tools/tlmsp-env
setup_env_sh=${setup_env_root}.sh
setup_env_csh=${setup_env_root}.csh
cat > ${setup_env_sh} <<EOF
export PATH=${install_dir}/bin:\$PATH
export LD_LIBRARY_PATH=${install_dir}/lib:\$LD_LIBRARY_PATH
export TLMSP_UCL=${tlmsp_tools_ucl_dir}
EOF
cat > ${setup_env_csh} <<EOF
setenv PATH ${install_dir}/bin:\$PATH
setenv LD_LIBRARY_PATH ${install_dir}/lib:\$LD_LIBRARY_PATH
setenv TLMSP_UCL=${tlmsp_tools_ucl_dir}
EOF
export TLMSP_SHELL_TYPE_TEST_VARIABLE=1 2>/dev/null
if [ $? -ne 0 ]; then
    announce "Ignore the above 'command not found' message"
    shell_type=csh
else
    shell_type=sh
fi

announce "Build complete"

if [ "${tlsmp_tools_update_check_failed}" = "yes" ]; then
    alert "============================================"
    alert "Unable to check if tlmsp-tools is up to date"
    alert "============================================"
    exit 1
fi

announce "Set up your environment by running this command (with the .), perhaps in your shell startup file:"
if [ "${shell_type}" = "sh" ]; then
    echo ". ${setup_env_sh}"
else
    echo ". ${setup_env_csh}"
fi

build/initial-build.sh

deleted100755 → 0
+0 −86
Original line number Diff line number Diff line
#!/bin/sh
#
# This script is for performing an initial configuration, build, and
# install of TLMSP-enabled openssl and tlmsp-tools.
#

usage() {
    echo "Usage: $0 local_install_dir [make_args]"
}


if [ $# -lt 1 ]; then
    usage $0
    exit 3
fi
local_install_dir=$1
shift
build_script_dir=$(pwd)
tlmsp_tools_dir=$(pwd)/..
openssl_dir=${build_script_dir}/../../tlmsp-openssl

if [ ! -f ${build_script_dir}/$(basename $0) ]; then
    echo "This script is intended to be run from the directory that contains it"
    exit 4
fi
if [ ! -d ${openssl_dir} ]; then
    openssl_dir=${build_script_dir}/../../openssl
    if [ ! -d ${openssl_dir} ]; then
	echo "The openssl source directory needs to be alongside the tlmsp-tools directory"
	exit 5
    fi
fi
if [ ! -f "${openssl_dir}/include/openssl/tlmsp.h" ]; then
    echo "The openssl source directory does include TLMSP support"
    exit 6
fi
if [ ! -d "${local_install_dir}" ]; then
    echo "Local installation directory '${local_install_dir}' does not exist"
    exit 7
fi

echo "Configuring OpenSSL"
cd ${openssl_dir}
./config --prefix=${local_install_dir}
if [ $? -ne 0 ]; then
    echo "OpenSSL configuration failed"
    exit 8
fi

echo "Building OpenSSL"
make "$@"
if [ $? -ne 0 ]; then
    echo "OpenSSL build failed"
    exit 9
fi

echo "Installing OpenSSL"
make install_sw
if [ $? -ne 0 ]; then
    echo "OpenSSL installation failed"
    exit 10
fi

echo "Configuring tlmsp-tools"
cd ${tlmsp_tools_dir}
./buildconf.sh ${local_install_dir}
if [ $? -ne 0 ]; then
    echo "tlmsp-tools configuration failed"
    exit 11
fi

echo "Building tlmsp-tools"
make "$@"
if [ $? -ne 0 ]; then
    echo "tlmsp-tools build failed"
    exit 12
fi

echo "Installing tlmsp-tools"
make install
if [ $? -ne 0 ]; then
    echo "tlmsp-tools installation failed"
    exit 13
fi

echo "Success"
+96 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading