hostname as source - firewalld (centos)

We have users that don't have static IPs and need them to gain access to some servers. They do have DDNS with nutpile so wondering if those dns names could be used instead of a source IP.
LVL 1
Mark LewisAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dan CraciunIT ConsultantCommented:
AFAIK, firewalld does not allow the use of domain names in rules.

You can use names in iptables, but they are only resolved when the service is started, so for any DDNS update you would need to restart the firewall.

The correct way would be to setup a VPN server (preferably SSTP) that would handle authentication and network access. Then you don't need to rely on IPs for access.

HTH,
Dan
0
Mark LewisAuthor Commented:
We can't do vpn otherwise, it would be the way to go for sure. There must be some way around this.
0
Dan CraciunIT ConsultantCommented:
You could write a script that resolves those names to IPs and cron that every X minutes. If something changed, update firewalld.

That will work but will add complexity. In a few months, no one will know what that script does and why it's there.

Maybe it's time to revisit why you can't do VPN?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Mark LewisAuthor Commented:
I asked about iptables because that is what I need. VPN would not work in this case because there are too many servers involved all around the globe.

Your script idea is what we've been doing for a long time. It isn't that hard to keep track of scripts, you simply make sure to comment in them or keep a log somewhere showing where they are, why they are used etc.

I was hoping that there might be a way for iptables (firewalld really) to use a FQDN instead of an IP. It seems that you can indeed use a FQDN in the rule after all. The only caveat is that the rule becomes useless if the IP changes. So the answer is yes, it can be done if this limitation is ok with you.
0
Dan CraciunIT ConsultantCommented:
Hmm.

firewalld is NOT iptables. It's a different package, with a different syntax and a different way of handling the firewall (chains/rules vs zones/services): https://www.unixmen.com/iptables-vs-firewalld/

firewall-cmd should through and error if you use a name instead of an IP in a rule.

I already said in my first post that you can use names in iptables.
0
Mark LewisAuthor Commented:
Firewalld still uses iptables though. What I found on the net was related to iptables, not firewalld.
Seems the only way to do this will be using a script after all.
0
Dan CraciunIT ConsultantCommented:
Yes, internally firewalld translates to iptables rules. But if you dump the rules (iptables-save or iptables -S), you'll probably get a ton of text. Not for the faint of heart.

If you go with scripting, I would advise uninstalling firewalld and switching to iptables.
It's a much clearer syntax (IMO) and it does not complain on names instead of IPs.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Software Firewalls

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.