packages/admin/sudo/Makefile
Josef Schlehofer bee91a9d88 sudo: backport patches for CVE-2021-3156
This security vulnerability is known as Baron Samedit [1] and there is a
research by Qualys [2] and they discovered it. Unfortunately or
fortunately, there isn't present sudoedit on OpenWrt.

Two patches were applied cleanly and the other two required manual
intervention. Those were backported from version 1.9.5p2

[1] https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-3156
[2] https://blog.qualys.com/vulnerabilities-research/2021/01/26/cve-2021-3156-heap-based-buffer-overflow-in-sudo-baron-samedit

Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
2021-01-28 10:09:00 -10:00

101 lines
2.3 KiB
Makefile

#
# Copyright (C) 2006-2017 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=sudo
PKG_VERSION:=1.8.28p1
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://www.sudo.ws/dist
PKG_HASH:=23ba5a84af31e3b5ded58d4be6d3f6939a495a55561fba92c6941b79a6e8b027
PKG_MAINTAINER:=
PKG_LICENSE:=ISC
PKG_LICENSE_FILES:=doc/LICENSE
PKG_CPE_ID:=cpe:/a:todd_miller:sudo
PKG_BUILD_PARALLEL:=1
PKG_INSTALL:=1
PKG_BUILD_DEPENDS:=sudo/host
include $(INCLUDE_DIR)/package.mk
define Package/sudo
SECTION:=admin
CATEGORY:=Administration
TITLE:=Delegate authority to run commands
URL:=https://www.sudo.ws/
endef
define Package/sudo/description
Sudo (su "do") allows a system administrator to delegate authority to
give certain users (or groups of users) the ability to run some (or
all) commands as root or another user while providing an audit trail of
the commands and their arguments.
endef
define Package/sudo/conffiles
/etc/sudoers
/etc/sudoers.d/
endef
CONFIGURE_ARGS+= \
--without-pam \
--disable-pam-session \
--with-editor=/bin/vi \
--without-lecture \
--disable-zlib \
--with-rundir=/var/lib/sudo \
--with-vardir=/var/lib/sudo
CONFIGURE_VARS+= \
sudo_cv_uid_t_len=10 \
sudo_cv_func_unsetenv_void=no
include $(INCLUDE_DIR)/host-build.mk
define Host/Compile
cd $(HOST_BUILD_DIR)/lib/util; \
$(MAKE) mksiglist; $(MAKE) mksigname
endef
define Host/Install
$(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/bin
$(CP) $(HOST_BUILD_DIR)/lib/util/mksig{list,name} $(STAGING_DIR_HOSTPKG)/bin/
endef
$(eval $(call HostBuild))
define Package/sudo/install
$(INSTALL_DIR) $(1)/usr/bin
$(CP) $(PKG_INSTALL_DIR)/usr/bin/sudo $(1)/usr/bin/
chmod 4755 $(1)/usr/bin/sudo
$(INSTALL_DIR) $(1)/usr/sbin
$(CP) $(PKG_INSTALL_DIR)/usr/sbin/visudo $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/etc
$(CP) $(PKG_INSTALL_DIR)/etc/sudoers $(1)/etc/
chmod 0440 $(1)/etc/sudoers
$(INSTALL_DIR) $(1)/etc/sudoers.d
$(INSTALL_DIR) $(1)/usr/lib/sudo
$(CP) $(PKG_INSTALL_DIR)/usr/lib/sudo/*.so* $(1)/usr/lib/sudo/
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/sudo.init $(1)/etc/init.d/sudo
endef
define Package/sudo/postinst
#!/bin/sh
[ -n "$$IPKG_INSTROOT" ] || {
/etc/init.d/sudo enable
/etc/init.d/sudo start
}
endef
$(eval $(call BuildPackage,sudo))