OPNsense Forum

Archive => 16.7 Legacy Series => Topic started by: roundtree on December 21, 2016, 07:28:52 pm

Title: [SOLVED] Remote administration via SSH
Post by: roundtree on December 21, 2016, 07:28:52 pm
I'm trying to enable SSH for remote administration but seem stuck on the pf rules.  I've confirmed that SSH is enabled and available from the LAN, but after adding what I think to be the right rule, it doesn't seem to work.  Here's what I have in the WebGUI:

(https://i.imgbox.com/CXSy5wnt.png) (http://imgbox.com/CXSy5wnt)

When I look at rules output from pfctl, this is the rule present (sans WAN IPs):

Code: [Select]
pass in log quick on em0 reply-to (em0 xxx.xxx.xxx.xxx) inet proto tcp from any to xxx.xxx.xxx.xxx port = ssh flags S/SA keep state label "USER_RULE: Remote SSH Admin"
This should be possible right?  I looked for a while and can't find any references that don't lead back to pfSense instead.
Title: Re: Remote administration via SSH
Post by: ThuTex on December 21, 2016, 10:37:10 pm
first, personal opinion.... firewall to protect your network, remotely manageable... yikes.

secondly, try a port above 1024  with a forward (maybe your isp blocks low ports)

and last (not sure about this one)... maybe you also need to have a port forward to specify the fact that you want the firewall to respond and not a server behind it. (maybe this can be fixed with destination "this firewall" instead of "wan address" ?)
Title: Re: Remote administration via SSH
Post by: franco on December 21, 2016, 11:08:19 pm
The image is cropped. Is em0 LAN or WAN?
Title: Re: Remote administration via SSH
Post by: roundtree on December 21, 2016, 11:41:41 pm
em0 is WAN, em1 is LAN
Title: Re: Remote administration via SSH
Post by: roundtree on December 22, 2016, 12:05:38 am
A little background:


Certainly, I intend to deploy OPNsense using OpenVPN for remote management, but that won't be feasible for every deployment scenario and really don't want to be stuck relying on TeamViewer with a LAN workstation.  :o
Title: Re: Remote administration via SSH
Post by: abalsam on December 22, 2016, 04:36:14 am
I noted that you said this is for a lab environment.  That almost always means private IP address used on the WAN interface. Please double check on the WAN interface settings that the "Block Private Networks" option is not checked.  Otherwise it would block all traffic coming into the WAN interface.
Title: Re: Remote administration via SSH
Post by: istok011 on December 22, 2016, 12:21:43 pm
Click System>Settings>Administration>...about the middle of the page you have options

-Enable Secure Shell
-Permit root user login
-Permit password login

Below is the
-SSH Port (blank) -enter 22

Thats it..no firewal rule...but will be added auto...
Title: Re: Remote administration via SSH
Post by: roundtree on December 22, 2016, 11:38:41 pm
I noted that you said this is for a lab environment.  That almost always means private IP address used on the WAN interface. Please double check on the WAN interface settings that the "Block Private Networks" option is not checked.  Otherwise it would block all traffic coming into the WAN interface.

Yep, I unchecked the private and bogon networks options previously.
Title: Re: Remote administration via SSH
Post by: roundtree on December 22, 2016, 11:41:13 pm
Click System>Settings>Administration>...about the middle of the page you have options

-Enable Secure Shell
-Permit root user login
-Permit password login

Below is the
-SSH Port (blank) -enter 22

Thats it..no firewal rule...but will be added auto...

All already enabled, but no dice.  The root option isn't needed, and I do plan to use certs so the password option also won't be required.
Title: Re: Remote administration via SSH
Post by: bartjsmit on December 23, 2016, 11:11:02 am
Do you have a NAT port forward rule to expose sshd on the WAN side?

Bart...
Title: Re: Remote administration via SSH
Post by: bartjsmit on December 23, 2016, 11:28:23 am
I still had a VM that I used after a hardware change to test this with. Confirmed as working. The redacted IP is the LAN IP of the firewall.

Bart...
Title: Re: Remote administration via SSH
Post by: roundtree on December 23, 2016, 01:52:55 pm
I still had a VM that I used after a hardware change to test this with. Confirmed as working. The redacted IP is the LAN IP of the firewall.

Bart...

Thanks, Bart.  That did the trick.  It's still confusing to me why a filter rule cannot permit SSH to the WAN inteface, when the listener is active and I can tcpdump the inbound packets, but this works like a top.