Firewall_Dynamic addon

Hi again.

The addon has already been created to resolve Dynamic DNS IP addresses so they can be used by the Firewall.

Once configured, under “Firewall” → “Firewall Groups” → “Host”, the new entries will appear so they can be used in the Firewall to create rules.

To install:

  1. Decompress zip file
    firewall_dyn.ipfire.tgz.zip (10,4 KB)

  2. Copy file “firewall_dyn.ipfire.tgz” to /opt/pakfire/tmp.

  3. Unpak with:

tar xvf firewall_dyn.ipfire.tgz

To install:

./install.sh

To uninstall:

./uninstall.sh

  1. You’ll see the menu inside “IPFire”.

Any incident reports you may have will be appreciated.

Bye.

2 Likes

Hi Guys.

Aside from aesthetic and functional improvements (hosts can now be enabled/disabled), there was an issue where, no matter how many times we updated the data, if the IPFire firewall wasn’t restarted, it wouldn’t recognize the change and wouldn’t function properly.

A soft restart was performed with the command:

/usr/local/bin/firewallctrl

:white_check_mark: Faster than a full restart

:white_check_mark: No interruptions to established connections

:white_check_mark: Official IPFire method for reloading rules (I think)

firewall_dyn.ipfire.tgz.zip (11,5 KB)

This ist the last version.

It would be very interesting if someone could test it to see if there are any errors.

Bye.

1 Like

A first look at the source show 2 (little?) problems

  • the check for valid IP isn’t complete
    general_functions.pl ( the method used throughout IPFire ) reads
 sub validip
 {
	my $ip = $_[0];

	if (!($ip =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/)) {
		return 0; 
    } else {
		my @octets = ($1, $2, $3, $4);
		foreach $_ (@octets) {
			if (/^0./) { return 0; }
			if ($_ < 0 || $_ > 255) { return 0; }
		}
		return 1;
	}
 }
  • the lookup function catches the last ‘Address:’ line of nslookup only. this may be not the requested information.
    example:
    nslookup heise.de yields the following address lines
    Address:        127.0.0.1#53
    Address: 193.99.144.80
    Address: 2a02:2e0:3fe:1001:302::
    
    (the first is the server address)

A little description of the purpose and configuration would be nice, also. :wink:
What is the ‘DNS servers’ entry for, f.e.?

Good morning @bbitsch .

I think I’ve improved with what you’ve told me, and now it’s perfect. I’ve also added some cosmetic improvements.

firewall_dyn.ipfire.tgz.zip (13,7 KB)

Thanks for trying it.

See you later.

3 Likes

Sir,

just installed your addon. dns-resolution seems to work.

A button to modify hosts instead of delete and input twice may be a nice idea.

Two questions:

  • How many dns-servers are allowed (4?)
  • Why didn’t you just use dns-servers from Network / Domain Name System?
  • How do I backup the installed addon / settings / hostlist?

Thanks!

Hello. Sorry for the delay in replying. There’s no limit to the number of objects, and when you perform a full backup of IPFire, the “customhosts” file in “/var/ipfire/fwhosts” is also backed up. Regards.

Hello Sir,

today I realized a very special issue:

I’m going to connect to a FQDN VPN server using openvpn. I downloaded a client packet for openvpnconnect to my laptop in green zone and keyed-in the FQDN into your Firewall DYN DNS addon for Zone RED.

Later on I and inserted a rule into ipfires firewall rules allowing above ovpn udp port in/out connect to the host offered by your Firewall Dyn DNS addon.

openvpnconnect starts and creates its ovpn-net. The FQDN host gets an ip-address inside this opvn net: 10.9.0.1.

But this is very strange:: Why does the list of hosts in your Firewall DYN DNS addon show the ip-address inside this opvn net 10.9.0.1. instead of the ip of the FQDN host (85.x.x.x.).? No connection, of course. packets run within a circle.

How did this information find its way into your Firewall DYN DNS addon?

Let me repeat: ovpnconnect runs on a laptop in green zone; it does not run not on ipfire. The only piece of information I keyed into Firewall Dyn Addon was the FQDN for ip 85.x.x.x. No static rules, nothing else,

Best wishes

Good morning.

The plugin I created is designed solely for dynamic public IPs, allowing you to create rules for them using the “Hostname” configured in the “Dynamic DNS” module of the IPFire Firewall. That’s all.

This module I created has nothing to do with the configuration and operation of OpenVPN. Therefore, if you have any questions about how OpenVPN works and how it assigns IPs internally, please look for information in the IPFire Wiki (www.ipfire.org - Welcome to IPFire Documentation) or ask your question more concisely in the Community.

Best regards.

2 Likes

Sir,

we’ve run into a little misunderstanding. Let me show a picture to you:

This IP (10.9.0.1) seen in this picture belongs to an ovpn-rw-client-subnet..
The rw-client is installed on my laptop. My laptop is
powered-off.
This rw-client belongs to a server running on an FQDN of
my webspace-Provider (85.xxx.xxx.xxx).

How does Firewall Dynamic Addon get to know about this IP?

