sshpass

General discussion about Gargoyle, OpenWrt or anything else even remotely related to the project

Moderator: Moderators

atrac
Posts: 9
Joined: Sat Nov 02, 2019 9:26 am

sshpass

Postby atrac » Wed Dec 04, 2019 4:00 am

Hello, I have almost finished my setup.
After fighting with usb sticks, I bought a second hand industrial router which has no wifi, it's only a gateway LTE->ethernet. I paid it less than a new usb stick.
I attached the wan interface of gargoyle router to this gateway, in order to apply the daily quota.
Everything is ok, I am still missing one feature.
The gateway has 2 sim slots, but just one modem. It does not have any function to switch based on quota.
Therefore, I have to do this in the gargoyle system: when quota is over, or maybe on certain sites ping fail, a script will run and it is supposed to connect to the gateway through ssh, enter some commands to manually switch to sim2 (or back to 1), and exit.
I think I need sshpass to do this. Is it possible to install it? Is there another way?

Thanks.

RomanHK
Posts: 487
Joined: Sat May 04, 2013 4:18 pm
Location: Czech Republik

Re: sshpass

Postby RomanHK » Wed Dec 04, 2019 5:39 am

the "sshpass" package does not support OpenWrt (Gargoyle). T̶r̶y̶ ̶u̶s̶i̶n̶g̶ ̶a̶n̶o̶t̶h̶e̶r̶ ̶s̶u̶p̶p̶o̶r̶t̶e̶d̶ ̶O̶p̶e̶n̶W̶r̶t̶ ̶p̶a̶c̶k̶a̶g̶e̶ ̶l̶i̶k̶e̶ ̶"̶o̶p̶e̶n̶s̶s̶h̶-̶c̶l̶i̶e̶n̶t̶"̶.

EDIT: Bad idea, I'm sorry.
Last edited by RomanHK on Wed Dec 04, 2019 8:14 am, edited 1 time in total.
Turris Omnia with Gargoyle 1.12.0
Linksys WRT3200ACM with Gargoyle 1.12.0
TL-WR1043ND v2 with Gargoyle 1.10.0

Lantis
Moderator
Posts: 5304
Joined: Mon Jan 05, 2015 5:33 am
Location: Australia

Re: sshpass

Postby Lantis » Wed Dec 04, 2019 5:42 am

You need to SSH from Gargoyle to the other router/modem?
Gargoyle has a built in SSH client.

You need to SSH from the other router/modem to Gargoyle?
Gargoyle has a built in SSH server.

I'm not sure what scenario you're trying to cover, but they are both sorted without installing anything. Or do i not understand what you are trying to do?
Routers: Various ar71xx/mvebu/x86-64
http://lantisproject.com/downloads/gargoyle_ispyisail.php for the latest releases

atrac
Posts: 9
Joined: Sat Nov 02, 2019 9:26 am

Re: sshpass

Postby atrac » Wed Dec 04, 2019 6:44 am

Lantis wrote:You need to SSH from Gargoyle to the other router/modem?
Gargoyle has a built in SSH client.

Yes exactly

Lantis wrote:I'm not sure what scenario you're trying to cover, but they are both sorted without installing anything. Or do i not understand what you are trying to do?

My understanding is that you cannot call ssh from a script (which is what I need to do) since just writing the password in the script will not work. This is why you need sshpass.
Correct me if I am wrong.

Maybe I can use public key authentication? Is it possible to do that?

Lantis
Moderator
Posts: 5304
Joined: Mon Jan 05, 2015 5:33 am
Location: Australia

Re: sshpass

Postby Lantis » Wed Dec 04, 2019 7:34 am

OK, i understand. For use in scripting i haven't had anything to do with this.
Routers: Various ar71xx/mvebu/x86-64
http://lantisproject.com/downloads/gargoyle_ispyisail.php for the latest releases

RomanHK
Posts: 487
Joined: Sat May 04, 2013 4:18 pm
Location: Czech Republik

Re: sshpass

Postby RomanHK » Wed Dec 04, 2019 9:56 am

All I found is a friendly compilation:

Developer website: https://sourceforge.net/projects/sshpass/

Architectures:
aarch64_cortex-a53: https://repo.turris.cz/hbs/mox/packages ... ex-a53.ipk
arm_cortex-a9_vfpv3: https://repo.turris.cz/hbs/omnia/packag ... _vfpv3.ipk
powerpc_8540: https://repo.turris.cz/hbs/turris1x/pac ... c_8540.ipk
mips_mips32: https://rureka.com/files/sshpass/sshpas ... mips32.ipk

Packages should be compatible with Gargoyle 1.11.0 and 1.12.0, but I haven't tried them.

If you don't find your architecture, you'll have to ask someone to compile the package.

Good luck ;) ...
Turris Omnia with Gargoyle 1.12.0
Linksys WRT3200ACM with Gargoyle 1.12.0
TL-WR1043ND v2 with Gargoyle 1.10.0

atrac
Posts: 9
Joined: Sat Nov 02, 2019 9:26 am

Re: sshpass

Postby atrac » Wed Dec 04, 2019 10:14 am

Ok then I can do in this way:
attach to the network a raspberry pi.
From the raspberry I will query the gargoyle, see if half of the quota has been reached; if positive, then connect to the LTE router via ssh and issue the switch to sim 2 command. At the end of the quota month revert to the sim 1.
In raspberry I can install expect or some other scripting that will do the job. Just some waste of power to keep it on all the time.
Now, the question is, how do I query the gargoyle from raspberry to know how much traffic has been used?

Lantis
Moderator
Posts: 5304
Joined: Mon Jan 05, 2015 5:33 am
Location: Australia

Re: sshpass

Postby Lantis » Wed Dec 04, 2019 4:05 pm

The "print_quotas" command is probably what you want.
Routers: Various ar71xx/mvebu/x86-64
http://lantisproject.com/downloads/gargoyle_ispyisail.php for the latest releases


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 8 guests