Skip to content
Snippets Groups Projects
Commit 374e2df0 authored by Martin's avatar Martin
Browse files

Import Upstream version 1.4.1

parent d87376a6
No related branches found
No related tags found
No related merge requests found
Showing with 426 additions and 141 deletions
.coverage
*.egg-info
*.egg
*~
*.pyc
/build/
*.swp
*.swo
*.so
.tox
dist
gssapi/**/*.c
docs/build
__dont_use_cython__.txt
**/__pycache__
.eggs
.venv
#!/bin/sh
# build the docs
# the first run is for the docs build, so don't clean up
pip install -r docs-requirements.txt
# install dependencies so that sphinx doesn't have issues
# (this actually just installs the whole package in dev mode)
pip install -e .
# place in a non-standard location so that they don't get cleaned up
python setup.py build_sphinx --build-dir travis_docs_build
# for the tarball upload
# clean up
git clean -Xdf
# until this gets fixed in dpl
rm setuptools-*.zip
# make the dir
mkdir ./tag_build
# create and checksum the tarball
# no bashisms for portability
if [ x"${TRAVIS_TAG#v[0-9]}" = "x${TRAVIS_TAG}" ]; then
PYTHON_GSSAPI_VERSION=${TRAVIS_TAG}
else
PYTHON_GSSAPI_VERSION=${TRAVIS_TAG#v}
fi
PKG_NAME_VER="python-gssapi-${PYTHON_GSSAPI_VERSION}"
tar -czvf ./tag_build/${PKG_NAME_VER}.tar.gz --exclude='tag_build' --exclude='.git' --exclude='travis_docs_build' --exclude='.git' --transform "s,^\.,${PKG_NAME_VER}," .
sha512sum --binary ./tag_build/${PKG_NAME_VER}.tar.gz > ./tag_build/${PKG_NAME_VER}.sha512sum
#!/bin/sh -ex
pip install --install-option='--no-cython-compile' cython
pip install -r test-requirements.txt
sudo sed -i '1i 127.0.0.1 test.box' /etc/hosts
sudo hostname test.box
if [ x"$KRB5_VER" = "xheimdal" ]; then
sudo apt-get update
DEBIAN_FRONTEND=noninteractive sudo apt-get -y install heimdal-dev
exit 0
elif [ x"$KRB5_VER" != "x1.10" ]; then
sudo apt-add-repository -y ppa:sssd/updates
if [ x"$KRB5_VER" != "x1.12" ]; then
sudo apt-add-repository -y ppa:rharwood/krb5-$KRB5_VER
fi
fi
sudo apt-get update
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y krb5-user krb5-kdc krb5-admin-server libkrb5-dev krb5-multidev
DEBIAN_FRONTEND=noninteractive sudo apt-get -y install krb5-greet-client || true
sudo: required
# not necessary, but less confusing if defined
language: python
python:
- "2.7"
- "3.5"
services:
- docker
env:
- KRB5_VER="1.10"
- KRB5_VER="1.12"
- KRB5_VER="1.13"
# - KRB5_VER="master"
matrix:
exclude:
- python: "3.5"
env: KRB5_VER="1.10"
- DISTRO=debian:stable PYTHON="2"
- DISTRO=debian:stable PYTHON="3" # 3.4, not 3.5
- DISTRO=debian:stable PYTHON="3" KRB5_VER="heimdal"
- DISTRO=centos:7 PYTHON="2" # el7 doesn't do python3 modules
- DISTRO=fedora:rawhide PYTHON="3"
- DISTRO=fedora:rawhide PYTHON="2"
# we do everything in docker
install: skip
before_install: skip
stages:
- verify
- test
- name: deploy latest docs
if: (branch = master OR branch =~ ^infra/$) AND type = push
- name: deploy
if: tag is PRESENT
script:
- sudo sed -i '1i 127.0.0.1 test.box' /etc/hosts
- sudo hostname test.box
- source ./.travis/lib-util.sh
- util::docker-run $DISTRO ./.travis/build.sh
jobs:
include:
- python: "3.3"
env: KRB5_VER="1.12"
- python: "3.4"
env: KRB5_VER="1.13"
- python: "3.5"
env: KRB5_VER="heimdal"
- stage: verify
env: DISTRO=fedora:rawhide PYTHON="2"
script:
- source ./.travis/lib-util.sh
- util::docker-run $DISTRO ./.travis/verify.sh
install: sh -ex .travis.install.sh
- stage: verify
env: DISTRO=fedora:rawhide PYTHON="3"
script:
- source ./.travis/lib-util.sh
- util::docker-run $DISTRO ./.travis/verify.sh
script: sh -x .travis.sh
- stage: deploy latest docs
script: skip
env:
- DISTRO=fedora:rawhide
- PYTHON="3"
- secure: L5SpEj5+no20PWwC9Y/XNhAfmUvYiuykwSMa/YyqvUuBjdizzpZcHr7Ego5nMdM1TniTxj4pSTM+GbM0FHCzNmAINSRh9g/D3hheRqlRBacqR0XwC9ZZRvkKvtzwnLh4vYWiauq4AoDeR5U6tkEcay6LjE57iMQcLjcKYBc+Eos=
before_deploy:
- source ./.travis/lib-util.sh
- util::docker-run $DISTRO ./.travis/before-docs-deploy.sh
deploy:
- provider: script
script: .travis/docs-deploy.sh travis_docs_build/html latest pythongssapi/python-gssapi
skip_cleanup: true
on:
all_branches: true
- stage: deploy
script: skip
env:
- DISTRO=fedora:rawhide
- PYTHON="3"
- secure: L5SpEj5+no20PWwC9Y/XNhAfmUvYiuykwSMa/YyqvUuBjdizzpZcHr7Ego5nMdM1TniTxj4pSTM+GbM0FHCzNmAINSRh9g/D3hheRqlRBacqR0XwC9ZZRvkKvtzwnLh4vYWiauq4AoDeR5U6tkEcay6LjE57iMQcLjcKYBc+Eos=
before_deploy:
- source ./.travis/lib-util.sh
- util::docker-run $DISTRO ./.travis/before-deploy.sh
- ls -alR `pwd`
before_deploy: sh -x .travis.before-deploy.sh
deploy:
- provider: releases
api_key:
secure: U8RPR6liglI4J8MOSEyK9uxvSFRMcCkKLflpIFKcpUFg+PUuK85YtRdOOL/L/pifat9/KvoF7OJEMNTQjoYAhziMu8GGsiPZlkFzXNiy54FxTTtgprkhllRK7nw/jK/hopKM01goKVaUL860aU+KdpfStRTaAy8ZGEj13jwOMYU=
secure: fAaSSSjd/nUrIpINBjAT590pGF2nGq3I8ee6aGq6IAFpXoa/9eeN5eyOrE4MYucWCwYcH28c7510n35vuZQQor+UZIDo6l0K5M64/NZE1cZ43zOMjw3yHlrsJG+ohPS7YvjqD8GaFlLhF6ZvWvrPmWeijvs8qAT1eL7QoEG0xBk=
file_glob: true
file:
- tag_build/*
on:
repo: pythongssapi/python-gssapi
tags: true
python: "3.5"
condition: "$KRB5_VER = '1.13'"
skip_cleanup: true
on:
all_branches: true
- provider: pypi
user:
secure: gMwGf6Zt2BuPHN6Qy4feaJaZQBIYZ1lZIdFcpugyhnWtxytzwApx2LTXqHgdaVK7Ik6Xk97RmWS5SyciKmC2V1nyaHCX/f31QZAD3TrLqhScPtvE6j9j/srJhDBjp5yAT8NENMykeSvoIhiidw1tPzWYRW9c93roaOUv6Kqd3zc=
secure: "jUAMucBq+9xH8x9u0I0LOwrs3Zb++KN7FwIIwz2CyAt/+TyyrJzeGJaV+dTiJ1OqcUIFqQG6jopzpnAe4biL1O68PEwz9BphKetFLpLHiFNm/n67LYno6NFonWmxndIy99pOP6NZu29nzSNeYq/KgEHo/5OkqEGOxk//lh7X/OY="
password:
secure: D0lX+DRVac2GN3bZuKxd45DluBrcvwMfV+cciannEJ39kjbHTQEdpi0Uv92rDLNicjqyjy9rAEP7UAQQ1GDOvZcN5OG1+uWU1tSV84uKPgT92YbbQQdHRs/Rh3KSHKeaiJ+3TTDSeBuXYgWRs2gCeVAb18LBYjtIHLZxCFB8ln0=
on:
repo: pythongssapi/python-gssapi
tags: true
python: "3.5"
condition: "$KRB5_VER = '1.13'"
secure: "ZqywwnR+G5VeM2sStwfLeutOvqbULHtnStjrdYc8WcC/FBVwmH/W48fTlvxrnswmfKx7Eljv0nN4VcBpoFf1tvz4O2oK/tCRpf0N8SvpT0jBx8bLGUxJ1/3Po6rFgBRWgSb/mzKHPKI6fLlQNcNg8lrd9e1j/zgbVRSwNeMUOR8="
skip_cleanup: true
docs_dir: travis_docs_build/html
on:
all_branches: true
# NB(directxman12): this is a hack. Check ./.travis/before-deploy.sh for an explanation.
distributions: "check"
- provider: script
script: .travis/docs-deploy.sh travis_docs_build/html stable pythongssapi/python-gssapi
skip_cleanup: true
on:
all_branches: true
#!/bin/bash -ex
source ./.travis/lib-setup.sh
source ./.travis/lib-deploy.sh
# build again since I can't figure out how to get travis to recognize the old
# build in the new container. The other alternative (besides actually solving
# the issue) is to run the docs build and tarball generation every time.
./.travis/build.sh
setup::activate
yum -y install tar coreutils git
# build the docs
deploy::build-docs
# NB(directxman12): this is a *terrible* hack, but basically,
# dpl (the Travis deployer) uses `twine` instead of `setup.py sdist upload`.
# like this:
# - python setup.py $PYPI_DISTRIBUTIONS
# - twine upload -r pypi dist/*
# - [some other stuff]
#
# so if we set $PYPI_DISTRIBUTIONS to something harmless, like `check`,
# and then build the dist ourselves (and save it from the cleanup),
# dpl will upload that
# build the sdist
python setup.py sdist
mv dist dist_saved
# for the tarball upload
# clean up
git clean -Xdf
# restore the saved "dist" directory
mv dist_saved dist
# make the dir
rm -rf ./tag_build || true
mkdir ./tag_build
# create and checksum the tarball
if [ x"${TRAVIS_TAG#v[0-9]}" = "x${TRAVIS_TAG}" ]; then
PYTHON_GSSAPI_VERSION=${TRAVIS_TAG}
else
PYTHON_GSSAPI_VERSION=${TRAVIS_TAG#v}
fi
PKG_NAME_VER="python-gssapi-${PYTHON_GSSAPI_VERSION}"
tar -czvf ./tag_build/${PKG_NAME_VER}.tar.gz --exclude='dist' --exclude='tag_build' --exclude='.git' --exclude='travis_docs_build' --exclude='.git' --transform "s,^\.,${PKG_NAME_VER}," .
sha512sum --binary ./tag_build/${PKG_NAME_VER}.tar.gz > ./tag_build/${PKG_NAME_VER}.sha512sum
#!/bin/bash -ex
source ./.travis/lib-setup.sh
source ./.travis/lib-deploy.sh
# build again since I can't figure out how to get travis to recognize the old
# build in the new container. The other alternative (besides actually solving
# the issue) is to run the docs build and tarball generation every time.
./.travis/build.sh
setup::activate
deploy::build-docs
#!/bin/sh -x
#!/bin/bash -ex
# set up dependencies, etc
source ./.travis/lib-setup.sh
setup::install
# always build in-place so that Sphinx can find the modules
python setup.py build_ext --inplace
......@@ -14,20 +18,7 @@ if [ $BUILD_RES -ne 0 ]; then
exit $BUILD_RES
fi
flake8 setup.py
F8_SETUP=$?
flake8 gssapi
F8_PY=$?
flake8 gssapi --filename='*.pyx,*.pxd' --ignore=E225,E226,E227,E901,E402
F8_MAIN_CYTHON=$?
python setup.py nosetests --verbosity=3
TEST_RES=$?
if [ $F8_SETUP -eq 0 -a $F8_PY -eq 0 -a $F8_MAIN_CYTHON -eq 0 -a $TEST_RES -eq 0 ]; then
exit 0
else
exit 1
fi
exit $TEST_RES
#!/bin/bash -ex
# NB (very important): BE VERY CAREFUL WITH `set -x` FOR THIS FILE.
# The GitHub token is sensitive information, and should never
# be displayed on in the clear.
source_directory=${1?need <source dir> <target dir> <target repo> [<target branch, default: gh-pages>]}
target_directory=${2?need <source dir> <target dir> <target repo> [<target branch, default: gh-pages>]}
target_repo=${3?need <source dir> <target dir> <target repo> [<target branch, default: gh-pages>]}
target_branch=${4:-gh-pages}
desc=$(git describe --tags)
scratch_dir=$(mktemp -d)
set +x # IMPORTANT
echo "cloning https://<elided>@github.com/${target_repo}.git#${target_branch} in to ${scratch_dir}/docs..."
git clone https://${GITHUB_TOKEN}@github.com/${target_repo}.git ${scratch_dir}/docs -b ${target_branch}
set -x
mkdir -p ${scratch_dir}/docs/${target_directory}
cp -r ${source_directory}/. ${scratch_dir}/docs/${target_directory}
echo $desc > ${scratch_dir}/docs/${target_directory}/.from
pushd $scratch_dir/docs
git config user.email "deploy@travis-ci.org"
git config user.name "Deployment Bot (from Travis CI)"
if [[ $(git status --porcelain | wc -l) -eq 0 ]]; then
echo "no docs changes in the latest commit"
exit 0
fi
git add ${target_directory}
git commit -m "Update ${target_directory} docs in based on ${desc}"
set +x # IMPORTANT
echo "pushing to https://<elided>@github.com/${target_repo}.git#${target_branch}"
git push --quiet --force-with-lease origin ${target_branch}:${target_branch}
set -x
popd
rm -rf ${scratch_dir}
echo "done!"
deploy::build-docs() {
# the first run is for the docs build, so don't clean up
pip install -r docs-requirements.txt
# install dependencies so that sphinx doesn't have issues
# (this actually just installs the whole package in dev mode)
pip install -e .
# place in a non-standard location so that they don't get cleaned up
python setup.py build_sphinx --build-dir travis_docs_build
echo "travis_docs_build"
}
#!/bin/bash
setup::python-suffix() {
if [ x"$PYTHON" = "x3" ]; then
echo "3"
else
echo ""
fi
}
# We test Debian's cython. el7's cython is too old, and Rawhide's virtualenv
# doesn't work right (usrmerge bugs) so we can only test Debian's cython.
setup::debian::install() {
local IS3=$(setup::python-suffix)
export DEBIAN_FRONTEND=noninteractive
apt-get update
if [ x"$KRB5_VER" = "xheimdal" ]; then
apt-get -y install heimdal-dev
else
apt-get -y install krb5-{user,kdc,admin-server,multidev} libkrb5-dev
fi
apt-get -y install gcc virtualenv python$IS3-{virtualenv,dev} cython$IS3
virtualenv --system-site-packages -p $(which python${PYTHON}) .venv
source ./.venv/bin/activate
}
setup::rh::yuminst() {
# yum has no update-only verb
yum -y --nogpgcheck install $@
}
setup::centos::install() {
local IS3=$(setup::python-suffix)
# Cython on el7 is too old - downstream patches
setup::rh::yuminst python$IS3-{virtualenv,devel}
virtualenv -p $(which python$IS3) .venv
source ./.venv/bin/activate
pip install --upgrade pip # el7 pip doesn't quite work right
pip install --install-option='--no-cython-compile' cython
}
setup::fedora::install() {
# path to binary here in case Rawhide changes it
setup::rh::yuminst redhat-rpm-config \
/usr/bin/virtualenv python${PYTHON}-{virtualenv,devel}
virtualenv -p $(which python${PYTHON}) .venv
source ./.venv/bin/activate
pip install --install-option='--no-cython-compile' cython
}
setup::rh::install() {
setup::rh::yuminst krb5-{devel,libs,server,workstation} which gcc findutils
if [ -f /etc/fedora-release ]; then
setup::fedora::install
else
setup::centos::install
fi
}
setup::install() {
if [ -f /etc/debian_version ]; then
setup::debian::install
elif [ -f /etc/redhat-release ]; then
setup::rh::install
else
echo "Distro not found!"
false
fi
pip install -r test-requirements.txt
}
setup::activate() {
# remove (and restore) set -x to avoid log-spam the source
# script, which we don't care about
wastrace=${-//[^x]/}
set +x
source .venv/bin/activate
if [[ -n "$wastrace" ]]; then set -x; fi
}
#!/bin/bash
util::docker-run() {
local distro=$1
shift
docker run \
-v `pwd`:/tmp/build \
-w /tmp/build \
-e TRAVIS_TAG=$TRAVIS_TAG \
-e PKG_NAME_VER=$PKG_NAME_VER \
-e KRB5_VER=$KRB5_VER \
-e PYTHON=$PYTHON \
$distro \
/bin/bash -ex $@
}
#!/bin/bash
verify::flake8() {
flake8 setup.py
F8_SETUP=$?
flake8 gssapi
F8_PY=$?
# Cython requires special flags since it is not proper Python
# E225: missing whitespace around operator
# E226: missing whitespace around arithmetic operator
# E227: missing whitespace around bitwise or shift operator
# E402: module level import not at top of file (needed for the `GSSAPI="blah" lines)
# E901: SyntaxError or IndentationError
# E999: Internal AST compilation error (flake8 specific)
flake8 gssapi --filename='*.pyx,*.pxd' --ignore=E225,E226,E227,E402,E901,E999
F8_MAIN_CYTHON=$?
if [ $F8_SETUP -eq 0 -a $F8_PY -eq 0 -a $F8_MAIN_CYTHON -eq 0 ]; then
return 0
else
return 1
fi
}
#!/bin/bash -ex
# set up dependencies, etc
source ./.travis/lib-setup.sh
setup::install
source ./.travis/lib-verify.sh
verify::flake8
### What went wrong?
### How do we reproduce?
*(Remember to use fenced code blocks and consider placing in a gist if large)*
### Component versions (python-gssapi, Kerberos, OS / distro, etc.)
*(Please include MIT/Heimdal/etc. and how you installed python-gssapi)*
./README.txt
\ No newline at end of file
python-gssapi-1.4.1/README.txt
\ No newline at end of file
......@@ -21,8 +21,12 @@ Python-GSSAPI provides both low-level and high level wrappers around the GSSAPI
C libraries. While it focuses on the Kerberos mechanism, it should also be
useable with other GSSAPI mechanisms.
Documentation for the latest released version can be found at
`https://pythonhosted.org/gssapi <https://pythonhosted.org/gssapi>`_.
Documentation for the latest released version (including pre-release versions)
can be found at
`https://pythongssapi.github.io/python-gssapi/stable <https://pythongssapi.github.io/python-gssapi/stable>`_.
Documentation for the latest commit on master can be found at
`https://pythongssapi.github.io/python-gssapi/latest <https://pythongssapi.github.io/python-gssapi/latest>`_.
Requirements
============
......@@ -136,6 +140,8 @@ Extensions
In addition to RFC 2743/2744, Python-GSSAPI also has support for:
* RFC 5587 (Extended GSS Mechanism Inquiry APIs)
* RFC 5588 (GSS-API Extension for Storing Delegated Credentials)
* (Additional) Credential Store Extension
......
Sphinx >= 1.3.1
sphinx-rtd-theme >= 0.1.9
sphinx-rtd-theme >= 0.2.5b1
sphinxcontrib-napoleon >= 0.2.8
recommonmark >= 0.4.0
......@@ -48,7 +48,8 @@ class RequiresExtRole(object):
title_node = nodes.Text(ext_title, ext_title)
ref_nodes[0].children = [title_node]
ref_nodes[0].clear()
ref_nodes[0].append(title_node)
middle_parts = ref_nodes
......
......@@ -21,9 +21,10 @@ for later:
>>>
Note that this assumes you have a KRB5 realm set up, and some relevant
functions available in the `REALM` object (see gssapi-console.py, or
functions available in the `REALM` object (see gssapi-console.py in
[gssapi_console](https://pypi.python.org/pypi/gssapi_console)), or
try `$ run-lit -e gssapi basic-tutorial.md` when you have both
gssapi-console and yalpt installed). Any actions performed using the
gssapi_console and yalpt installed). Any actions performed using the
`REALM` object are not part of the GSSAPI library; the `REALM` object
simply contians wrappers to krb5 commands generally run separately from
the application using GSSAPI.
......@@ -42,12 +43,12 @@ Suppose we wanted to refer to an HTTP server on the current host.
We could refer to it as a *host-based service*, or in the default
mechanism form (in this case, for krb5):
>>> server_hostbased_name = gssapi.Name('http@' + FQDN, name_type=gssapi.NameType.hostbased_service)
>>> server_hostbased_name = gssapi.Name('HTTP@' + FQDN, name_type=gssapi.NameType.hostbased_service)
>>> server_hostbased_name
Name(b'http@sross', <OID 1.2.840.113554.1.2.1.4>)
>>> server_name = gssapi.Name('http/sross@')
Name(b'HTTP@sross', <OID 1.2.840.113554.1.2.1.4>)
>>> server_name = gssapi.Name('HTTP/sross@')
>>> server_name
Name(b'http/sross@', None)
Name(b'HTTP/sross@', None)
>>>
These are both effectively the same, but if we *canonicalize* both
......@@ -74,11 +75,11 @@ Credentials may be acquired for a particular name, or the default set
of credentials may be acquired.
For instance, suppose that we are writing a server, and wish to
communicate accept connections as the 'http' service. We would need
communicate accept connections as the 'HTTP' service. We would need
to acquire credentials as such:
>>> REALM.addprinc('http/%s@%s' % (FQDN, REALM.realm))
>>> REALM.extract_keytab('http/%s@%s' % (FQDN, REALM.realm), REALM.keytab)
>>> REALM.addprinc('HTTP/%s@%s' % (FQDN, REALM.realm))
>>> REALM.extract_keytab('HTTP/%s@%s' % (FQDN, REALM.realm), REALM.keytab)
>>> server_creds = gssapi.Credentials(usage='accept', name=server_name)
>>>
......@@ -205,9 +206,9 @@ since the context was set up to use encryption (the default):
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<string>", line 2, in decrypt
File "/home/directxman12/dev/gssapi/gssapi-console/.venv/lib/python3.4/site-packages/gssapi/_utils.py", line 167, in check_last_err
File "/usr/lib/python3.4/site-packages/gssapi/_utils.py", line 167, in check_last_err
return func(self, *args, **kwargs)
File "/home/directxman12/dev/gssapi/gssapi-console/.venv/lib/python3.4/site-packages/gssapi/sec_contexts.py", line 295, in decrypt
File "/usr/lib/python3.4/site-packages/gssapi/sec_contexts.py", line 295, in decrypt
unwrapped_message=res.message)
gssapi.exceptions.EncryptionNotUsed: Confidentiality was requested, but not used: The context was established with encryption, but unwrapped message was not encrypted.
>>>
......
......@@ -58,9 +58,9 @@ copyright = u'2014, The Python-GSSAPI team'
# built documents.
#
# The short X.Y version.
version = '1.2.0'
version = '1.4.1'
# The full version, including alpha/beta/rc tags.
release = '1.2.0'
release = '1.4.1'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment