LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Adding External IP Subnet to IPTABLES (https://www.linuxquestions.org/questions/slackware-14/adding-external-ip-subnet-to-iptables-4175609644/)

BAcidEvil 07-11-2017 11:42 AM

Adding External IP Subnet to IPTABLES
 
I have an iPad and iPhone I like to use to connect to my Mail Server in order to make any changes..

iPad xxx.xxx.146.105
iPhone xxx.xxx.4.19

They are on on the same Celluar Network...
If I add them individually to IPTABLES such as 'xxx.xxx.4.0/25' or 'xxx.xxx.146.0/25'
I can connect no problem but when I do 'xxx.xxx.0.0/25' then neither can access via SSH on the specific port.

I am assuming that either the 3rd series in the IP address are not same subnet therefore not allowing me or I am simply doing it wrong.

Thanks for any help.

lazydog 07-11-2017 01:40 PM

Your '/25' is x.x.4.1 - 128 and x.x.146.1 - 128 respectively.
So no x.x.0.0/25 is not going to work.

You are going to need to setup IPTABLES to allow the 2 /25 networks in, which is not Ideal as anyone on those network then has access to your server.

What you might wan to look into is setting up VPN that way only those that have the correct keys/password/passphrase will be allowed to connect. then you don't have to worry about who's going to have access to your system.

BAcidEvil 07-11-2017 03:12 PM

Quote:

Originally Posted by lazydog (Post 5733657)
Your '/25' is x.x.4.1 - 128 and x.x.146.1 - 128 respectively.
So no x.x.0.0/25 is not going to work.

You are going to need to setup IPTABLES to allow the 2 /25 networks in, which is not Ideal as anyone on those network then has access to your server.

What you might wan to look into is setting up VPN that way only those that have the correct keys/password/passphrase will be allowed to connect. then you don't have to worry about who's going to have access to your system.


Never really even came to realize utilizing a VPN as an alternative... excited to go home and work on that. Would a VPN allow me to enter my shell prompt to modify scripts same as using my SSH App?

As far as adding the 2 /25 network access being a huge vulnerability, doesn't "AllowUsers=" and a Cert along with an unconventional access port remedy that? Just asking for knowledge sake... doing VPN regardless.

Thank you so much.

BAcidEvil 07-11-2017 05:03 PM

Would connecting via VPN then give me a LAN IP on the network allowing me to SSH in?

Gerard Lally 07-11-2017 06:43 PM

Quote:

Originally Posted by BAcidEvil (Post 5733751)
Would connecting via VPN then give me a LAN IP on the network allowing me to SSH in?

If you do OpenVPN with routed networking (tun) your VPN address will be something like 10.80.0.100, so you'll have to set up port forwarding from the LAN network to the VPN network "inside" your LAN. If you do OpenVPN with bridged networking (tap), bridging your ethernet card to the VPN adapter, your VPN will get an address in the LAN range. I've done both: bridged networking was easier and had a lot of benefits; routed networking was perhaps marginally more responsive, and, debatably, more secure.

It all depends on what your local topology is like; I don't know what VPN solutions are available for iphones and ipads. You might need these devices to go through a Slackware VPN gateway at the local end in order to connect them to the mail server at the remote VPN endpoint.

Petri Kaukasoina 07-12-2017 08:26 AM

Quote:

Originally Posted by BAcidEvil (Post 5733616)
If I add them individually to IPTABLES such as 'xxx.xxx.4.0/25' or 'xxx.xxx.146.0/25'
I can connect no problem but when I do 'xxx.xxx.0.0/25' then neither can access via SSH on the specific port.

Maybe you meant 'xxx.xxx.0.0/16'.

lazydog 07-12-2017 01:41 PM

Quote:

Originally Posted by BAcidEvil (Post 5733687)
Never really even came to realize utilizing a VPN as an alternative... excited to go home and work on that. Would a VPN allow me to enter my shell prompt to modify scripts same as using my SSH App?

I believe Gerard Lally has answered this for you.

Quote:

As far as adding the 2 /25 network access being a huge vulnerability, doesn't "AllowUsers=" and a Cert along with an unconventional access port remedy that? Just asking for knowledge sake... doing VPN regardless.

Thank you so much.
You can move the port to whichever port you'd like but that doesn't mean someone will never find it.
Best bet when using SSH is to use KEYS and ban ip addresses with too many retries.


Quote:

Originally Posted by Petri Kaukasoina (Post 5733953)
Maybe you meant 'xxx.xxx.0.0/16'.

I would certainly hope not.

Olek 07-12-2017 02:47 PM

Quote:

Originally Posted by lazydog (Post 5734060)
I believe Gerard Lally has answered this for you.

You can move the port to whichever port you'd like but that doesn't mean someone will never find it.
Best bet when using SSH is to use KEYS and ban ip addresses with too many retries.

I would certainly hope not.

No. Moving ssh port isn't best and even isn't good.
To find changed port is trivial.
Using keys is good, but not protect from growing /var/log/messages file to to hudreds MB.
Effective solution is fwknop or openvpn.

lazydog 07-13-2017 07:26 AM

Quote:

Originally Posted by Olek (Post 5734084)
No. Moving ssh port isn't best and even isn't good.
To find changed port is trivial.
Using keys is good, but not protect from growing /var/log/messages file to to hudreds MB.
Effective solution is fwknop or openvpn.

I think you missed to part where you ban ip's with too many retries. If your message file is growing that fast you have bigger problems.


All times are GMT -5. The time now is 01:02 PM.