Lo slackbuild l'ho inteso a grandi linee ma non implica sapere nulla su PAM.
L'unica cosa inerente come osservavi può essere il setuid rimosso ma io non ci ho fatto caso sinceramente, sempre per ignoranza... comunque lasciando tutto così i socket stanno nella home dell'utente in "~/.screen" e tanti saluti.
Invece capire come gestire in modo personalizzato l'autenticazione al riaggancio del della sessione in detach è un altro paio di maniche. Insomma lì bisogna conoscere almeno qualche esempio in più su PAM.
Ad ogni modo ho adattato lo slackbuild alla versione 4.99.
Ci sono alcune avvertenze:
- reperire i sorgenti:
git clone non produce un tarball, io ho usato uno script a parte, rudimentale ma funziona (se lo si può fare con metodi preferibili dite pure...) se ci sono dei tarball già pronti meglio, ma io no li ho trovati, né cercati tropo bene:
Codice: Seleziona tutto
CWD=$PWD
VERSION=$(date +%Y%m%d)
git clone git://git.savannah.gnu.org/screen.git
cd screen/src
git archive --format=tar.gz master --prefix screen-${VERSION}/ -o ${CWD}/screen-${VERSION}.tar.gz
cd $CWD && rm -rf screen
Codice: Seleziona tutto
#!/bin/bash
# Copyright 2008, 2009, 2010, 2011, 2013, 2014, 2015, 2016, 2018, 2019, 2020, 2022 Patrick J. Volkerding, Sebeka, Minnesota, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
cd $(dirname $0) ; CWD=$(pwd)
PKGNAM=screen
VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
BUILD=${BUILD:-1_hb}
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) export ARCH=i586 ;;
arm*) export ARCH=arm ;;
# Unless $ARCH is already set, use uname -m for all other archs:
*) export ARCH=$( uname -m ) ;;
esac
fi
# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
# the name of the created package would be, and then exit. This information
# could be useful to other scripts.
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
exit 0
fi
if [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "s390" ]; then
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
fi
TMP=${TMP:-/tmp}
PKG=$TMP/package-screen
NUMJOBS=${NUMJOBS:-" -j$(expr $(nproc) + 1) "}
rm -rf $PKG
mkdir -p $TMP $PKG
cd $TMP
rm -rf screen-$VERSION
tar xvf $CWD/screen-$VERSION.tar.?z || exit 1
cd screen-$VERSION || exit 1
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
-exec chmod 755 {} \+ -o \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \+
#echo "Patching from Debian... press ENTER to apply"
#echo "------------------------------------------------"&&read
# Apply patches taken from Debian:
#for pf in \
# 26source_encoding.patch.gz \
# 45suppress_remap.patch.gz \
# 52fix_screen_utf8_nfd.patch.gz \
# ; do zcat $CWD/$pf | patch --verbose -p1 || exit 1
#done
#echo "--------------------------------------"
#echo "Patch end here press ENTER to continue"&&read
# Revert a change to /etc/screenrc introduced in screen-4.3.x that prevents
# the console from being properly cleared when detaching from a screen session:
zcat $CWD/60-revert-screenrc-change.diff.gz | patch -p1 --verbose || exit 1
# Choose correct options depending on whether PAM is installed:
if [ -L /lib${LIBDIRSUFFIX}/libpam.so.? ]; then
PAM_OPTIONS="--enable-pam"
unset SHADOW_OPTIONS
else
unset PAM_OPTIONS
SHADOW_OPTIONS="--disable-pam"
fi
# Configure:
if [ ! -r configure ]; then
if [ -x ./autogen.sh ]; then
autoreconf -i
NOCONFIGURE=1 ./autogen.sh
else
autoreconf -vif
fi
fi
CFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
--sysconfdir=/etc \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--mandir=/usr/man \
--infodir=/usr/info \
--with-pty-mode=0620 \
--with-pty-group=5 \
$PAM_OPTIONS \
$SHADOW_OPTIONS \
--enable-telnet \
--disable-socket-dir \
--build=$ARCH-slackware-linux || exit 1
# Substitutions:
# It appears the change directly below is broken. We'll issue errata for
# it if a fix appears, but meanwhile we have a CVE to worry about.
# Tought choice.
#perl -pi -e 's|.*#undef HAVE_BRAILLE.*|#define HAVE_BRAILLE 1|' config.h
perl -pi -e 's|/usr/local/etc/screenrc|/etc/screenrc|' etc/etcscreenrc doc/*
perl -pi -e 's|/local/etc/screenrc|/etc/screenrc|' doc/*
# Build screen:
make $NUMJOBS || make || exit 1
make install DESTDIR=$PKG || exit 1
# Prepare package:
( cd $PKG
find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
)
# Sorry, pal. Not around here.
chmod 755 $PKG/usr/bin/screen-$VERSION
mkdir -p $PKG/etc/skel
cat etc/etcscreenrc > $PKG/etc/screenrc.new
cat etc/screenrc > $PKG/etc/skel/.screenrc.new
if [ ! -z "$PAM_OPTIONS" ]; then
mkdir -p $PKG/etc/pam.d
cat $CWD/screen.pam > $PKG/etc/pam.d/screen.new
fi
rm -f $PKG/usr/info/dir
gzip -9 $PKG/usr/info/*
gzip -9 $PKG/usr/man/man1/*
mkdir -p $PKG/usr/doc/screen-$VERSION
chmod 644 doc/FAQ
cp -a COPYING ChangeLog HACKING INSTALL NEWS README TODO \
doc/FAQ doc/README.DOTSCREEN \
$PKG/usr/doc/screen-$VERSION
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh
# Build package:
cd $PKG
makepkg -l y -c n $TMP/screen-$VERSION-$ARCH-$BUILD.txz
Salta fuori un errore quando si lancia autogen.sh per creare il "configure". A parte dover fare l'upgrade di autoconf alla versione 2.71, per risolvere ho aggiunto un autoreconf -i.
Non è elegantissimo visto che autogen.sh di fatto è il seguente:
Codice: Seleziona tutto
#!/bin/sh
exec autoreconf
rm -rf autom4te.cache
A parte queste piccole modifiche il pacchetto finale funziona, quindi supporto a truecolor ok e per quanto riguarda le varie impostazioni PAM, volendo si può tamponare con la soluzione già mostrata per non dover inserire la password. Se non lo si fa, lanciando una intera sessione screen da root il resume non funziona e bisognerebbe mdificare come dicevi con unix-qualcosa il file "pam.d/screen".
Aggiungo a futura memoria i files presenti nella dir di build. Il tar.gz in realtà non ci sarebbe, viene creato lanciando lo script downloadtarball.sh.
Codice: Seleziona tutto
60-revert-screenrc-change.diff.gz
doinst.sh.gz
downloadtarball.sh
screen-20231006.tar.gz
screen.SlackBuild
screen.pam
slack-desc
Codice: Seleziona tutto
# sh downloadtarball.sh
# sh screen.Slackbuild
# upgradepkg /tmp/screen-eccecc.txz