Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TACACS+] Add Bash TACACS+ plugin for per-command authorization. #8715

Merged
merged 24 commits into from
Nov 13, 2021
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
00e9867
[TACACS+]: Add TACACS support library and fix memory leak issue.
liuh-80 Aug 31, 2021
7dcf307
Add Bash TACACS+ plugin.
liuh-80 Sep 9, 2021
fff5f0c
Improve code.
liuh-80 Sep 9, 2021
dcc782b
Fix code according to discussion and PR comments.
liuh-80 Sep 10, 2021
d90e0c8
Fix PR comments
liuh-80 Sep 10, 2021
b53c4f8
Improve code by PR comments.
liuh-80 Sep 16, 2021
22cfd79
Fix make file
Sep 16, 2021
8d70ebb
Merge remote-tracking branch 'origin/master' into dev/liuh/bash_tacplus
liuh-80 Sep 17, 2021
db26d95
Build package with dpkg-buildpackage
liuh-80 Sep 18, 2021
829b0df
Merge remote-tracking branch 'origin' into dev/liuh/bash_tacplus
liuh-80 Oct 29, 2021
cc496f4
Improve bash plugin code.
liuh-80 Oct 29, 2021
a729bb6
Fix parse /etc/tacplus_nss.conf issue. also fix server list not clean…
liuh-80 Oct 29, 2021
3bcd3c4
Fix some missing change caused by git history cleanup for PR review.
liuh-80 Oct 29, 2021
00be3e2
Fix PR comments.
liuh-80 Nov 4, 2021
6a89731
Improve patch file.
liuh-80 Nov 4, 2021
60d70b2
Add post-install script to update bash config file.
liuh-80 Nov 5, 2021
36af0f9
Merge remote-tracking branch 'origin' into dev/liuh/bash_tacplus
liuh-80 Nov 5, 2021
1e24fe8
Fix the bash plugin not installed issue.
liuh-80 Nov 10, 2021
5376bb1
Fix bash tacacs plugin build rule.
liuh-80 Nov 10, 2021
29bef8d
Fix make file issue.
liuh-80 Nov 10, 2021
5c9cd95
Change bash_tacplus build rule to SONIC_DPKG_DEBS because no need to …
liuh-80 Nov 10, 2021
7f3366b
Update patch file according PR comments.
liuh-80 Nov 10, 2021
d4e9e0c
Fix patched version of bash not installed issue.
liuh-80 Nov 11, 2021
9cba880
Fix parse debug flag in config file issue.
liuh-80 Nov 12, 2021
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
7 changes: 4 additions & 3 deletions ThirdPartyLicenses.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ This file provides information regarding components that are being relicensed to
Microsoft is offering you a license to use the following components, to the extent they are included within the Microsoft Azure Cross-Platform Command-Line Interface (the "Microsoft Program"), subject to the terms of your license to use the Microsoft Product. Insofar as a component is dual licensed under the GPL and a license that permits relicensing under proprietary terms, Microsoft neither took the code under the GPL nor distributes it thereunder but under the terms of the license that permits relicensing under proprietary terms, as set out below. All notices and licenses set forth below are for informational purposes only.

1. onie-mk-demo.sh, sharch_body.sh, install.sh imported and modified from ONIE versions 2014.11 and 2015.8 using GNU GENERAL PUBLIC LICENSE Version 2
2. src\tacacs\bash\bash_tacplus based on https://github.com/daveolson53/tacplus-auth project using GNU GENERAL PUBLIC LICENSE Version 2
liuh-80 marked this conversation as resolved.
Show resolved Hide resolved
liuh-80 marked this conversation as resolved.
Show resolved Hide resolved

/*
* ONIE is Free Software. You can redistribute ONIE and/or modify it
Expand Down Expand Up @@ -297,9 +298,9 @@ Microsoft is offering you a license to use the following components, to the exte
* END OF TERMS AND CONDITIONS
*/

