LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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


View Poll Results: I reviewed this proposal, and I think:
Not a bad idea 15 42.86%
Bad idea 20 57.14%
Voters: 35. You may not vote on this poll

Reply
  Search this Thread
Old 12-09-2022, 01:29 PM   #16
metaed
Member
 
Registered: Apr 2022
Location: US
Distribution: Slackware64 15.0
Posts: 375

Original Poster
Rep: Reputation: 174Reputation: 174

Quote:
Originally Posted by ponce View Post
IMHO, as an rc.firewall is supposed (in any of the implementation I have seen) to start from a blank set of iptables rules, not with loading existing ones
Actually, rc.firewall is the script responsible for loading existing rules. Consider the rc.firewall generated by Alien Bob's firewall builder (see: Basic Security at docs.slackware.com). It loads an existing ruleset that is embedded in the script itself as iptables commands. My package's rc.firewall loads an existing ruleset from a separate .conf file, which is a trivial difference.

Quote:
Originally Posted by ponce View Post
a call in rc.6 shouldn't be needed to save the existing rules
I agree. It's not needed. It might be useful to some Slackware operators and useless to others.

My package includes tools that update the running ruleset in real time. I detect intrusion attempts and immediately add the attacking IPs to an NFT address set used to drop packets. I also maintain a geofilter as a list of IP ranges, also in an NFT address set used to drop packets, and that gets dynamically updated once a month.

Because I am routinely updating the running ruleset in real time, it becomes highly useful to save the running ruleset at shutdown (and periodically in case of a crash), and restore it at startup. Again, not something that will appeal to everyone, but it does a great job for me.
 
Old 12-09-2022, 01:42 PM   #17
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,922

Rep: Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040
I'm not a fan of the idea of automatically carrying firewall state over a shutdown/reboot. I'd rather see such things left as a manual operation so that no rules accidentally become persistent.

Last edited by GazL; 12-09-2022 at 01:45 PM.
 
6 members found this post helpful.
Old 12-09-2022, 02:14 PM   #18
metaed
Member
 
Registered: Apr 2022
Location: US
Distribution: Slackware64 15.0
Posts: 375

Original Poster
Rep: Reputation: 174Reputation: 174
Quote:
Originally Posted by henca View Post
different custom rc.firewall from different sources might behave differently. Some of those scripts might not care about any arguments like "start", "stop", "restart" or "status" and regardless of argument only start the firewall again. Depending upon how the script is done it might be more or less bad to start it a second time.
This is a good point, thank you Henrik.
 
Old 12-09-2022, 02:19 PM   #19
metaed
Member
 
Registered: Apr 2022
Location: US
Distribution: Slackware64 15.0
Posts: 375

Original Poster
Rep: Reputation: 174Reputation: 174
Quote:
Originally Posted by GazL View Post
I'm not a fan of the idea of automatically carrying firewall state over a shutdown/reboot
Yeah, that specific purpose is great for me but certainly not for everyone. I'm not proposing that -- I'm proposing rc.firewall stop should be called during shutdown, for packages or site operators to utilize as they see fit.
 
Old 12-09-2022, 05:40 PM   #20
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
Why not suggest the save function to users as an optional feature with instructions on how to set it in custom rc.local_shutown?
 
Old 12-09-2022, 09:58 PM   #21
metaed
Member
 
Registered: Apr 2022
Location: US
Distribution: Slackware64 15.0
Posts: 375

Original Poster
Rep: Reputation: 174Reputation: 174
Quote:
Originally Posted by keefaz View Post
Why not ...
I think I covered this above -- (i) avoid manual steps (ii) this is a tangent. Probably I overshared what my first use of the shutdown hook would be, and created confusion about what I was asking for. The request is for the hook, not for the first use I have in mind for it personally.
 
Old 12-09-2022, 10:28 PM   #22
enorbet
Senior Member
 
Registered: Jun 2003
Location: Virginia
Distribution: Slackware = Main OpSys
Posts: 4,811

