Compare commits

...

2 Commits

Author SHA1 Message Date
Paolo Asperti 78d062c019
fixed amgmt user creation
continuous-integration/drone/tag Build is passing Details
continuous-integration/drone/push Build is passing Details
2019-05-09 17:37:53 +02:00
Paolo Asperti 4d7087e7ca
added client shell 2019-05-09 17:37:28 +02:00
2 changed files with 26 additions and 1 deletions

View File

@ -47,7 +47,16 @@ mkdir -p %{buildroot}%{_localstatedir}/cache/client-manager
%defattr(-,root,root)
%pre
/usr/bin/getent passwd amgmt || /usr/sbin/useradd -r -g wheel -d /home/amgmt -s /sbin/nologin amgmt
/usr/bin/getent passwd amgmt || /usr/sbin/useradd -r -m -g wheel -d /home/amgmt -s /sbin/nologin amgmt
if [ ! -d /home/amgmt/.ssh ] ; then
mkdir -p /home/amgmt/.ssh
fi
chmod 0700 /home/amgmt /home/amgmt/.ssh
chown -R amgmt:wheel /home/amgmt
if [ ! -f /home/amgmt/.ssh/id_rsa ] ; then
cat /dev/zero | sudo -u amgmt ssh-keygen -q -N ""
fi
if [ "$1" = 2 ]; then
#upgrade
/usr/bin/systemctl stop client-manager >/dev/null 2>&1 || :

16
root/usr/bin/client-shell Normal file
View File

@ -0,0 +1,16 @@
#!/bin/sh
if [ "$1" = "" ] ; then
echo "Usage:"
echo "$0 [hostname]"
exit 1
fi
USER=$(db hosts getprop "$1" sshUser)
if [ "$USER" = "" ] ; then
echo "Can't find an user for $1"
exit 1
fi
/usr/bin/sudo -u amgmt /usr/bin/ssh -o StrictHostKeyChecking=no ${USER}\@${1} ${@:2}