diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..88585d3 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,10 @@ +language: php +php: + - 5.5 + - 5.4 + - 5.3 +env: + - DB=mysql + - DB=pgsql +script: + - ./selftest.sh diff --git a/selftest.sh b/selftest.sh new file mode 100644 index 0000000..570629c --- /dev/null +++ b/selftest.sh @@ -0,0 +1,45 @@ +#!/bin/bash +set -e +set -x + +packages="help2man apache2 php5-mcrypt curl" + +if [ "x$DB" = "xmysql" ]; then + dbuser=travis + packages="$packages php5-mysql" + + mysql -u $dbuser -e 'create database ykksm;' + mysql -u $dbuser ykksm < ykksm-db.sql + + dbrun="mysql -u $dbuser ykksm -e" +else [ "x$DB" = "xpgsql" ]; then + dbuser=postgres + packages="$packages php5-pgsql" + + psql -U $dbuser -c 'create database ykksm;' + psql -U $dbuser ykksm < ykksm-db.sql + + dbrun="psql -U $dbuser ykksm -c" +fi + +sudo apt-get update -qq +sudo apt-get install -qq --y $packages + +git submodule update --init +sudo make install symlink +sudo sh -c "echo 'include_path = "/etc/yubico/ksm:/usr/share/ykksm"' > /etc/php5/conf.d/ykksm.ini" +sudo chmod a+r /usr/share/yubikey-ksm/* /etc/yubico/ksm/* +cat > config-db.php << EOF + +EOF +sudo mv config-db.php /etc/yubico/ksm/ + +$dbrun 'insert into yubikeys (publicname,internalname,aeskey) values("idkfefrdhtru","609963eae7b5","c68c9df8cbfe7d2f994cb904046c7218");' + +sudo /etc/init.d/apache2 restart +curl --silent http://localhost/wsapi/decrypt?otp=idkfefrdhtrutjduvtcjbfeuvhehdvjjlbchtlenfgku | grep -q "^OK counter=0001 low=8d40 high=0f use=00" || (echo "failed OTP"; exit 1)