Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding travis build configuration and docs #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
sudo: required

env:
- PACKAGE_VERSION=2.0.3

branches:
only:
- master

services:
- docker

# It is not really needed, other than for showing correct language tag in Travis CI build log.
language: c

before_install:
- docker pull ubuntu:16.04
- docker run -dt --name ubuntu-16 --privileged -v $(pwd)/:/work -e TRAVIS_BUILD_NUMBER=$TRAVIS_BUILD_NUMBER -e PACKAGE_VERSION=$PACKAGE_VERSION ubuntu:16.04

install:
- docker exec -t ubuntu-16 bash -c "apt-get update;
apt-get install -y openvpn autoconf libtool libssl-dev make;
apt-get install -y ruby ruby-dev rubygems build-essential"
# The above isn't really needed since the build scripts will install dependencies anyway

script:
- docker ps -a
- docker exec ubuntu-16 sh -c 'cd /work && ./ubuntu_16.04_lts_build.sh'
- docker exec ubuntu-16 sh -c 'cd /work && ./ubuntu_16.04_lts_package.sh'

notifications:
email: false

before_deploy:
- export RELEASE_PKG_FILE=$(ls *.deb)
- echo "deploying $RELEASE_PKG_FILE to GitHub releases"

deploy:
provider: releases
api_key:
secure: "FLzpyEqy3ezvIZNAyf0QBCTO4iTr1NFOzfXokoeK4ZPydLrpI9YhdM57kRmcBWDpmTxIXiO+QXutfSZixNZjK9d9Wnb36YFqPEeQEaI4+tXonTGZOmUe7rDvY/otMD5oKxv8uS3T5KHivpNbQuP9vJPWunH2888smS8M5PU4HOlr+X47ppwfmzybXdyCuw+O3gLwq9FdTp3AOeccrnHWtyRnonCz6egTOKJzvqHF3VGS46x8EBrajIBuQUyRDQ3Lky3+Uco7zrBi/N6/qZzfSvJ+ZJ/YIv9BNjhMOYDkUpDGFT1Q7niT75+9U2uHdN5R0G+KpubhoWs8AdoiwQLOCbzyVW/SQDn6uPW8XMgtqm+A2uhO0CWgp/0wqaMNedhQckwyczVXkn/5D4YGRfdMjR+bIx8kcMTTt0A0eCH+itVCiltUJz3kUnJS7TpoNftQM7TstOwsI48RvVOYbqnwx4En2IgJIeWHXOB5zubFtupeCAmHPrDsynBKsHYVGhQsV1Je4ZX14xyyA0GLMmZzAQhTMCf1LFKxnXDvgfZhlGAPWTc08yHsQyQI2Bo1+PZYRcEG3bZBvO8qFAZXpY+QypFfFXgpQsxLEhz0uUOxwP90W6zvkx2S6B17IeLYXHetenaYRbXqbF+bDwI2DsAXrnXVqy0kvZwDWI0aCKMNiY0="
file_glob: true
file: "${RELEASE_PKG_FILE}"
skip_cleanup: true
on:
branch: master
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
Travis build status: [![Build Status](https://travis-ci.org/snowrider311/openvpn-otp.svg?branch=master)](https://travis-ci.org/snowrider311/openvpn-otp)

The latest Ubuntu 16.04 Debian package (built by Travis) can be found [here](https://github.com/snowrider311/openvpn-otp/releases/latest).


OpenVPN OTP Authentication support
==================================

This plug-in adds support for time based OTP (totp) and HMAC based OTP (hotp) tokens for OpenVPN.
Compatible with Google Authenticator software token, other software and hardware based OTP tokens.


### Building

Compile and install ``openvpn-otp.so`` file to your OpenVPN plugins directory (usually ``/usr/lib/openvpn`` or ``/usr/lib64/openvpn/plugins``).

Be sure you've installed the following packages first:
Expand All @@ -25,6 +33,34 @@ passing the directory with ``--with-openvpn-plugin-dir`` to ``./configure``:

./configure --with-openvpn-plugin-dir=/plugin/dir


#### Building On Ubuntu 16.04 ####

The following steps were tested on a clean Ubuntu 16.04 LTS Amazon EC2 m5.large instance in January 2018 (source AMI: ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64-server-20180109 - ami-41e0b93b). These steps are also executed by Travis in a Docker container for every new commit made to this repository. The latest Ubuntu 16.04 Debian package (built by Travis) can be found [here](https://github.com/snowrider311/openvpn-otp/releases/latest).

If you wish to repeat this process, follow these steps on your own machine:

```
git clone https://github.com/snowrider311/openvpn-otp
cd openvpn-otp/
./ubuntu_16.04_lts_build.sh
```

The `ubuntu_16.04_lts_build.sh` script will install all needed build dependencies, perform the build, and install the libraries to `/usr/lib/openvpn`.

If you then wish to create a Debian package, you can then run this script:

```
./ubuntu_16.04_lts_package.sh
```

That script will install [FPM](https://github.com/jordansissel/fpm) and then use it to build a Debian package. If you then run `sudo dpkg -i openvpn-otp-snowrider311_*_amd64.deb` (substitute the proper version number for the asterisk), then the libraries will be installed to `/usr/lib/openvpn`.

Note: Superuser privileges are required to run these scripts.


### Configuration

Add the following lines to your OpenVPN server configuration file to deploy OTP plugin with default settings. For OpenVPN <=2.3.x, use:

# use otp passwords with default settings (OpenVPN<=2.3.x syntax)
Expand Down
8 changes: 8 additions & 0 deletions ubuntu_16.04_lts_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#! /bin/bash

apt-get update
apt-get -y install openvpn autoconf libtool libssl-dev make
./autogen.sh
./configure --with-openvpn-plugin-dir=/usr/lib/openvpn --prefix=/usr
make
make install
12 changes: 12 additions & 0 deletions ubuntu_16.04_lts_package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#! /bin/bash

[[ -z "$TRAVIS_BUILD_NUMBER" ]] && ITERATION='1' || ITERATION="$TRAVIS_BUILD_NUMBER"

apt-get install -y ruby ruby-dev rubygems build-essential
gem install --no-ri --no-rdoc fpm

mkdir -p /tmp/openvpn-otp-build/usr/lib/openvpn
cp /usr/lib/openvpn/openvpn-otp.* /tmp/openvpn-otp-build/usr/lib/openvpn

fpm -s dir -C /tmp/openvpn-otp-build -t deb --name openvpn-otp-snowrider311 \
--version $PACKAGE_VERSION --iteration $ITERATION --depends openvpn