From 2a807c5d3ad933ae26232cad03a4c17304aac212 Mon Sep 17 00:00:00 2001 From: kawakami <44276443+Jnchi@users.noreply.github.com> Date: Mon, 6 May 2019 12:02:16 -0400 Subject: [PATCH 1/7] Create Dockerfile.ubuntu-18.04 --- Dockerfile.ubuntu-18.04 | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Dockerfile.ubuntu-18.04 diff --git a/Dockerfile.ubuntu-18.04 b/Dockerfile.ubuntu-18.04 new file mode 100644 index 0000000..d05f90a --- /dev/null +++ b/Dockerfile.ubuntu-18.04 @@ -0,0 +1,37 @@ +FROM ubuntu:18.04 + +RUN apt update && apt install -y \ + automake \ + build-essential \ + git \ + indent \ + libcurl4-openssl-dev \ + libjansson-dev \ + libjwt-dev \ + libpam0g-dev \ + libssl-dev \ + libtool \ + pkg-config \ + uuid-dev + +# 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/ + +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 From afe131455358ff974e71cb14bf9c75d702be790c Mon Sep 17 00:00:00 2001 From: kawakami <44276443+Jnchi@users.noreply.github.com> Date: Mon, 6 May 2019 12:04:09 -0400 Subject: [PATCH 2/7] Create Dockerfile.ubuntu-18.04 --- test/Dockerfile.ubuntu-18.04 | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 test/Dockerfile.ubuntu-18.04 diff --git a/test/Dockerfile.ubuntu-18.04 b/test/Dockerfile.ubuntu-18.04 new file mode 100644 index 0000000..fd2f1ba --- /dev/null +++ b/test/Dockerfile.ubuntu-18.04 @@ -0,0 +1,12 @@ +FROM cyberninjas/pam_aad:ubuntu-18.04 + +RUN apt update && apt install -y \ + gdb \ + openssh-server \ + pamtester \ + strace \ + syslog-ng \ + vim + +WORKDIR /usr/src/pam_aad +CMD ["make", "-eC", "test"] From 02a87c20e772404c9f4109b5a9ca4d012ccb69da Mon Sep 17 00:00:00 2001 From: kawakami <44276443+Jnchi@users.noreply.github.com> Date: Mon, 6 May 2019 13:04:28 -0400 Subject: [PATCH 3/7] Update .travis.yml --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 0a77770..d0a7eb1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 From 13476c95054945b62c0bcbdcf8acd6a4bccb373c Mon Sep 17 00:00:00 2001 From: kawakami <44276443+Jnchi@users.noreply.github.com> Date: Tue, 7 May 2019 11:17:36 -0400 Subject: [PATCH 4/7] Update Dockerfile.ubuntu-18.04 --- Dockerfile.ubuntu-18.04 | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/Dockerfile.ubuntu-18.04 b/Dockerfile.ubuntu-18.04 index d05f90a..f89c3ac 100644 --- a/Dockerfile.ubuntu-18.04 +++ b/Dockerfile.ubuntu-18.04 @@ -3,6 +3,9 @@ FROM ubuntu:18.04 RUN apt update && apt install -y \ automake \ build-essential \ + curl \ + debhelper \ + devscripts \ git \ indent \ libcurl4-openssl-dev \ @@ -12,21 +15,17 @@ RUN apt update && apt install -y \ libssl-dev \ libtool \ pkg-config \ + quilt \ uuid-dev -# 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 From 92c274287f21dd0c720aa1f8b1268c15d244c5fc Mon Sep 17 00:00:00 2001 From: kawakami <44276443+Jnchi@users.noreply.github.com> Date: Tue, 7 May 2019 11:19:12 -0400 Subject: [PATCH 5/7] Update Dockerfile --- Dockerfile | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index 06b4bc6..cff6338 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,6 +3,9 @@ FROM debian:9.7 RUN apt update && apt install -y \ automake \ build-essential \ + curl \ + debhelper \ + devscripts \ git \ indent \ libcurl4-openssl-dev \ @@ -11,6 +14,7 @@ RUN apt update && apt install -y \ libssl-dev \ libtool \ pkg-config \ + quilt \ uuid-dev WORKDIR /tmp @@ -18,19 +22,14 @@ 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 From c2123e1de98a0f115e721428a9277713aea8ef29 Mon Sep 17 00:00:00 2001 From: Lucas Ramage Date: Tue, 7 May 2019 16:05:28 +0000 Subject: [PATCH 6/7] Package for Debian/Ubuntu --- .gitignore | 6 ++++++ Dockerfile | 7 +++---- Dockerfile.ubuntu-18.04 | 7 +++---- debian/changelog | 5 +++++ debian/compat | 1 + debian/control | 20 ++++++++++++++++++++ debian/copyright | 10 ++++++++++ debian/docs | 1 + debian/libpam-aad.lintian-overrides | 2 ++ debian/rules | 10 ++++++++++ debian/source/format | 1 + debian/watch | 2 ++ 12 files changed, 64 insertions(+), 8 deletions(-) create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/docs create mode 100644 debian/libpam-aad.lintian-overrides create mode 100755 debian/rules create mode 100644 debian/source/format create mode 100644 debian/watch diff --git a/.gitignore b/.gitignore index 530760f..61df99f 100755 --- a/.gitignore +++ b/.gitignore @@ -277,3 +277,9 @@ libtool # Use git add -f to override test/* + +# Debian +debian/*.log +debian/.* +debian/files +debian/libpam-aad* diff --git a/Dockerfile b/Dockerfile index cff6338..bb32912 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,7 +34,6 @@ RUN curl -Lo sds_2.0.0.orig.tar.gz \ 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 -i'(.*)' && \ + dpkg -i ../libpam-aad_0.0.1-1_amd64.deb diff --git a/Dockerfile.ubuntu-18.04 b/Dockerfile.ubuntu-18.04 index f89c3ac..ef790b0 100644 --- a/Dockerfile.ubuntu-18.04 +++ b/Dockerfile.ubuntu-18.04 @@ -30,7 +30,6 @@ RUN curl -Lo sds_2.0.0.orig.tar.gz \ 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 -i'(.*)' && \ + dpkg -i ../libpam-aad_0.0.1-1_amd64.deb diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..948098a --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +pam-aad (0.0.1-1) UNRELEASED; urgency=medium + + * Initial release. + + -- Lucas Ramage Mon, 06 May 2019 19:15:25 +0000 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +9 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..b311859 --- /dev/null +++ b/debian/control @@ -0,0 +1,20 @@ +Source: pam-aad +Maintainer: Lucas Ramage +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. + . + diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..db978d8 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,10 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: pam_aad +Upstream-Contact: Lucas Ramage +Source: https://github.com/CyberNinjas/pam_aad + +Files: * +Copyright: 2016-2019 CyberNinjas +License: GPL-3+ + [LICENSE TEXT] + diff --git a/debian/docs b/debian/docs new file mode 100644 index 0000000..b43bf86 --- /dev/null +++ b/debian/docs @@ -0,0 +1 @@ +README.md diff --git a/debian/libpam-aad.lintian-overrides b/debian/libpam-aad.lintian-overrides new file mode 100644 index 0000000..1cb8a26 --- /dev/null +++ b/debian/libpam-aad.lintian-overrides @@ -0,0 +1,2 @@ +# GNU GPL covers only the Debian packaging +libpam-aad binary: possible-gpl-code-linked-with-openssl diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..f796dad --- /dev/null +++ b/debian/rules @@ -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 diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/debian/watch b/debian/watch new file mode 100644 index 0000000..ec3f16d --- /dev/null +++ b/debian/watch @@ -0,0 +1,2 @@ +version=3 +https://github.com/CyberNinjas/pam_aad/archive/([\d+\.]*).tar.gz From 153cd40022c8f60cab0791fd68695949a066f86a Mon Sep 17 00:00:00 2001 From: Lucas Ramage Date: Tue, 7 May 2019 17:45:41 +0000 Subject: [PATCH 7/7] Fix Debian dependencies --- Dockerfile | 12 +++++------- test/Dockerfile | 1 + test/Dockerfile.ubuntu-18.04 | 1 + 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index bb32912..40c2d35 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,8 @@ 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 \ @@ -10,6 +12,7 @@ RUN apt update && apt install -y \ indent \ libcurl4-openssl-dev \ libjansson-dev \ + libjwt-dev \ libpam0g-dev \ libssl-dev \ libtool \ @@ -17,11 +20,6 @@ RUN apt update && apt install -y \ 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 - 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 \ @@ -35,5 +33,5 @@ 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'(.*)' && \ + debuild -us -uc -d -i'(.*)' && \ dpkg -i ../libpam-aad_0.0.1-1_amd64.deb diff --git a/test/Dockerfile b/test/Dockerfile index fda35f4..85551ca 100644 --- a/test/Dockerfile +++ b/test/Dockerfile @@ -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"] diff --git a/test/Dockerfile.ubuntu-18.04 b/test/Dockerfile.ubuntu-18.04 index fd2f1ba..e4a9033 100644 --- a/test/Dockerfile.ubuntu-18.04 +++ b/test/Dockerfile.ubuntu-18.04 @@ -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"]