<commit_before>#!/usr/bin/env bash

# This script is mostly so we can test the test script for a standalone server.
# <storage file> is the sqlite3 database for the log.
# <certificate hash directory> contains the OpenSSL hashes for the
# accepted root certs.

set -e

if [ "$OPENSSLDIR" != "" ]; then
  MY_OPENSSL="$OPENSSLDIR/apps/openssl"
  export LD_LIBRARY_PATH=$OPENSSLDIR:$LD_LIBRARY_PATH
fi

if [ ! $MY_OPENSSL ]; then
# Try to use the system OpenSSL
  MY_OPENSSL=openssl
fi

if [ $# != 2 ]
then
  echo "$0 <storage file> <certificate hash directory>"
  exit 1
fi

STORAGE=$1
HASH_DIR=$2
KEY="testdata/ct-server-key.pem"

if [ ! -e $HASH_DIR ]
then
  echo "$HASH_DIR doesn't exist, creating"
  mkdir $HASH_DIR
  CERT="`pwd`/testdata/ca-cert.pem"
  hash=`$MY_OPENSSL x509 -in $CERT -hash -noout`
  ln -s $CERT $HASH_DIR/$hash.0
fi

# Set the tree signing frequency to 0 to ensure we sign as often as possible.
echo "Starting CT server with trusted certs in $HASH_DIR"

../server/ct-server --port=8124 --key=$KEY \
  --trusted_cert_dir=$HASH_DIR --logtostderr=true \
  --tree_signing_frequency_seconds=1 --sqlite_db=$STORAGE<commit_msg>Update to use RFC compliant server.<commit_after>#!/usr/bin/env bash

# This script is mostly so we can test the test script for a standalone server.
# <storage file> is the sqlite3 database for the log.
# <certificate hash directory> contains the OpenSSL hashes for the
# accepted root certs.

set -e

if [ "$OPENSSLDIR" != "" ]; then
  MY_OPENSSL="$OPENSSLDIR/apps/openssl"
  export LD_LIBRARY_PATH=$OPENSSLDIR:$LD_LIBRARY_PATH
fi

if [ ! $MY_OPENSSL ]; then
# Try to use the system OpenSSL
  MY_OPENSSL=openssl
fi

if [ $# != 2 ]
then
  echo "$0 <storage file> <certificate hash directory>"
  exit 1
fi

STORAGE=$1
HASH_DIR=$2
KEY="testdata/ct-server-key.pem"

if [ ! -e $HASH_DIR ]
then
  echo "$HASH_DIR doesn't exist, creating"
  mkdir $HASH_DIR
  CERT="`pwd`/testdata/ca-cert.pem"
  hash=`$MY_OPENSSL x509 -in $CERT -hash -noout`
  ln -s $CERT $HASH_DIR/$hash.0
fi

# Set the tree signing frequency to 0 to ensure we sign as often as possible.
echo "Starting CT server with trusted certs in $HASH_DIR"

../server/ct-rfc-server --port=8888 --key=$KEY \
  --trusted_cert_dir=$HASH_DIR --logtostderr=true \
  --tree_signing_frequency_seconds=1 --sqlite_db=$STORAGE
{'fraction_non_alphanumeric': 0.12034632034632034, 'fraction_numerical': 0.013852813852813853, 'mean_word_length': 4.023913043478261, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2198291', 'n_tokens_mistral': 889, 'n_tokens_neox': 846, 'n_words': 260}