Rep: Reputation: 4447Reputation: 4447Reputation: 4447Reputation: 4447Reputation: 4447Reputation: 4447Reputation: 4447Reputation: 4447Reputation: 4447Reputation: 4447Reputation: 4447
I'm not sure I fully grasp this. I do understand that one of the difficulties remaining in SysV Init or any serial init system, centers around orphaned processes. It seems to me that once a network interface is stopped or disabled, iptables becomes something like an orphaned process, right? What I don't get is why that should ever be a problem even in a serial init system. It isn't the equivalent of the old "lazy write" issues is it?
 
1 members found this post helpful.
Old 12-10-2022, 02:57 AM   #23
chrisretusn
Senior Member
 
Registered: Dec 2005
Location: Philippines
Distribution: Slackware64-current
Posts: 2,993

Rep: Reputation: 1565Reputation: 1565Reputation: 1565Reputation: 1565Reputation: 1565Reputation: 1565Reputation: 1565Reputation: 1565Reputation: 1565Reputation: 1565Reputation: 1565
Quote:
Originally Posted by metaed View Post
You are right to say this, in the sense that an rc.firewall is not distributed, and there is only a hook provided in rc.inet2 to run it, if one gets created. So yes, you could say rc.firewall is not a "part" of Slackware. But the name exists as a hook in rc.inet2. What is missing is the analogous hook in rc.6. The proposed change to rc.6 would be an exact parallel to what rc.inet2 already does at startup.
Sounds reasonable to me.
 
2 members found this post helpful.
Old 12-10-2022, 05:38 AM   #24
marav
LQ Sage
 
Registered: Sep 2018
Location: Gironde
Distribution: Slackware
Posts: 5,453

Rep: Reputation: 4211Reputation: 4211Reputation: 4211Reputation: 4211Reputation: 4211Reputation: 4211Reputation: 4211Reputation: 4211Reputation: 4211Reputation: 4211Reputation: 4211
We already have the possibility for that, with Sysvinit start/stop compliancy

Just make symlink of rc.firewall in rc0.d, rc1.d and rc6.d
e.g.
Code:
for i in 0 1 6
    do ln -s /etc/rc.d/rc.firewall /etc/rc.d/rc${i}.d/Krc.firewall
done
 
2 members found this post helpful.
Old 12-10-2022, 07:20 AM   #25
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,385

Rep: Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764
Quote:
During multiuser startup, rc.firewall, if it exists, is called as rc.firewall start by rc.inet2, just before any network daemons are started.

But it is not called during shutdown as rc.firewall stop.
In /etc/rc.d/rc.6 there is:
Code:
# Run any local shutdown scripts:
if [ -x /etc/rc.d/rc.local_shutdown ]; then
  /etc/rc.d/rc.local_shutdown stop
fi
What am I missing that having code to handle the saving of the firewall rules could not be placed in /etc/rc.d/rc.local_shutdown, checking for the stop parameter if required? Local customisations are intended to be handled in /etc/rc.d/local and /etc/rc.d/rc.local_shutdown. I see no need for the proposed hook to be generally available.

PS - Slackware does not ship a rc.firewall script, but it does ship two basic firewall scripts from Roaring Penguin Software (firewall-masq and firewall-standalone in /etc/ppp/).

Last edited by allend; 12-10-2022 at 07:23 AM.
 
3 members found this post helpful.
Old 12-10-2022, 06:15 PM   #26
avian
Member
 
Registered: Aug 2014
Posts: 184

Rep: Reputation: Disabled
I cant speak for anyone else, but I suspect there would be others like myself who have scripted their own rc.firewall without checking for a start/stop argument, and the introduction of such a change would really wreak havoc.

I don't see the purpose in making the change for many of the reasons already mentioned. But if the change did occur, the only thing I'd ask for is a bunch of notice so it doesn't come about unexpectedly and catch me by surprise.

Last edited by avian; 12-10-2022 at 07:17 PM.
 
6 members found this post helpful.
Old 12-10-2022, 08:10 PM   #27
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,276
Blog Entries: 24

Rep: Reputation: 4224Reputation: 4224Reputation: 4224Reputation: 4224Reputation: 4224Reputation: 4224Reputation: 4224Reputation: 4224Reputation: 4224Reputation: 4224Reputation: 4224
Quote:
Originally Posted by kingbeowulf View Post
Any service/daemon that Slackware (optionally) starts, Slackware should stop on shutdown or reboot.
But the firewall start script for many users, perhaps most, is fundamentally different from many other init scripts in that it does not start a process or daemon in many cases, and may start a variety of processes in others.

