Moved to host overlay and added csh support

Signed-off-by: jcsiadal <jeremy.c.siadal@intel.com>
This commit is contained in:
jcsiadal
2022-04-28 04:36:47 +00:00
parent 9a490be149
commit b2ce95d850
2 changed files with 27 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
#!/bin/csh
## Automatically configure SSH keys for a user on C SHell login
## Copy this file to /etc/profile.d along with ssh_setup.sh
set _UID=`id -u`
if ( $_UID < 500 && $_UID != 0 ) then
exit
endif
if ( ! -f "$HOME/.ssh/config" && ! -f "$HOME/.ssh/cluster" ) then
echo "Configuring SSH for cluster access"
install -d -m 700 $HOME/.ssh
ssh-keygen -t rsa -f $HOME/.ssh/cluster -N '' -C "Warewulf Cluster key" >& /dev/null
cat $HOME/.ssh/cluster.pub >>! $HOME/.ssh/authorized_keys
chmod 0600 $HOME/.ssh/authorized_keys
touch $HOME/.ssh/config
echo -n "# Added by Warewulf " >>! $HOME/.ssh/config
(date +%Y-%m-%d >> $HOME/.ssh/config) |& /dev/null
echo "Host *" >> $HOME/.ssh/config
echo " IdentityFile ~/.ssh/cluster" >> $HOME/.ssh/config
echo " StrictHostKeyChecking=no" >> $HOME/.ssh/config
chmod 0600 $HOME/.ssh/config
endif

View File

@@ -0,0 +1,33 @@
#!/bin/sh
##
## Copyright (c) 2001-2003 Gregory M. Kurtzer
##
## Copyright (c) 2003-2012, The Regents of the University of California,
## through Lawrence Berkeley National Laboratory (subject to receipt of any
## required approvals from the U.S. Dept. of Energy). All rights reserved.
##
## Copied from https://github.com/warewulf/warewulf3/blob/master/cluster/bin/cluster-env
## Automatically configure SSH keys for a user on login
## Copy this file to /etc/profile.d
_UID=`id -u`
if [ $_UID -lt 500 -a $_UID -ne 0 ]; then
exit
fi
if [ ! -f "$HOME/.ssh/config" -a ! -f "$HOME/.ssh/cluster" ]; then
echo "Configuring SSH for cluster access"
install -d -m 700 $HOME/.ssh
ssh-keygen -t rsa -f $HOME/.ssh/cluster -N '' -C "Warewulf Cluster key" > /dev/null 2>&1
cat $HOME/.ssh/cluster.pub >> $HOME/.ssh/authorized_keys
chmod 0600 $HOME/.ssh/authorized_keys
echo "# Added by Warewulf `date +%Y-%m-%d 2>/dev/null`" >> $HOME/.ssh/config
echo "Host *" >> $HOME/.ssh/config
echo " IdentityFile ~/.ssh/cluster" >> $HOME/.ssh/config
echo " StrictHostKeyChecking=no" >> $HOME/.ssh/config
chmod 0600 $HOME/.ssh/config
fi