I’ve never installed this rw-client on ipfire. Installation would be impossible because only n2n-connections can be imported.

ipfire has no static route.
Firewall Dynamic Addon should show 85.xxx.xxx.xxx instead of 10.9.0.1

Good morning.

Let me understand.

If, when you create the rule in the Addon (before establishing a VPN connection), it’s not created at all, what does that solve?

The problem is that everything seems fine, but once the VPN connection is established, the Addon rule, which was correct, now shows version 10.9.0.1, right?

If so, from IPFire via SSH or the console, run the following command and see what it returns:

nslookup your-fqdn-vpn.com

And with google resolution:

nslookup your-fqdn-vpn.com 8.8.8.8

Try these tests before and after making the first connection to the VPN server.

Bye.

Sir,

laptop ist power-off. Nothing is connected to my webspace.

On ipfire-console (ssh, root)

nslookupyour-fqdn-vpn.comanswers:

Server: 127.0.0.1

Address: 127.0.0.1#53

non-authoritative answer:

Name (correct your-fqdn-vpn.com)

Address: 10.9.0.1

nslookupyour-fqdn-vpn.com8.8.8.8 answers:

Server: 8.8.8.8

Address: 8.8.8.8#:53

non-authoritative answer:

Name (correct your-fqdn-vpn.com)

Address: 10.9.0.1

I cannot reach the vpn-server from my laptop in green if I activate the ovpnclient.

ipifre status connection shows:

My laptop tries to reach 10.9.0.1. via RED. There is nothing to reach.

It should try your.fqdn.vpn.com (85.xxx.xxx.xxx)..

nslookup answers exactly the same as before.

Best Wishes

HI.

IPFire uses dnsmasq as its DNS cache. If that FQDN previously resolved to 10.9.0.1 (perhaps due to a VPN provider configuration), it was cached. The TTL might be holding that incorrect entry.

Possible solution is: Clear DNS cache: Restart dnsmasq.

The operation of dnsmasq is completely independent of this add-on. You can search for how to purge/reset the dnsmasq tables and try to resolve the issue.

Bye.

dnsmasq was replaced by unbound in CU106

1 Like

Ups. ;->

Thanks Adolf for clarification.

Then, restart Unbound.

Bye.

Sir,

ipfire reboots automatically every night.

Does a reboot no cleanup of unbound’s cache? Which cron cmd is necessary to reach that?

The entry in Firewall Dyn Addon is 3 weeks old.

bye

I just installed the add-on, but without connecting to the VPN, does the IP address appear correctly? To test this, delete it and recreate it without connecting the VPN client on your laptop.

Let me know what you see.

Cheers.

Sir,

yesterday I deleted the entry from Firewall Dyn Addon.

About 6 hours later ipfire rebooted automatically.

Now I’m about 13 hours after reboot, I tested on console and got the same answers as I received 4 days ago.

Check: The entry in Firwall Dyn Addon did not come back.

How does ipfire still know about the address?

Well. We’re getting fixated on the idea that the problem is the add-on. This add-on is completely neutral, not modifying IPFire’s functionality in any way. Therefore, if you’re getting the same results from the add-on via SSH or the IPFire Terminal Console, it’s IPFire itself that’s resolving the issue this way.

If the add-on shows this result, it’s because IPFire is resolving it this way.

The solution would be to determine why IPFire is assigning this IP address, and the best way to do that is to create a new issue and ask the community about it.

I’m sorry I can’t be of more help with this.

Regards

Sir,

Roberto and me are in difficulties concerning dns-cache.

Is dns-cache not cleaned up within a complete reboot of ipfire?

May you please have a look at our last posts and help us out?

I’m on core 199 and I suspect something could be wrong inside unbound / dns-cache. I use fixed IPs for WAN and LAN. No dhcp at all.

I realized trouble inside my green network, too:

My linux nas is located as server in GREEN. It has got smb-directories with subdiretories on it.

I opened a pdf-file inside one of the subdirectorys and closed it again.

Then I tried to move the whole subdirectory into another subdirectory on the same server for archive purposes.

Error message: directory in use / open files. No chance for movement, even for 6-7 hours.

nas shuts down every night.

If I move again the next morning, the movement works.

Movements like this worked without issues since 5 years. Issues came up in january after installation of core 199.

Best wishes

Yes the unbound cache is cleared when a reboot is carried out.

If you are using fixed IP’s for your access then you don’t need unbound or do you mean you use an FQDN that is assigned a fixed IP. Are you assigning this fixed IP in the Hosts menu or where? If you want to use an FQDN thgen the assignment of IP to FQDN has to be defined on the Hosts page if you are not using DHCP at all.

I would first uninstall the unofficial firewall_dyn addon and try whatever it is you are trying to do and then report if you still have the same issues. Then whatever logs you have can be reviewed on this forum to try and see what errors are occurring.

This has nothing to do with IPFire.
You are trying to move files on a server in your green lan to another directory on the same server.
Something else on that server is accessing the directory or files you are trying to move.
IPFire does not play any part in moving files from one directory to another directory on the same server.

2 Likes