For the simple cases where the script only uses iptables or nftables commands to add packet filtering rules into the Linux kernel there is literally nothing to "stop". This is a lowest common denominator use case and is probably the intended case handled by the inet2 script.

Those who start other processes from their firewall scripts almost by definition know how and when they may want to stop those processes and have provided a method for doing so.

The point being that there is no clear use case for a default stop condition.

Quote:
Originally Posted by GazL View Post
I'm not a fan of the idea of automatically carrying firewall state over a shutdown/reboot. I'd rather see such things left as a manual operation so that no rules accidentally become persistent.
Absolutely!

You may want to save some state across system boot, especially with adaptive rules, but a simple iptables-save is far from a desirable default IMO.

Again, if you need to take some action at shutdown you probably already do so. If not, there is nothing useful to do and no clear use case for a default stop condition.

Last edited by astrogeek; 12-10-2022 at 10:27 PM. Reason: stop condition
 
11 members found this post helpful.
Old 12-11-2022, 06:53 AM   #28
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,385

Rep: Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764Reputation: 2764
Quote:
But the firewall start script for many users, perhaps most, is fundamentally different from many other init scripts in that it does not start a process or daemon in many cases, and may start a variety of processes in others.
Indeed. That is why /etc/rc.d/rc.inet2 (that runs /etc/rc.d/rc.firewall if executable) is called in /etc/rc.d/rc.M before any networked file systems are mounted. For most users it needs to run early and can be ignored without additional processing on shutdown.

Last edited by allend; 12-11-2022 at 07:10 AM.
 
4 members found this post helpful.
Old 12-12-2022, 03:46 PM   #29
metaed
Member
 
Registered: Apr 2022
Location: US
Distribution: Slackware64 15.0
Posts: 375

Original Poster
Rep: Reputation: 174Reputation: 174
Quote:
Originally Posted by enorbet View Post
once a network interface is stopped or disabled, iptables becomes something like an orphaned process, right?
If I understand your question right, the answer depends on what the installed rc.firewall does. If rc.firewall start does more than just load static rules, if for example it starts a process that updates rules in real time based on intrusion detection, then the call to rc.firewall stop would stop that process.
 
Old 12-12-2022, 03:57 PM   #30
metaed
Member
 
Registered: Apr 2022
Location: US
Distribution: Slackware64 15.0
Posts: 375

Original Poster
Rep: Reputation: 174Reputation: 174
Quote:
Originally Posted by allend View Post
What am I missing that having code to handle the saving of the firewall rules could not be placed in /etc/rc.d/rc.local_shutdown, checking for the stop parameter if required?
If memory serves, I covered that at the top of the thread. Yes, that's what you should do for a locally written customization. But I'm developing a package. Manual edits around installation/removal of a package are sometimes a necessary evil. In this case, because the package supplies rc.firewall, and Slackware already has a startup hook for rc.firewall, a corresponding shutdown hook would avoid the manual edits.

Quote:
Originally Posted by allend View Post
Slackware ... does ship two basic firewall scripts from Roaring Penguin Software (firewall-masq and firewall-standalone in /etc/ppp/).
Thank you for the pointer, I'll read them. I'm wondering because they are in a directory called /etc/ppp does that mean they are specific to PPP connections?
 
  


Reply

Tags
firewall, init, nftables



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
[SOLVED] Identifying a stop job running into timeout during shutdown JZL240I-U Linux - Software 20 07-06-2023 10:52 AM
[SOLVED] Why does this bash script work if called from the command line but not when called from a php script run by a webpage? KenHorse Linux - General 10 08-23-2021 05:39 AM
what is the default powerstate (e.g. S3,S4,S5) for the command 'shutdown -hP' or 'shutdown -hH' or 'shutdown -h' badbetty Slackware 6 11-12-2017 12:18 AM
[SOLVED] Destructor called on objects in deque without it being called explicitly Snark1994 Programming 4 07-13-2011 08:05 AM
shutdown hang during eth0 shutdown kurtisw Linux - Networking 5 10-30-2003 02:49 PM

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

All times are GMT -5. The time now is 10:22 AM.

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