Use sshopts for rsyncssh tests

This commit is contained in:
Daniel Poelzleithner 2021-12-08 18:26:11 +01:00
parent deb425a075
commit 3e8aad3b2e
3 changed files with 32 additions and 3 deletions

View File

@ -4645,6 +4645,7 @@ OPTIONS:
-nodaemon Does not detach and logs to stdout/stderr
-pidfile FILE Writes Lsyncds PID into FILE
-runner FILE Loads Lsyncds lua part from FILE
-script FILE Script to load before execting runner (ADVANCED)
-sshopts Additional ssh command options when using rsyncssh
-version Prints versions and exits
@ -4781,6 +4782,18 @@ function runner.configure( args, monitors )
end
},
script =
{
1,
function
(
file
)
clSettings.scripts = clSettings.scripts or {}
table.insert(clSettings.scripts, file)
end
},
rsync =
{
2,
@ -4898,6 +4911,13 @@ function runner.configure( args, monitors )
i = i + 1
end
if clSettings.scripts then
for _, file in ipairs(clSettings.scripts) do
log( 'Info', 'Run addition script: ' .. file )
dofile(file)
end
end
if clSettings.syncs
then
if #nonopts ~= 0

View File

@ -8,8 +8,6 @@ dofile( 'tests/testlib.lua' )
cwriteln( '****************************************************************' )
cwriteln( ' Testing default.rsyncssh with random data activity ' )
cwriteln( '****************************************************************' )
cwriteln( '( this test needs passwordless ssh localhost access )' )
cwriteln( '( for current user )' )
local tdir, srcdir, trgdir = mktemps()
@ -24,6 +22,8 @@ local pid = spawn(
'-nodaemon',
'-delay',
'5',
'-sshopts',
'-i tests/ssh/id_rsa -p 2468 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null',
'-rsyncssh',
srcdir,
'localhost',

View File

@ -114,11 +114,20 @@ function startSshd()
cwriteln(script_path() .. "ssh/sshd_config")
local sshdPath = script_path() .. "/ssh/"
if posix.stat( sshdPath ) == nil then
cwriteln("setup ssh server in " .. sshdPath)
posix.mkdir(sshdPath)
os.execute("ssh-keygen -t rsa -N '' -f" .. sshdPath .. "id_rsa")
os.execute("cp ".. sshdPath .. "id_rsa.pub ".. sshdPath .. "authorized_keys")
os.execute("ssh-keygen -t rsa -N '' -f ".. sshdPath .. "ssh_host_rsa_key")
cwriteln("done")
end
local f = io.open( sshdPath .. "sshd_config", 'w')
f:write([[
Port 2468
HostKey ]] .. sshdPath .. [[ssh_host_rsa_key
HostKey ]] .. sshdPath .. [[ssh_host_dsa_key
AuthorizedKeysFile ]] .. sshdPath .. [[authorized_keys
ChallengeResponseAuthentication no
UsePAM no