Triggering rsync with Lasso

View: New views
3 Messages — Rating Filter:   Alert me  

Triggering rsync with Lasso

by Mark Palmer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi List,

I'm trying to trigger an rsync operation with Lasso

I have the following Lasso code

Local('sync_process' = OS_Process('///home/client/sync_script.sh'));
'Read: 'Encode_HTML(#sync_process->Read)'<br />';
'Read Error: 'Encode_HTML(#sync_process->ReadError)'<br />';
#sync_process->Close;

Calling this script


#!/bin/bash

rsync -avz --delete-after -e "ssh -p 1984 -i /root/.ssh/id_rsa.pub" /
home/client/web/current/dir_to_sync/ root@...:/home/
client/web/current/dir_to_sync/ -n > /home/client/sync.log;

But I get the error:

Warning: Identity file /root/.ssh/id_rsa.pub does not exist. Host key  
verification failed. rsync: connection unexpectedly closed (0 bytes  
received so far) [sender] rsync error: error in rsync protocol data  
stream (code 12) at io.c(359)


The script runs just fine from the command line (I have ssh keys in  
place and use them all the time) and I'm passing the script the path  
to the public key in the script.

The script has the permissions SUID set
-rwsrwxrwx  1 root       root        214 Oct 27 20:04 sync_script.sh
So should run as root even though it's called by Lasso

Also a simple OS_Process('/bin/ls', Array('-la')) runs OK so my Lasso  
set-up would appear to be OK

I've run out of ideas, anything obvious I'm missing.

BTW the purpose of the script is to allow a client to trigger the sync  
of a certain directory at their leisure - it can't be done by cron.



Regards

Mark Palmer
E: mark@...
T: 01902 620500
W: www.pageworks.co.uk


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/



Re: Triggering rsync with Lasso

by Mark Palmer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I may have found a solution, but I'm not sure about any security issues.

I've added lasso to the /etc/sudoers file:

%lasso ALL=(ALL) NOPASSWD: ALL

and added sudo to my script

sudo /usr/bin/rsync -avz --delete-after -e ...


On 27 Oct 2009, at 21:37, Mark Palmer wrote:

> Hi List,
>
> I'm trying to trigger an rsync operation with Lasso
>
> I have the following Lasso code
>
> Local('sync_process' = OS_Process('///home/client/sync_script.sh'));
> 'Read: 'Encode_HTML(#sync_process->Read)'<br />';
> 'Read Error: 'Encode_HTML(#sync_process->ReadError)'<br />';
> #sync_process->Close;
>
> Calling this script
>
>
> #!/bin/bash
>
> rsync -avz --delete-after -e "ssh -p 1984 -i /root/.ssh/id_rsa.pub" /
> home/client/web/current/dir_to_sync/ root@...:/home/
> client/web/current/dir_to_sync/ -n > /home/client/sync.log;
>
> But I get the error:
>
> Warning: Identity file /root/.ssh/id_rsa.pub does not exist. Host  
> key verification failed. rsync: connection unexpectedly closed (0  
> bytes received so far) [sender] rsync error: error in rsync protocol  
> data stream (code 12) at io.c(359)
>
>
> The script runs just fine from the command line (I have ssh keys in  
> place and use them all the time) and I'm passing the script the path  
> to the public key in the script.
>
> The script has the permissions SUID set
> -rwsrwxrwx  1 root       root        214 Oct 27 20:04 sync_script.sh
> So should run as root even though it's called by Lasso
>
> Also a simple OS_Process('/bin/ls', Array('-la')) runs OK so my  
> Lasso set-up would appear to be OK
>
> I've run out of ideas, anything obvious I'm missing.
>
> BTW the purpose of the script is to allow a client to trigger the  
> sync of a certain directory at their leisure - it can't be done by  
> cron.
>
>
>
> Regards
>
> Mark Palmer
> E: mark@...
> T: 01902 620500
> W: www.pageworks.co.uk
>
>
> --
> This list is a free service of LassoSoft: http://www.LassoSoft.com/
> Search the list archives: http://www.ListSearch.com/Lasso/Browse/
> Manage your subscription: http://www.ListSearch.com/Lasso/
>
>



Regards

Mark Palmer
E: mark@...
T: 01902 620500
W: www.pageworks.co.uk


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/



Re: Triggering rsync with Lasso

by Pier Kuipers :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Mark,

Familiar problem - you'll need to copy the ssh keys to the lasso
user's home folder, which (on a Mac) is in /Applications/Lasso
Professional 8/ - create a directory ".ssh" in there and copy the
working ssh keys from your own home folder into this one. Afaik, that
should work, although something tells me that you may have to create a
key pair for the lasso user, creating a lasso user at the remote
server - not sure though. If I find out I'll write up something in
Lassotech.

I've had to use the same trick to run svn updates over ssh on my
sites, and it works - I just can;t remember exactly how I did it,
other than that it involved the ssh keys in the Lasso Pro folder :-)

Cheers

Pier

On Tue, Oct 27, 2009 at 9:37 PM, Mark Palmer <mark@...> wrote:

> Hi List,
>
> I'm trying to trigger an rsync operation with Lasso
>
> I have the following Lasso code
>
> Local('sync_process' = OS_Process('///home/client/sync_script.sh'));
> 'Read: 'Encode_HTML(#sync_process->Read)'<br />';
> 'Read Error: 'Encode_HTML(#sync_process->ReadError)'<br />';
> #sync_process->Close;
>
> Calling this script
>
>
> #!/bin/bash
>
> rsync -avz --delete-after -e "ssh -p 1984 -i /root/.ssh/id_rsa.pub"
> /home/client/web/current/dir_to_sync/
> root@...:/home/client/web/current/dir_to_sync/ -n >
> /home/client/sync.log;
>
> But I get the error:
>
> Warning: Identity file /root/.ssh/id_rsa.pub does not exist. Host key
> verification failed. rsync: connection unexpectedly closed (0 bytes received
> so far) [sender] rsync error: error in rsync protocol data stream (code 12)
> at io.c(359)
>
>
> The script runs just fine from the command line (I have ssh keys in place
> and use them all the time) and I'm passing the script the path to the public
> key in the script.
>
> The script has the permissions SUID set
> -rwsrwxrwx  1 root       root        214 Oct 27 20:04 sync_script.sh
> So should run as root even though it's called by Lasso
>
> Also    a simple OS_Process('/bin/ls', Array('-la')) runs OK so my Lasso
> set-up would appear to be OK
>
> I've run out of ideas, anything obvious I'm missing.
>
> BTW the purpose of the script is to allow a client to trigger the sync of a
> certain directory at their leisure - it can't be done by cron.
>
>
>
> Regards
>
> Mark Palmer
> E: mark@...
> T: 01902 620500
> W: www.pageworks.co.uk
>
>
> --
> This list is a free service of LassoSoft: http://www.LassoSoft.com/
> Search the list archives: http://www.ListSearch.com/Lasso/Browse/
> Manage your subscription: http://www.ListSearch.com/Lasso/
>
>
>



--
Pier Kuipers
Visual ID
Unit S02
Synergy Centre
ITT Tallaght
Dublin 24
Ireland
Tel. +353 1 9022 575
Mobile +353 87 294 3063
Web http://www.visualid.com

--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/