OPNsense Forum

Archive => 15.7 Legacy Series => Topic started by: cnjimmyshao on July 23, 2015, 12:09:12 pm

Title: Help on How to set Environment Variables for AUTOSSH
Post by: cnjimmyshao on July 23, 2015, 12:09:12 pm
Hi, guys.

I am using AUTOSSH to keep SSH connection with a server outside. There is some Environment Variables for AUTOSSH, I just don't know how to set it up.

I was moved from openWRT. which have a clear instruction about this(http://wiki.openwrt.org/doc/howto/autossh), they use UCI to unify all the config files.

Any one can tell me where is the Config file of AutoSSH in OPNsense? Thanks!
Title: Re: Help on How to set Environment Variables for AUTOSSH
Post by: franco on July 23, 2015, 12:41:13 pm
The script that launches sshd is /usr/local/etc/rc.sshd and that is probably what you need to modify in order to bring in our environment variables.

It will be very hard to bring autossh to the default installation and/or play nice with the current sshd design (you can disable sshd and do it manually maybe).
Title: Re: Help on How to set Environment Variables for AUTOSSH
Post by: cnjimmyshao on July 23, 2015, 01:22:02 pm
Hi, Franco

thanks for the rapid reply.

I think there is maybe a misunderstanding here, AUTOSSH only work with SSH client, it has no related with SSHD.
The official website of AUTOSSH is here: http://www.harding.motd.ca/autossh/

So, Franco, would you please help on the topic?
Where is the config file or how to set the Environment Variables for AUTOSSH?

Really Appreciate!
Title: Re: Help on How to set Environment Variables for AUTOSSH
Post by: franco on July 23, 2015, 01:52:43 pm
Okay, sorry, I only skimmed the manual for autossh. What I'll do for 15.7.4 is add autossh to the available packages, so when it is released you can do:

# pkg install autossh

Then we'll have to look at how to invoke it properly within OPNsense.
Title: Re: Help on How to set Environment Variables for AUTOSSH
Post by: cnjimmyshao on July 23, 2015, 02:30:23 pm
cool, get it.  :)

BTW, if privoxy can be add to the available packages will be more great.
Title: Re: Help on How to set Environment Variables for AUTOSSH
Post by: franco on July 23, 2015, 04:47:25 pm
Okay, added privoxy, but 3 proxies in the packages repo ought to be enough now. ;)
Title: Re: Help on How to set Environment Variables for AUTOSSH
Post by: franco on July 25, 2015, 10:09:22 pm
So I fixed autossh for our firmware and it's in there now:

# pkg install autossh

You can drop a sh-compatible script into /etc/rc.conf.d, e.g. /etc/rc.conf.d/autossh that can set environment variables and start up autossh according to your needs. Those get executed on bootup (only).
Title: Re: Help on How to set Environment Variables for AUTOSSH
Post by: cnjimmyshao on July 26, 2015, 10:01:33 am
Great, Thanks!