/usr/lib/dracut/modules.d/95ssh-client/module-setup.sh is in dracut-network 040+1-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | #!/bin/bash
# fixme: assume user is root
# called by dracut
check() {
[[ $mount_needs ]] && return 1
# If our prerequisites are not met, fail.
require_binaries ssh scp || return 1
if [[ $sshkey ]]; then
[ ! -f $sshkey ] && {
derror "ssh key: $sshkey is not found!"
return 1
}
fi
return 255
}
# called by dracut
depends() {
# We depend on network modules being loaded
echo network
}
inst_sshenv()
{
if [ -d /root/.ssh ]; then
inst_dir /root/.ssh
chmod 700 ${initdir}/root/.ssh
fi
# Copy over ssh key and knowhosts if needed
[[ $sshkey ]] && {
inst_simple $sshkey
[[ -f /root/.ssh/known_hosts ]] && inst_simple /root/.ssh/known_hosts
[[ -f /etc/ssh/ssh_known_hosts ]] && inst_simple /etc/ssh/ssh_known_hosts
}
# Copy over root and system-wide ssh configs.
[[ -f /root/.ssh/config ]] && inst_simple /root/.ssh/config
if [[ -f /etc/ssh/ssh_config ]]; then
inst_simple /etc/ssh/ssh_config
sed -i -e 's/\(^[[:space:]]*\)ProxyCommand/\1# ProxyCommand/' ${initdir}/etc/ssh/ssh_config
while read key val; do
[[ key != "GlobalKnownHostsFile" ]] && continue
inst_simple "$val"
break
done < /etc/ssh/ssh_config
fi
return 0
}
# called by dracut
install() {
inst_multiple ssh scp
inst_sshenv
}
|