Skip to content

Commit

Permalink
Create package for Debian/Ubuntu
Browse files Browse the repository at this point in the history
Bug: #32
Closes: #36
  • Loading branch information
Jnchi committed May 7, 2019
1 parent dd115b0 commit 0d4181c
Show file tree
Hide file tree
Showing 15 changed files with 128 additions and 22 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -277,3 +277,9 @@ libtool

# Use git add -f to override
test/*

# Debian
debian/*.log
debian/.*
debian/files
debian/libpam-aad*
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ script:
- docker build . -t cyberninjas/pam_aad
- docker build . -t cyberninjas/pam_aad:ami -f Dockerfile.ami
- docker build . -t cyberninjas/pam_aad:ami-2018.03 -f Dockerfile.ami-2018.03
- docker build . -t cyberninjas/pam_aad:ubuntu-18.04 -f Dockerfile.ubuntu-18.04
- docker build test -t cyberninjas/pam_aad:testing
- docker build test -t cyberninjas/pam_aad:testing-ami -f test/Dockerfile.ami
- docker build test -t cyberninjas/pam_aad:testing-ami-2018.03 -f test/Dockerfile.ami-2018.03
- docker build test -t cyberninjas/pam_aad:testing-ubuntu-18.04 -f test/Dockerfile.ubuntu-18.04
- docker run cyberninjas/pam_aad:testing
- docker run cyberninjas/pam_aad:testing-ami
- docker run cyberninjas/pam_aad:testing-ami-2018.03
- docker run cyberninjas/pam_aad:testing-ubuntu-18.04
40 changes: 18 additions & 22 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,41 +1,37 @@
FROM debian:9.7

RUN apt update && apt install -y \
RUN echo "deb http://http.us.debian.org/debian sid main" \
>> /etc/apt/sources.list && \
apt update && apt install -y \
automake \
build-essential \
curl \
debhelper \
devscripts \
git \
indent \
libcurl4-openssl-dev \
libjansson-dev \
libjwt-dev \
libpam0g-dev \
libssl-dev \
libtool \
pkg-config \
quilt \
uuid-dev

WORKDIR /tmp
RUN git clone https://github.com/benmcollins/libjwt && \
cd libjwt && git checkout tags/v1.10.1 && \
autoreconf -i && ./configure && make && make install

# See: https://github.com/antirez/sds/issues/97
WORKDIR /tmp
RUN git clone https://github.com/antirez/sds libsds && \
cd libsds && git checkout tags/2.0.0 && \
echo "typedef int sdsvoid;" >> sdsalloc.h && \
gcc -fPIC -fstack-protector -std=c99 -pedantic -Wall \
-Werror -shared -o libsds.so.2.0.0 -Wl,-soname=libsds.so.2.0.0 \
sds.c sds.h sdsalloc.h && \
cp -a libsds.so.2.0.0 /usr/local/lib/ && \
ln -s /usr/local/lib/libsds.so.2.0.0 /usr/local/lib/libsds.so && \
ln -s /usr/local/lib/libsds.so.2.0.0 /usr/local/lib/libsds.so.2 && \
ldconfig && mkdir -p /usr/local/include/sds && \
cp -a sds.h /usr/local/include/sds/
RUN curl -Lo sds_2.0.0.orig.tar.gz \
https://gitlab.com/oxr463/sds/-/archive/debian-2.0.0-1/sds-debian-2.0.0-1.tar.gz \
&& tar -xf sds_2.0.0.orig.tar.gz && \
mv sds-debian-2.0.0-1 sds-2.0.0 && \
cd sds-2.0.0 && debuild -us -uc && \
dpkg -i ../libsds2.0.0_2.0.0-1_amd64.deb && \
dpkg -i ../libsds-dev_2.0.0-1_amd64.deb

WORKDIR /usr/src/pam_aad
COPY . /usr/src/pam_aad

ENV PAMDIR "/lib/x86_64-linux-gnu/security"
RUN ./bootstrap.sh && \
./configure --with-pam-dir="${PAMDIR}" && \
make && make install
RUN tar cvzf ../pam-aad_0.0.1.orig.tar.gz --exclude='.git*' . && \
debuild -us -uc -d -i'(.*)' && \
dpkg -i ../libpam-aad_0.0.1-1_amd64.deb
35 changes: 35 additions & 0 deletions Dockerfile.ubuntu-18.04
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
FROM ubuntu:18.04

RUN apt update && apt install -y \
automake \
build-essential \
curl \
debhelper \
devscripts \
git \
indent \
libcurl4-openssl-dev \
libjansson-dev \
libjwt-dev \
libpam0g-dev \
libssl-dev \
libtool \
pkg-config \
quilt \
uuid-dev

WORKDIR /tmp
RUN curl -Lo sds_2.0.0.orig.tar.gz \
https://gitlab.com/oxr463/sds/-/archive/debian-2.0.0-1/sds-debian-2.0.0-1.tar.gz \
&& tar -xf sds_2.0.0.orig.tar.gz && \
mv sds-debian-2.0.0-1 sds-2.0.0 && \
cd sds-2.0.0 && debuild -us -uc && \
dpkg -i ../libsds2.0.0_2.0.0-1_amd64.deb && \
dpkg -i ../libsds-dev_2.0.0-1_amd64.deb

WORKDIR /usr/src/pam_aad
COPY . /usr/src/pam_aad

RUN tar cvzf ../pam-aad_0.0.1.orig.tar.gz --exclude='.git*' . && \
debuild -us -uc -i'(.*)' && \
dpkg -i ../libpam-aad_0.0.1-1_amd64.deb
5 changes: 5 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pam-aad (0.0.1-1) UNRELEASED; urgency=medium

* Initial release.

-- Lucas Ramage <[email protected]> Mon, 06 May 2019 19:15:25 +0000
1 change: 1 addition & 0 deletions debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9
20 changes: 20 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Source: pam-aad
Maintainer: Lucas Ramage <[email protected]>
Section: admin
Priority: optional
Standards-Version: 3.9.8
Build-Depends:
debhelper (>=9), libtool,
libcurl4-openssl-dev, libjansson-dev, libjwt-dev,
libpam0g-dev, libsds-dev, libssl-dev, pkg-config, uuid-dev
Vcs-Git: https://github.com/CyberNinjas/pam_aad.git
Vcs-Browser: https://github.com/CyberNinjas/pam_aad
Homepage: https://github.com/CyberNinjas/pam_aad

Package: libpam-aad
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, libpam-runtime (>= 1.0.1-6)
Description: Azure Active Directory PAM Module
This PAM module aims to provide Azure Active Directory authentication for Linux.
.

10 changes: 10 additions & 0 deletions debian/copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: pam_aad
Upstream-Contact: Lucas Ramage <[email protected]>
Source: https://github.com/CyberNinjas/pam_aad

Files: *
Copyright: 2016-2019 CyberNinjas <[email protected]>
License: GPL-3+
[LICENSE TEXT]

1 change: 1 addition & 0 deletions debian/docs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
README.md
2 changes: 2 additions & 0 deletions debian/libpam-aad.lintian-overrides
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# GNU GPL covers only the Debian packaging
libpam-aad binary: possible-gpl-code-linked-with-openssl
10 changes: 10 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/make -f

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

%:
dh $@

override_dh_auto_configure:
/bin/sh ./bootstrap.sh
dh_auto_configure -- --with-pam-dir=/lib/$(DEB_HOST_MULTIARCH)/security
1 change: 1 addition & 0 deletions debian/source/format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0 (quilt)
2 changes: 2 additions & 0 deletions debian/watch
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
version=3
https://github.com/CyberNinjas/pam_aad/archive/([\d+\.]*).tar.gz
1 change: 1 addition & 0 deletions test/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ RUN apt update && apt install -y \
syslog-ng \
vim

ENV PAMDIR "/lib/x86_64-linux-gnu/security"
WORKDIR /usr/src/pam_aad
CMD ["make", "-eC", "test"]
13 changes: 13 additions & 0 deletions test/Dockerfile.ubuntu-18.04
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM cyberninjas/pam_aad:ubuntu-18.04

RUN apt update && apt install -y \
gdb \
openssh-server \
pamtester \
strace \
syslog-ng \
vim

ENV PAMDIR "/lib/x86_64-linux-gnu/security"
WORKDIR /usr/src/pam_aad
CMD ["make", "-eC", "test"]

0 comments on commit 0d4181c

Please sign in to comment.