1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: Apache-2.0
5 # These tests assume you have a real API server running on the docker host.
7 # Build the test container:
8 # First, replace 3000 below with your api server's port number if necessary.
9 # host$ python setup.py sdist rotate --keep=1 --match .tar.gz
10 # host$ docker build --tag=arvados/pam_test .
12 # Automated integration test:
13 # host$ docker run -it --add-host zzzzz.arvadosapi.com:"$(hostname -I |awk '{print $1}')" arvados/pam_test
14 # You should see "=== OK ===", followed by a Perl stack trace due to a
15 # yet-unidentified pam_python.so bug.
17 # Manual integration test:
18 # host$ docker run -it --add-host zzzzz.arvadosapi.com:"$(hostname -I |awk '{print $1}')" arvados/pam_test bash -c 'rsyslogd & tail -F /var/log/auth.log & sleep 1 & bash'
21 # Arvados API token: 3kg6k6lzmp9kj5cpkcoxie963cmvjahbt2fod9zru30k1jqdmi
22 # You should now be logged in to the "active" shell account in the
23 # container. You should also see arvados_pam log entries in
24 # /var/log/auth.log (and in your terminal, thanks to "tail -F").
28 RUN apt-get -qy dist-upgrade
29 RUN apt-get -qy install python python-virtualenv libpam-python rsyslog
30 # Packages required by pycurl, ciso8601
31 RUN apt-get -qy install libcurl4-gnutls-dev python2.7-dev
33 # for jessie (which also has other snags)
34 # RUN apt-get -qy install python-pip libgnutls28-dev
36 RUN pip install --upgrade setuptools
37 RUN pip install python-pam
39 RUN pip install /dist/arvados-pam-*.tar.gz
41 # Configure and enable the module (hopefully vendor packages will offer a neater way)
42 RUN perl -pi -e 's{api.example}{zzzzz.arvadosapi.com:3000}; s{shell\.example}{testvm2.shell insecure};' /usr/share/pam-configs/arvados
43 RUN DEBIAN_FRONTEND=noninteractive pam-auth-update arvados --remove unix
45 # Add a user account matching the fixture
46 RUN useradd -ms /bin/bash active
48 # Test with python (SIGSEGV during tests)
51 #CMD rsyslogd & tail -F /var/log/auth.log & python setup.py test --test-suite integration_tests
53 # Test with perl (SIGSEGV when program exits)
54 RUN apt-get install -qy libauthen-pam-perl
55 ADD tests/integration_test.pl /integration_test.pl
56 CMD rsyslogd & tail -F /var/log/auth.log & sleep 1 && /integration_test.pl