From owner-svn-ports-head@freebsd.org Fri Jun 14 13:50:27 2019 Return-Path: Delivered-To: svn-ports-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3275315D04DB; Fri, 14 Jun 2019 13:50:27 +0000 (UTC) (envelope-from ler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C80C96C28D; Fri, 14 Jun 2019 13:50:26 +0000 (UTC) (envelope-from ler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 997D918A04; Fri, 14 Jun 2019 13:50:26 +0000 (UTC) (envelope-from ler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5EDoQxE077572; Fri, 14 Jun 2019 13:50:26 GMT (envelope-from ler@FreeBSD.org) Received: (from ler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5EDoQDf077570; Fri, 14 Jun 2019 13:50:26 GMT (envelope-from ler@FreeBSD.org) Message-Id: <201906141350.x5EDoQDf077570@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ler set sender to ler@FreeBSD.org using -f From: Larry Rosenman Date: Fri, 14 Jun 2019 13:50:26 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r504192 - in head/sysutils/google-compute-engine-oslogin: . files X-SVN-Group: ports-head X-SVN-Commit-Author: ler X-SVN-Commit-Paths: in head/sysutils/google-compute-engine-oslogin: . files X-SVN-Commit-Revision: 504192 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C80C96C28D X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.959,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jun 2019 13:50:27 -0000 Author: ler Date: Fri Jun 14 13:50:25 2019 New Revision: 504192 URL: https://svnweb.freebsd.org/changeset/ports/504192 Log: sysutils/google-compute-engine-oslogin: fix OSLogin Larry Rosenman and Glen Barber from the FreeBSD team reported that the OSLogin feature has not been working since the last update I made to sysutils/google-compute-engine-oslogin ports package. I found out that the problem is in some modifications made by upstream in the shell script responsible to activate and deactivate the feature. I prepared the attached patch to fix it. With the patch applied in a FreeBSD 13 instance on GCE I was able to use the OSLogin feature without any problem. I also sent this same patch upstream. PR: 238561 Submitted by: lucas.kanashiro@collabora.com (maintainer) Added: head/sysutils/google-compute-engine-oslogin/files/ head/sysutils/google-compute-engine-oslogin/files/patch-bin_google__oslogin__control (contents, props changed) Modified: head/sysutils/google-compute-engine-oslogin/Makefile Modified: head/sysutils/google-compute-engine-oslogin/Makefile ============================================================================== --- head/sysutils/google-compute-engine-oslogin/Makefile Fri Jun 14 13:32:16 2019 (r504191) +++ head/sysutils/google-compute-engine-oslogin/Makefile Fri Jun 14 13:50:25 2019 (r504192) @@ -2,6 +2,7 @@ PORTNAME= google-compute-engine-oslogin DISTVERSION= 1.5.3 +PORTREVISION= 1 CATEGORIES= sysutils MAINTAINER= lucas.kanashiro@collabora.com Added: head/sysutils/google-compute-engine-oslogin/files/patch-bin_google__oslogin__control ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/google-compute-engine-oslogin/files/patch-bin_google__oslogin__control Fri Jun 14 13:50:25 2019 (r504192) @@ -0,0 +1,103 @@ +--- bin/google_oslogin_control.orig 2019-06-14 12:36:44 UTC ++++ bin/google_oslogin_control +@@ -154,6 +154,7 @@ modify_pam_config() ( + pam_account_oslogin="account optional pam_oslogin_admin.so" + pam_account_admin="account requisite pam_oslogin_login.so" + pam_session_homedir="session optional pam_mkhomedir.so" ++ pam_account_su="account optional pam_oslogin_login.so" + fi + + local added_config="" +@@ -201,6 +202,11 @@ modify_pam_config() ( + # Get location of system-remote-login. + insert=$($sed -rn "/^auth\s+include\s+system-remote-login/=" "$pam_sshd_config") + # TODO: find su_insert point for arch linux. ++ elif is_freebsd; then ++ # Get location of the first auth occurrence. ++ insert=$($sed -rn '/^auth/=' "$pam_sshd_config" | head -1) ++ # Get location of the first account occurrence. ++ su_insert=$($sed -rn '/^account/=' "$pam_su_config" | head -1) + fi + + added_config="$added_comment" +@@ -223,7 +229,7 @@ modify_pam_config() ( + # Insert su blocker at top of `su:account` stack. + if [ -n "$su_insert" ] && ! grep -qE "$pam_account_su" "$pam_su_config"; then + added_su_config="${added_comment}\n${pam_account_su}" +- sed -i"" "${su_insert}i ${added_su_config}" "$pam_su_config" ++ $sed -i"" "${su_insert}i ${added_su_config}" "$pam_su_config" + fi + + # Append account modules at end of `sshd:account` stack. +@@ -314,16 +320,24 @@ restart_sshd() { + return 0 + fi + echo "Restarting SSHD" +- for svc in "ssh" "sshd"; do +- restart_service "$svc" +- done ++ if is_freebsd; then ++ restart_service "sshd" ++ else ++ for svc in "ssh" "sshd"; do ++ restart_service "$svc" ++ done ++ fi + } + + restart_svcs() { + echo "Restarting optional services." +- for svc in "nscd" "unscd" "systemd-logind" "cron" "crond"; do +- restart_service "$svc" +- done ++ if is_freebsd; then ++ restart_service "cron" ++ else ++ for svc in "nscd" "unscd" "systemd-logind" "cron" "crond"; do ++ restart_service "$svc" ++ done ++ fi + } + + setup_google_dirs() { +@@ -347,18 +361,34 @@ remove_google_dirs() { + } + + activate() { +- for func in modify_sshd_conf modify_nsswitch_conf \ +- modify_pam_config setup_google_dirs restart_svcs restart_sshd \ +- modify_group_conf; do ++ if is_freebsd; then ++ # In FreeBSD there is no pam_group config file similar to ++ # /etc/security/group.conf. ++ funcs="modify_sshd_conf modify_nsswitch_conf modify_pam_config \ ++ setup_google_dirs restart_svcs restart_sshd" ++ else ++ funcs="modify_sshd_conf modify_nsswitch_conf modify_pam_config \ ++ setup_google_dirs restart_svcs restart_sshd modify_group_conf" ++ fi ++ ++ for func in "$funcs"; do + $func + [ $? -eq 0 ] || return 1 + done + } + + deactivate() { +- for func in remove_google_dirs restore_nsswitch_conf \ +- restore_sshd_conf restore_pam_config restart_svcs restart_sshd \ +- restore_group_conf; do ++ if is_freebsd; then ++ # In FreeBSD there is no pam_group config file similar to ++ # /etc/security/group.conf. ++ funcs="remove_google_dirs restore_nsswitch_conf restore_sshd_conf \ ++ restore_pam_config restart_svcs restart_sshd" ++ else ++ funcs="remove_google_dirs restore_nsswitch_conf restore_sshd_conf \ ++ restore_pam_config restart_svcs restart_sshd restore_group_conf" ++ fi ++ ++ for func in "$funcs"; do + $func + done + }