2. union-fsck imported and modified from initramfs-tools version 0.91e (http://anonscm.debian.org/cgit/kernel/initramfs-tools.git/tag/?h=0.91e) using GPL v2 or any later version
3. union-fsck imported and modified from initramfs-tools version 0.91e (http://anonscm.debian.org/cgit/kernel/initramfs-tools.git/tag/?h=0.91e) using GPL v2 or any later version
liuh-80 marked this conversation as resolved.
Show resolved Hide resolved

3. boot0 imported from https://github.com/aristanetworks/sonic using GNU GENERAL PUBLIC LICENSE Version 3
4. boot0 imported from https://github.com/aristanetworks/sonic using GNU GENERAL PUBLIC LICENSE Version 3

/* GNU GENERAL PUBLIC LICENSE
* Version 3, 29 June 2007
Expand Down Expand Up @@ -977,7 +978,7 @@ Microsoft is offering you a license to use the following components, to the exte
* <http://www.gnu.org/philosophy/why-not-lgpl.html>.
*/

4. apt-clean, apt-gzip-indexes, apt-no-languages imported from docker v1.11.1
5. apt-clean, apt-gzip-indexes, apt-no-languages imported from docker v1.11.1
/*
* Apache License
* Version 2.0, January 2004
Expand Down
3 changes: 3 additions & 0 deletions files/build_templates/sonic_debian_extension.j2
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,9 @@ sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/libpam-tacplus_*.deb || \
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/libnss-tacplus_*.deb || \
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f
# Install bash-tacplus
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/bash-tacplus_*.deb || \
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f
# Disable tacplus by default
sudo LANG=C chroot $FILESYSTEM_ROOT pam-auth-update --remove tacplus
sudo sed -i -e '/^passwd/s/ tacplus//' $FILESYSTEM_ROOT/etc/nsswitch.conf
Expand Down
13 changes: 13 additions & 0 deletions rules/tacacs.mk
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@ $(LIBNSS_TACPLUS)_RDEPENDS += $(LIBTAC2)
$(LIBNSS_TACPLUS)_SRC_PATH = $(SRC_PATH)/tacacs/nss
SONIC_MAKE_DEBS += $(LIBNSS_TACPLUS)


# bash-tacplus packages
BASH_TACPLUS_VERSION = 1.0.0

export BASH_TACPLUS_VERSION

BASH_TACPLUS = bash-tacplus_$(BASH_TACPLUS_VERSION)_$(CONFIGURED_ARCH).deb
$(BASH_TACPLUS)_DEPENDS += $(LIBTAC_DEV)
$(BASH_TACPLUS)_RDEPENDS += $(LIBTAC2)
$(BASH_TACPLUS)_SRC_PATH = $(SRC_PATH)/tacacs/bash
liuh-80 marked this conversation as resolved.
Show resolved Hide resolved
SONIC_MAKE_DEBS += $(BASH_TACPLUS)


# The .c, .cpp, .h & .hpp files under src/{$DBG_SRC_ARCHIVE list}
# are archived into debug one image to facilitate debugging.
#
Expand Down
3 changes: 3 additions & 0 deletions src/tacacs/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
*
!.gitignore
bash/*
!bash/Makefile
!bash/bash_tacplus/*
nsm/*
!nsm/Makefile
!nsm/*.patch
Expand Down
25 changes: 25 additions & 0 deletions src/tacacs/bash/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.ONESHELL:
SHELL = /bin/bash
.SHELLFLAGS += -e

MAIN_TARGET = bash-tacplus_$(NSS_TACPLUS_VERSION)_$(CONFIGURED_ARCH).deb

$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
pushd ./bash_tacplus

# config source code
autoreconf
./configure
liuh-80 marked this conversation as resolved.
Show resolved Hide resolved

# build bash_tacplus
make
dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR)

# run UT after build package
make -C unittest && make test -C unittest

popd

mv $(DERIVED_TARGETS) $* $(DEST)/

$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET)
26 changes: 26 additions & 0 deletions src/tacacs/bash/bash_tacplus/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
###########################################################################
##
## File: ./Makefile.am
## Versions: $Id: Makefile.am,v 1.0 2021/08/24 12:04:29 liuh@microsoft.com Exp $
## Created: 2021/08/24
##
###########################################################################

ACLOCAL_AMFLAGS = -I config
AUTOMAKE_OPTIONS = subdir-objects

moduledir = @plugindir@
module_LTLIBRARIES = bash_tacplus.la
bash_tacplus_la_SOURCES = bash_tacplus.h \
bash_tacplus.c
bash_tacplus_la_CFLAGS = $(AM_CFLAGS) -I $(top_srcdir)/libtac/include
bash_tacplus_la_LDFLAGS = -module -avoid-version

EXTRA_DIST = bash_tacplus.spec

MAINTAINERCLEANFILES = Makefile.in config.h.in configure aclocal.m4 \
config/config.guess config/config.sub config/depcomp \
config/install-sh config/ltmain.sh config/missing

pkgconfigdir = $(libdir)/pkgconfig

Loading