Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
08f2586
Merge pull request #23 from FirefighterBlu3/develop
FirefighterBlu3 Sep 4, 2021
d2d7966
Add missing import
abompard Sep 24, 2021
25b2f06
Merge pull request #24 from abompard/fix-setup.py
FirefighterBlu3 Sep 30, 2021
2c14501
make the verbosity print branch optional
FirefighterBlu3 Dec 3, 2021
a7008dd
Switch out things from Makefile rules, start putting everything in py…
FirefighterBlu3 Mar 11, 2022
72f4509
tidy up pam.py a bit. six.input moved to six.moves.input (a while ago…
FirefighterBlu3 Mar 14, 2022
0307e0b
reposition the conversation function (my_conv) so we're doing less li…
FirefighterBlu3 Mar 14, 2022
414ae39
and make the appropriate test_* units so we actually test branching i…
FirefighterBlu3 Mar 14, 2022
e91137a
remove setup.py, no longer used
FirefighterBlu3 Mar 14, 2022
99909fc
Merge pull request #29 from FirefighterBlu3/release/2.0.0
FirefighterBlu3 Mar 14, 2022
de17aa2
Fixes #31 by restoring the boolean return value and redeclares the do…
FirefighterBlu3 Mar 15, 2022
4a8e142
Create main.yml
FirefighterBlu3 Mar 15, 2022
d9a3bc2
install reqs
FirefighterBlu3 Mar 15, 2022
fb0ffd2
use only py310 for tox
FirefighterBlu3 Mar 15, 2022
5225964
debugging tox in gh-actions
FirefighterBlu3 Mar 15, 2022
f150e61
debugging tox in gh-actions
FirefighterBlu3 Mar 15, 2022
002e04a
Mock a few of the libpam interfaces so we can start fully testing all…
FirefighterBlu3 Mar 17, 2022
896894c
Merge pull request #32 from FirefighterBlu3/issue-31
FirefighterBlu3 Mar 17, 2022
af708cf
merge the issue-31 changes
FirefighterBlu3 Mar 18, 2022
c23e52e
resolve merge conflicts
FirefighterBlu3 Mar 18, 2022
80ae6db
Merge pull request #33 from FirefighterBlu3/develop-mocking-libpam
FirefighterBlu3 Mar 18, 2022
aa64482
update the version to 2.0.2
FirefighterBlu3 Mar 18, 2022
abd2714
Merge pull request #34 from FirefighterBlu3/fix-release-version-for-2…
FirefighterBlu3 Mar 18, 2022
2408c2e
add the pypi publish steps to the Makefile
FirefighterBlu3 Mar 18, 2022
c175bb8
Merge branch 'master' into develop
Nov 28, 2023
388d67e
Update gitignore
Nov 28, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions .coveragerc

This file was deleted.

25 changes: 25 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Python package

on: [push]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Tox test
run: |
tox -vv
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ __pycache__/
# Distribution / packaging
.Python
env/
.venv/
bin/
build/
develop-eggs/
Expand Down
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ submitted under the existing project license.

This project is switching to a git-flow style, please make pull requests
against the `develop` branch.

Good reading
* https://packaging.python.org/en/latest/tutorials/packaging-projects/
37 changes: 22 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
VIRTUALENV = $(shell which virtualenv)
PYTHONEXEC = python

VERSION = `grep VERSION version.py | cut -d \' -f2`
VERSION = `grep VERSION src/pam/version.py | cut -d \' -f2`

bandit: pydeps
. venv/bin/activate; bandit -r pam/
build: pydeps
python -m build

clean:
rm -rf *.egg-info/
Expand Down Expand Up @@ -34,28 +34,35 @@ deps:
. venv/bin/activate; python -m pip install --upgrade -qr requirements.txt

install: clean venv deps
. venv/bin/activate; python setup.py install
. venv/bin/activate; pip install --use-pep517 --progress-bar emoji

inspectortiger: pydeps
. venv/bin/activate; inspectortiger pam/
. venv/bin/activate; inspectortiger src/pam/

lint: pydeps
. venv/bin/activate; python -m flake8 pam/ --max-line-length=120
. venv/bin/activate; python -m flake8 src/pam/ --max-line-length=120

preflight: bandit coverage test
preflight: bandit test

pydeps:
. venv/bin/activate; pip install --upgrade -q pip; \
pip install --upgrade -q pip flake8 bandit \
pyre-check coverage pytest pytest-mock pytest-cov pytest-runner \
mock minimock faker responses
publish-pypi-test: clean venv build
. venv/bin/activate; \
python3 -m pip install --upgrade twine && \
python3 -m twine upload --repository testpypi dist/*

publish-pypi: clean venv build
. venv/bin/activate; \
python3 -m pip install --upgrade twine && \
python3 -m twine upload --repository pypi dist/*

test: pydeps deps venv lint
pydeps:
. venv/bin/activate; \
pytest tests -r w --capture=sys -vvv --cov; \
coverage html
pip install --upgrade -q pip && \
pip install --upgrade -q pip build

test: tox

tox:
rm -fr .tox
. venv/bin/activate; tox

venv:
Expand Down
1 change: 0 additions & 1 deletion pam/conftest.py

This file was deleted.

71 changes: 71 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
[build-system]
requires = [
'setuptools>=44',
'wheel>=0.30.0',
'six',
]
build-backend = 'setuptools.build_meta'

# ignore the tox documentation, it IS NOT supported yet
# https://github.com/tox-dev/tox/issues/2148
#[tox]
#isolated_build = true

[tool.tox]
legacy_tox_ini = """
[tox]
envlist = py310
isolated_build = true
#skipsdist = true

[gh-actions]
python =
3.7: py37
3.8: py38
3.9: py39
3.10: py310

[testenv]
basepython = python3.10
passenv = *
deps =
bandit
flake8
mypy
types-six
coverage
pytest-cov
pytest
-rrequirements.txt

commands =
flake8 src/pam/
mypy
bandit -r src -c "pyproject.toml"
pytest --cov -r w --capture=sys -vvv --cov-report=html
"""

[tool.bandit]
exclude_dirs = ["./venv", "./test", ]
recursive = true

[tool.mypy]
files = ["src/pam/__init__.py", "src/pam/__internals.py"]
ignore_missing_imports = true

[tool.pytest]
python_files = "test_*.py"
norecursedirs = ".tox"

[tool.coverage.run]
branch = true
# awkward how I can include "pam" but I have to be incredibly specific when omitting
source = ["pam"]
omit = ["*/pam/pam.py", "*/pam/version.py",]

[tool.coverage.html]
directory = "htmlcov"

[tool.coverage.report]
skip_empty = true
fail_under = 100
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
six
toml
44 changes: 44 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[metadata]
name = python-pam
version = attr: pam.version.VERSION
author = David Ford
author_email = [email protected]
description = Python PAM module using ctypes, py3
long_description = file: README.md
long_description_content_type = text/markdown
license = License :: OSI Approved :: MIT License
url = https://github.com/FirefighterBlu3/python-pam
project_urls =
Bug Tracker = https://github.com/FirefighterBlu3/python-pam/issues
classifiers =
Development Status :: 6 - Mature
Environment :: Plugins
Intended Audience :: Developers
Intended Audience :: Information Technology
Intended Audience :: System Administrators
License :: OSI Approved :: MIT License
Operating System :: POSIX
Operating System :: POSIX :: Linux
Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 3
Topic :: Security
Topic :: System :: Systems Administration :: Authentication/Directory

[options]
packages = find:
package_dir =
= src

[options.packages.find]
where = src

[sdist]
keep_temp = 1

[build_ext]
debug = 1

[flake8]
max-line-length = 120

40 changes: 0 additions & 40 deletions setup.py

This file was deleted.

14 changes: 11 additions & 3 deletions pam/__init__.py → src/pam/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,22 @@
__PA = None


def authenticate(*args, **kvargs):
def authenticate(username,
password,
service='login',
env=None,
call_end=True,
encoding='utf-8',
resetcreds=True,
print_failure_messages=False):
global __PA

if __PA is None: # pragma: no branch
__PA = PamAuthenticator()

return __PA.authenticate(*args, **kvargs)
return __PA.authenticate(username, password, service, env, call_end, encoding, resetcreds, print_failure_messages)


# legacy implementations used pam.pam()
pam = authenticate
pam = PamAuthenticator
authenticate.__doc__ = PamAuthenticator.authenticate.__doc__
Loading