LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 07-11-2017, 11:42 AM   #1
BAcidEvil
Member
 
Registered: Dec 2003
Distribution: Slack 14.1 3.18.1
Posts: 294

Rep: Reputation: 10
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.
 
Old 07-11-2017, 01:40 PM   #2
lazydog
Senior Member
 
Registered: Dec 2003
Location: The Key Stone State
Distribution: CentOS Sabayon and now Gentoo
Posts: 1,249
Blog Entries: 3

Rep: Reputation: 194Reputation: 194
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.
 
Old 07-11-2017, 03:12 PM   #3
BAcidEvil
Member
 
Registered: Dec 2003
Distribution: Slack 14.1 3.18.1
Posts: 294

Original Poster
Rep: Reputation: 10
Quote:
Originally Posted by lazydog View Post
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.

Last edited by BAcidEvil; 07-11-2017 at 04:45 PM.
 
Old 07-11-2017, 05:03 PM   #4
BAcidEvil
Member
 
Registered: Dec 2003
Distribution: Slack 14.1 3.18.1
Posts: 294

Original Poster
Rep: Reputation: 10
Would connecting via VPN then give me a LAN IP on the network allowing me to SSH in?
 
Old 07-11-2017, 06:43 PM   #5
Gerard Lally
Senior Member
 
Registered: Sep 2009
Location: Leinster, IE
Distribution: Slackware, NetBSD
Posts: 2,180

Rep: Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762
Quote:
Originally Posted by BAcidEvil View Post
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.

Last edited by Gerard Lally; 07-11-2017 at 09:42 PM.
 
Old 07-12-2017, 08:26 AM   #6
Petri Kaukasoina
Senior Member
 
Registered: Mar 2007
Posts: 1,785

Rep: Reputation: 1461Reputation: 1461Reputation: 1461Reputation: 1461Reputation: 1461Reputation: 1461Reputation: 1461Reputation: 1461Reputation: 1461Reputation: 1461
Quote:
Originally Posted by BAcidEvil View Post
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'.
 
Old 07-12-2017, 01:41 PM   #7
lazydog
Senior Member
 
Registered: Dec 2003
Location: The Key Stone State
Distribution: CentOS Sabayon and now Gentoo
Posts: 1,249
Blog Entries: 3

Rep: Reputation: 194Reputation: 194
Quote:
Originally Posted by BAcidEvil View Post
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 View Post
Maybe you meant 'xxx.xxx.0.0/16'.
I would certainly hope not.
 
Old 07-12-2017, 02:47 PM   #8
Olek
Member
 
Registered: Jul 2012
Location: Wroclaw Poland
Distribution: Slackware
Posts: 110

Rep: Reputation: 27
Quote:
Originally Posted by lazydog View Post
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.
 
Old 07-13-2017, 07:26 AM   #9
lazydog
Senior Member
 
Registered: Dec 2003
Location: The Key Stone State
Distribution: CentOS Sabayon and now Gentoo
Posts: 1,249
Blog Entries: 3

Rep: Reputation: 194Reputation: 194
Quote:
Originally Posted by Olek View Post
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Iptables: allow only one subnet gtribe Linux - Networking 8 05-19-2014 05:12 PM
Block an IP for a subnet by IPtables boby.kumar Linux - Security 4 05-05-2014 05:30 AM
Adding 2nd NIC diff subnet - looking for how to? tiger.woods Linux - Networking 2 04-11-2007 02:55 PM
cant connect to the server from the same external subnet cccc Debian 5 03-07-2006 02:34 PM
Accessing a machine in my subnet from an external source bigian79 Linux - Networking 2 01-29-2004 12:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 05:07 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration