diff --git a/recipes-core/images/includes/nilrt-container.inc b/recipes-core/images/includes/nilrt-container.inc index 329843013..75966a275 100644 --- a/recipes-core/images/includes/nilrt-container.inc +++ b/recipes-core/images/includes/nilrt-container.inc @@ -18,12 +18,14 @@ IMAGE_INSTALL_NODEPS += "ni-arch-gen" # ni-sysapi-webservice provides the /nisysapi/server endpoint needed # for NI MAX connectivity. -# ni-auth is required by SystemWebServer (segfaults without niauth_daemon). # ni-system-webserver provides the web server for deployment and discovery # by NI MAX and VeriStand. # ni-webdav-system-webserver-support provides mod_nidav.so for WebDAV file # deployment (how VeriStand deploys .rtexe to /c). -IMAGE_INSTALL_NODEPS += "ni-sysapi-webservice ni-auth ni-system-webserver ni-webdav-system-webserver-support" +# NOTE: ni-auth has been intentionally removed from the default install. +# The root account is used instead of admin. ni-auth remains in the feeds +# and may still be pulled in as a transitive dependency of ni-system-webserver. +IMAGE_INSTALL_NODEPS += "ni-sysapi-webservice ni-system-webserver ni-webdav-system-webserver-support" # nirtmdnsd provides NI RT mDNS service for target discovery. IMAGE_INSTALL_NODEPS += "nirtmdnsd" diff --git a/recipes-core/images/includes/nilrt-proprietary.inc b/recipes-core/images/includes/nilrt-proprietary.inc index 0fb1e9852..7c75d9455 100644 --- a/recipes-core/images/includes/nilrt-proprietary.inc +++ b/recipes-core/images/includes/nilrt-proprietary.inc @@ -6,8 +6,6 @@ NI_PROPRIETARY_SAFEMODE_PACKAGES = "\ NI_PROPRIETARY_COMMON_PACKAGES = "\ libnitargetcfg \ - ni-auth \ - ni-auth-webservice \ ni-avahi-client \ ni-ca-certs \ ni-rt-exec-webservice \ diff --git a/recipes-core/packagegroups/packagegroup-ni-ptest-smoke.bb b/recipes-core/packagegroups/packagegroup-ni-ptest-smoke.bb index 9d900e8bc..e9bf1efdb 100644 --- a/recipes-core/packagegroups/packagegroup-ni-ptest-smoke.bb +++ b/recipes-core/packagegroups/packagegroup-ni-ptest-smoke.bb @@ -30,6 +30,7 @@ RDEPENDS:${PN}:append = "\ nettle-ptest \ ni-hw-scripts-ptest \ ni-test-boot-time-ptest \ + niauth-tests-ptest \ nilrt-snac-ptest \ opkg-ptest \ parted-ptest \ diff --git a/recipes-ni/niauth-tests/files/ptest-format.sh b/recipes-ni/niauth-tests/files/ptest-format.sh new file mode 100644 index 000000000..0ffe86847 --- /dev/null +++ b/recipes-ni/niauth-tests/files/ptest-format.sh @@ -0,0 +1,81 @@ +#!/bin/bash +# Version 1.3 +# Utility script containing common functions for ptest-compatible test scripts. +# USAGE: +# 1) Source this file at the top of your ptest script. +# 2) Set ptest_test to the name of your test; recommended: +# $(basename -s ".sh" "$0") +# 3) Define your subtests in functions, which call ptest_pass when they pass and +# ptest_fail otherwise (FAIL is DEFAULT) +# 4) Prior to calling your test function, call ptest_change_subtest +# 5) Call your test function. +# 6) Call ptest_report immediately after the function returns. + +exec 2>&1 # redirect all stderr to stdout to maintain ordering of output + +declare -irx PTEST_RC_PASS=0 +declare -irx PTEST_RC_FAIL=1 +declare -irx PTEST_RC_SKIP=77 + +function ptest_report () { + local result='FAIL' + case $ptest_rc in + 0) + result='PASS' + ;; + 77) + result='SKIP' + ;; + *) + result='FAIL' + ;; + esac + + if [ "$#" -gt 0 ]; then + echo "$@" + fi + + printf "${result}: %s" "${ptest_test}" + if [ -n "${ptest_subtest}" ]; then + printf " %d" "${ptest_subtest}" + if [ -n "${ptest_subtest_desc}" ]; then + printf " - %s" "${ptest_subtest_desc}" + fi + fi + printf "\n" +} + +function ptest_pass () { + ptest_rc=0 +} + +function ptest_skip () { + ptest_rc=77 +} + +function ptest_fail () { + ptest_rc=1 +} + +# 1 - new test name +# 2 - new subtest number +# 3 - new subtest description +function ptest_change_test () { + ptest_test="$1" + ptest_subtest="$2" + ptest_subtest_desc="$3" + ptest_fail +} + +# 1 - new subtest number +# 2 - new subtest description +function ptest_change_subtest () { + ptest_subtest="$1" + ptest_subtest_desc="$2" + ptest_fail +} + +ptest_test='' +ptest_subtest='' +ptest_subtest_desc='' +ptest_fail # set ptest_rc to FAIL diff --git a/recipes-ni/niauth-tests/files/run-ptest b/recipes-ni/niauth-tests/files/run-ptest new file mode 100644 index 000000000..5f00e2e1d --- /dev/null +++ b/recipes-ni/niauth-tests/files/run-ptest @@ -0,0 +1,5 @@ +#!/bin/bash + +./test_niauth_packages.sh + +exit 0 diff --git a/recipes-ni/niauth-tests/files/test_niauth_packages.sh b/recipes-ni/niauth-tests/files/test_niauth_packages.sh new file mode 100644 index 000000000..bb768b82d --- /dev/null +++ b/recipes-ni/niauth-tests/files/test_niauth_packages.sh @@ -0,0 +1,56 @@ +#!/bin/bash +# Verifies that ni-auth related packages are not installed. + +source "$(dirname "$0")/ptest-format.sh" + +ptest_test=$(basename "$0" ".sh") # test_niauth_packages + + +# TEST: ni-auth is not installed +function test_ni_auth_not_installed() { + ptest_pass + if opkg list-installed | grep -q "^ni-auth "; then + ptest_fail + fi +} + +# TEST: pam-plugin-niauth is not installed +function test_pam_plugin_niauth_not_installed() { + ptest_pass + if opkg list-installed | grep -q "^pam-plugin-niauth "; then + ptest_fail + fi +} + +# TEST: libnss-niauth is not installed +function test_libnss_niauth_not_installed() { + ptest_pass + if opkg list-installed | grep -q "^libnss-niauth "; then + ptest_fail + fi +} + +# TEST: ni-auth-networkcontroller is not installed +function test_ni_auth_networkcontroller_not_installed() { + ptest_pass + if opkg list-installed | grep -q "^ni-auth-networkcontroller "; then + ptest_fail + fi +} + + +ptest_change_subtest 1 "ni-auth not installed" +test_ni_auth_not_installed +ptest_report + +ptest_change_subtest 2 "pam-plugin-niauth not installed" +test_pam_plugin_niauth_not_installed +ptest_report + +ptest_change_subtest 3 "libnss-niauth not installed" +test_libnss_niauth_not_installed +ptest_report + +ptest_change_subtest 4 "ni-auth-networkcontroller not installed" +test_ni_auth_networkcontroller_not_installed +ptest_report diff --git a/recipes-ni/niauth-tests/niauth-tests.bb b/recipes-ni/niauth-tests/niauth-tests.bb new file mode 100644 index 000000000..dc30f8ec4 --- /dev/null +++ b/recipes-ni/niauth-tests/niauth-tests.bb @@ -0,0 +1,33 @@ +SUMMARY = "Ptests confirming ni-auth and niacctbase-sudo are not installed" +DESCRIPTION = "\ +Installs ptests that verify ni-auth and niacctbase-sudo packages are not \ +present on the system, as required by the SNAC configuration." + +SECTION = "tests" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" + +SRC_URI = "\ + file://run-ptest \ + file://ptest-format.sh \ + file://test_niauth_packages.sh \ +" + +S = "${UNPACKDIR}" + +inherit ptest + +do_install_ptest() { + install -m 0755 ${S}/run-ptest ${D}${PTEST_PATH} + install -m 0644 ${S}/ptest-format.sh ${D}${PTEST_PATH} + install -m 0755 ${S}/test_niauth_packages.sh ${D}${PTEST_PATH} +} + +ALLOW_EMPTY:${PN} = "1" + +# Only build the base (empty) and -ptest packages +PACKAGES:remove = "${PN}-dev ${PN}-staticdev ${PN}-dbg" + +RDEPENDS:${PN}-ptest:append = " bash opkg"