From 0030d444d320f86b5cc3553b75d54b1f01e1b9ff Mon Sep 17 00:00:00 2001 From: Michael Howe Date: Tue, 19 May 2020 17:40:33 +0100 Subject: [PATCH] Initial packaging of Lemonldap::NG::Portal::Auth::My::Kerberos --- Build.PL | 6 ++ debian/README | 6 ++ debian/changelog | 5 ++ debian/compat | 1 + debian/control | 17 ++++++ debian/copyright | 34 ++++++++++++ debian/rules | 25 +++++++++ debian/source/format | 1 + lib/Lemonldap/NG/Portal/Auth/My/Kerberos.pm | 61 +++++++++++++++++++++ 9 files changed, 156 insertions(+) create mode 100644 Build.PL create mode 100644 debian/README create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100755 debian/rules create mode 100644 debian/source/format create mode 100644 lib/Lemonldap/NG/Portal/Auth/My/Kerberos.pm diff --git a/Build.PL b/Build.PL new file mode 100644 index 0000000..d64e84b --- /dev/null +++ b/Build.PL @@ -0,0 +1,6 @@ +use Module::Build; +my $build = Module::Build->new( + module_name => 'Lemonldap::NG::Portal::Auth::My::Kerberos', + license => 'perl', +); +$build->create_build_script; diff --git a/debian/README b/debian/README new file mode 100644 index 0000000..cfc0058 --- /dev/null +++ b/debian/README @@ -0,0 +1,6 @@ +The Debian Package liblemonldap-ng-portal-auth-my-kerberos-perl +---------------------------- + +This package contains the custom authentication portal code for lemonldap-ng + + -- Michael Howe Tue, 19 May 2020 16:13:11 +0100 diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..a39b77b --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +liblemonldap-ng-portal-auth-my-kerberos-perl (1.0~test.0) unstable; urgency=medium + + * Initial Release. + + -- Michael Howe Tue, 19 May 2020 16:13:11 +0100 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..b4de394 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +11 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..c39045a --- /dev/null +++ b/debian/control @@ -0,0 +1,17 @@ +Source: liblemonldap-ng-portal-auth-my-kerberos-perl +Section: perl +Priority: optional +Maintainer: Michael Howe +Build-Depends: debhelper (>= 11) +Build-Depends-Indep: perl (>= 5.10.0), libmodule-build-perl +Standards-Version: 4.1.3 +#Vcs-Browser: https://salsa.debian.org/debian/liblemonldap-ng-portal-auth-my-kerberos-perl +#Vcs-Git: https://salsa.debian.org/debian/liblemonldap-ng-portal-auth-my-kerberos-perl.git + +Package: liblemonldap-ng-portal-auth-my-kerberos-perl +Architecture: all +Depends: ${misc:Depends}, ${perl:Depends}, liblemonldap-ng-portal-perl, libauthen-krb5-simple-perl +Description: Custom Kerberos class for lemonldap-ng + This package provides a custom Kerberos class for liblemonldap-ng. + . + It allows GSSAPI authentication. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..7a84511 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,34 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: liblemonldap-ng-portal-auth-my-kerberos-perl +Source: + +Files: * +Copyright: + +License: GPL-3.0+ + +Files: debian/* +Copyright: 2020 Michael Howe +License: GPL-3.0+ + +License: GPL-3.0+ + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + . + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this program. If not, see . + . + On Debian systems, the complete text of the GNU General + Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". + +# Please also look if there are files or directories which have a +# different copyright/license attached and list them here. +# Please avoid picking licenses with terms that are more restrictive than the +# packaged work, as it may make Debian's contributions unacceptable upstream. diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..e1c367c --- /dev/null +++ b/debian/rules @@ -0,0 +1,25 @@ +#!/usr/bin/make -f +# See debhelper(7) (uncomment to enable) +# output every command that modifies files on the build system. +#export DH_VERBOSE = 1 + + +# see FEATURE AREAS in dpkg-buildflags(1) +#export DEB_BUILD_MAINT_OPTIONS = hardening=+all + +# see ENVIRONMENT in dpkg-buildflags(1) +# package maintainers to append CFLAGS +#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic +# package maintainers to append LDFLAGS +#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed + + +%: + dh $@ + + +# dh_make generated override targets +# This is example for Cmake (See https://bugs.debian.org/641051 ) +#override_dh_auto_configure: +# dh_auto_configure -- # -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH) + diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..89ae9db --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (native) diff --git a/lib/Lemonldap/NG/Portal/Auth/My/Kerberos.pm b/lib/Lemonldap/NG/Portal/Auth/My/Kerberos.pm new file mode 100644 index 0000000..0769299 --- /dev/null +++ b/lib/Lemonldap/NG/Portal/Auth/My/Kerberos.pm @@ -0,0 +1,61 @@ +package Lemonldap::NG::Portal::Auth::My::Kerberos; + +use strict; +use Mouse; +use Authen::Krb5::Simple; +#use Data::Dumper; +use Lemonldap::NG::Portal::Main::Constants qw( + PE_BADCREDENTIALS + PE_ERROR + PE_OK +); + +#extends qw(Lemonldap::NG::Portal::Main::Auth); +extends qw(Lemonldap::NG::Portal::Auth::_WebForm); + +our $VERSION = '1.0.0'; + +# INITIALIZATION + +# RUNNING METHODS + +sub init { + my $self = shift; + return $self->Lemonldap::NG::Portal::Auth::_WebForm::init(); +} +#sub extractFormInfo { +# return PE_OK; +#} + +sub authenticate { + my ( $self, $req ) = @_; + +# $self->userLogger->error( Dumper( $req ) ); + my $krb5 = Authen::Krb5::Simple->new(); + my $authen = $krb5->authenticate( $req->{user}, $req->data->{password} ); + + if( $authen ){ +# $req->user( $req->{user} ); + $self->userLogger->notice("Good Kerberos authentication for $req->{user}"); + return PE_OK; + } else { + $self->userLogger->error("Kerberos authentication for $req->{user} failed: " . $krb5->errstr()); + return PE_BADCREDENTIALS; + } +} + +sub setAuthSessionInfo { + my ( $self, $req ) = @_; + $req->sessionInfo->{authenticationLevel} = 2; + PE_OK; +} + +sub authLogout { + PE_OK; +} + +#sub getDisplayType { +# return 1; +#} +1; + -- 2.39.5