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