-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 TACACS+ Authentication #746
Changes from 4 commits
0fa3957
b23b0d0
a576065
92cc065
4d8fbbb
e394b92
02cc9f6
c5765f9
b2ae692
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,3 +66,9 @@ | |
[submodule "platform/broadcom/sonic-platform-modules-accton"] | ||
path = platform/broadcom/sonic-platform-modules-accton | ||
url = https://github.com/edge-core/sonic-platform-modules-accton.git | ||
[submodule "src/tacacs/sonic-pam-tacplus"] | ||
path = src/tacacs/sonic-pam-tacplus | ||
url = https://github.com/liuqu/sonic-pam-tacplus.git | ||
[submodule "src/tacacs/sonic-nss-tacplus"] | ||
path = src/tacacs/sonic-nss-tacplus | ||
url = https://github.com/liuqu/sonic-nss-tacplus.git | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you maintain this as a patch? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a NSS plugin for TACACS+. Do you mean to maintain it as a patch for pam-tacplus? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will think about how to change it as a patch to make. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Take https://github.com/Azure/sonic-buildimage/tree/master/src/initramfs-tools as an example. The patching method is recommended if your changes is small. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -158,6 +158,13 @@ sudo LANG=C chroot $FILESYSTEM_ROOT useradd -G sudo,docker $USERNAME -c "$DEFAUL | |
## Create password for the default user | ||
echo $USERNAME:$PASSWORD_ENCRYPTED | sudo LANG=C chroot $FILESYSTEM_ROOT chpasswd -e | ||
|
||
## Create remote user | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you explain why we need this remote user? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's used for user role map. If an authenticated user only exists in TACACS+ server database, not exists in local, it can't get passwd info without user role map. So I create remote user for TACACS+ user. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for your review.
|
||
## TODO: remote_user's login shell will be changed to cli shell. | ||
sudo LANG=C chroot $FILESYSTEM_ROOT useradd -G docker "remote_user" -u 1001 -g 999 -c \ | ||
"remote user" -d /home/remote_user -m -s /bin/rbash | ||
sudo LANG=C chroot $FILESYSTEM_ROOT useradd -G sudo,docker "remote_user_su" -u 1002 -g 1000 -c \ | ||
"remote sudo user" -d /home/remote_user_su -m -s /bin/bash | ||
|
||
## Pre-install hardware drivers | ||
sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install \ | ||
firmware-linux-nonfree | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,6 +89,16 @@ sudo cp -f $IMAGE_CONFIGS/bash/bash.bashrc $FILESYSTEM_ROOT/etc/ | |
sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/sonic-device-data_*.deb || \ | ||
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f | ||
|
||
# Install pam-tacplus | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it possible to capsulate the TACACS+ functionality into a docker container like docker-vas? It is not an easy job but technically feasible. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The pam_tacplus is only a dynamic library for Linux PAM module, and nss-tacplus is a dynamic library for Linux NSS module. I think there's no need to capsulate them into a docker container. |
||
sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/libtac2_1.4.1-1_amd64.deb | ||
sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/libpam-tacplus_1.4.1-1_amd64.deb | ||
|
||
# Install nss-tacplus | ||
sudo dpkg --root=$FILESYSTEM_ROOT -i target/debs/libnss-tacplus_1.0.3-1_amd64.deb | ||
|
||
# Copy aaa configuration files | ||
sudo cp -f $IMAGE_CONFIGS/aaa/aaa.json $FILESYSTEM_ROOT/etc/sonic/ | ||
|
||
# Copy crontabs | ||
sudo cp -f $IMAGE_CONFIGS/cron.d/* $FILESYSTEM_ROOT/etc/cron.d/ | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"debug": true, | ||
"src_ip": "", | ||
"authentication": { | ||
"login": { | ||
"pam_priority": [ | ||
"local" | ||
] | ||
} | ||
}, | ||
"tacacs_server_list": {}, | ||
"fail_through": false | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# libpam-tacplus packages | ||
|
||
PAM_TACPLUS_VERSION = 1.4.1-1 | ||
|
||
LIBTAC2 = libtac2_$(PAM_TACPLUS_VERSION)_amd64.deb | ||
$(LIBTAC2)_SRC_PATH = $(SRC_PATH)/tacacs/sonic-pam-tacplus | ||
SONIC_DPKG_DEBS += $(LIBTAC2) | ||
|
||
LIBPAM_TACPLUS = libpam-tacplus_$(PAM_TACPLUS_VERSION)_amd64.deb | ||
$(LIBPAM_TACPLUS)_RDEPENDS += $(LIBTAC2) | ||
$(LIBPAM_TACPLUS)_SRC_PATH = $(SRC_PATH)/tacacs/sonic-pam-tacplus | ||
SONIC_DPKG_DEBS += $(LIBPAM_TACPLUS) | ||
$(eval $(call add_derived_package,$(LIBTAC2),$(LIBPAM_TACPLUS))) | ||
|
||
LIBTAC_DEV = libtac-dev_$(PAM_TACPLUS_VERSION)_amd64.deb | ||
$(LIBTAC_DEV)_RDEPENDS += $(LIBTAC2) | ||
$(eval $(call add_derived_package,$(LIBTAC2),$(LIBTAC_DEV))) | ||
|
||
# libnss-tacplus packages | ||
|
||
NSS_TACPLUS_VERSION = 1.0.3-1 | ||
|
||
LIBNSS_TACPLUS = libnss-tacplus_$(NSS_TACPLUS_VERSION)_amd64.deb | ||
$(LIBNSS_TACPLUS)_DEPENDS += $(LIBTAC_DEV) | ||
$(LIBNSS_TACPLUS)_RDEPENDS += $(LIBTAC2) | ||
$(LIBNSS_TACPLUS)_SRC_PATH = $(SRC_PATH)/tacacs/sonic-nss-tacplus | ||
SONIC_DPKG_DEBS += $(LIBNSS_TACPLUS) | ||
$(eval $(call add_derived_package,$(LIBTAC2))) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can see only one patch is made. It is better maintian it as a patch, like what we did for libteam.
Can you follow that as an example?
https://github.com/Azure/sonic-buildimage/tree/master/src/libteam
ttps://github.com/liuqu/sonic-pam-tacplus/commit/6aab5b6cafb65763e297f99e889418677528cd35
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I will change it.