LinuxQuestions.org
Help answer threads with 0 replies.
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, 11:35 AM   #1
metaed
Member
 
Registered: Apr 2022
Location: US
Distribution: Slackware64 15.0
Posts: 371

Rep: Reputation: 172Reputation: 172
rc.firewall stop should be called during shutdown


Thought I would propose this idea here and open it up for review, so I can find out how stupid it might be.

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. This is problematic not because there's a need to lower shields during shutdown, but because there's sometimes a need to do something during shutdown.

In my case, a package I'm developing snapshots the running firewall ruleset to disk during shutdown.

This is not what I'm proposing, though. I'm just proposing that a call to rc.firewall stop should be added to rc.6. This could be just before running rc.inet1 stop, but maybe a bit sooner, before unmounting remote filesystems, to give it the broadest option to save something to disk.

The package I'm developing works around the lack of rc.firewall stop by adding K-type links to rc.firewall in rc[016].d. But it would be best to avoid using System V initscripts in a package because Slackware is BSD-initscript-centric.

Last edited by metaed; 12-09-2022 at 02:52 PM.
 
Old 12-09-2022, 11:44 AM   #2
marav
LQ Sage
 
Registered: Sep 2018
Location: Gironde
Distribution: Slackware
Posts: 5,404

Rep: Reputation: 4139Reputation: 4139Reputation: 4139Reputation: 4139Reputation: 4139Reputation: 4139Reputation: 4139Reputation: 4139Reputation: 4139Reputation: 4139Reputation: 4139
rc.firewall is not a part of Slackware

So, it's up to you to adapt things to your needs
 
1 members found this post helpful.
Old 12-09-2022, 11:51 AM   #3
Windu
Member
 
Registered: Aug 2021
Distribution: Arch Linux, Debian, Slackware
Posts: 594

Rep: Reputation: Disabled
Quote:
Originally Posted by marav View Post
rc.firewall is not a part of Slackware

So, it's up to you to adapt things to your needs
In rc.inet2:
Code:
# If there is a firewall script, run it before enabling packet forwarding.
# See the HOWTOs on http://www.netfilter.org/ for documentation on
# setting up a firewall or NAT on Linux. In some cases this might need to
# be moved past the section below dealing with IP packet forwarding.
if [ -x /etc/rc.d/rc.firewall ]; then
  /etc/rc.d/rc.firewall start
fi
 
2 members found this post helpful.
Old 12-09-2022, 12:03 PM   #4
metaed
Member
 
Registered: Apr 2022
Location: US
Distribution: Slackware64 15.0
Posts: 371

Original Poster
Rep: Reputation: 172Reputation: 172
Quote:
Originally Posted by marav View Post
rc.firewall is not a part of Slackware
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.
 
Old 12-09-2022, 12:17 PM   #5
jmccue
Member
 
Registered: Nov 2008
Location: US
Distribution: slackware
Posts: 703
Blog Entries: 1

Rep: Reputation: 384Reputation: 384Reputation: 384Reputation: 384
If you need to do something with the firewall, you can always use /etc/rc.d/rc.local_shutdown

Not sure why one would need to do something with the firewall on shutdown. But my needs are simple
 
5 members found this post helpful.
Old 12-09-2022, 12:21 PM   #6
LuckyCyborg
Senior Member
 
Registered: Mar 2010
Posts: 3,549

Rep: Reputation: 3403Reputation: 3403Reputation: 3403Reputation: 3403Reputation: 3403Reputation: 3403Reputation: 3403Reputation: 3403Reputation: 3403Reputation: 3403Reputation: 3403
What sense makes a poll for a Slackware feature? Since when Slackware became a democracy?

OP, you should convince our BDFL, not to play with polls...

Last edited by LuckyCyborg; 12-09-2022 at 12:24 PM.
 
Old 12-09-2022, 12:24 PM   #7
metaed
Member
 
Registered: Apr 2022
Location: US
Distribution: Slackware64 15.0
Posts: 371

Original Poster
Rep: Reputation: 172Reputation: 172
Quote:
Originally Posted by jmccue View Post
you can always use /etc/rc.d/rc.local_shutdown
Manually, yes, absolutely. But a package shouldn't create an rc.local_shutdown, nor should its doinst.sh try to modify an existing one.

Quote:
Originally Posted by jmccue View Post
Not sure why one would need to do something with the firewall on shutdown
In my case, to snapshot the running NFT ruleset to disk.
 
Old 12-09-2022, 12:26 PM   #8
kingbeowulf
Senior Member
 
Registered: Oct 2003
Location: WA
Distribution: Slackware
Posts: 1,267
Blog Entries: 11

Rep: Reputation: 744Reputation: 744Reputation: 744Reputation: 744Reputation: 744Reputation: 744Reputation: 744
Since a hook exists in rc.inet1, I see no reason not to have a similar hook in rc.6 (or where ever appropriate) for completeness. Any service/daemon that Slackware (optionally) starts, Slackware should stop on shutdown or reboot.

Personally, I do currently use rc.local_shutdown as a workaround for rc.firewall.
 
3 members found this post helpful.
Old 12-09-2022, 12:27 PM   #9
LuckyCyborg
Senior Member
 
Registered: Mar 2010
Posts: 3,549

Rep: Reputation: 3403Reputation: 3403Reputation: 3403Reputation: 3403Reputation: 3403Reputation: 3403Reputation: 3403Reputation: 3403Reputation: 3403Reputation: 3403Reputation: 3403
Quote:
Originally Posted by metaed View Post
But a package shouldn't create an rc.local_shutdown, nor should its doinst.sh try to modify an existing one.
WHY not?
 
Old 12-09-2022, 12:28 PM   #10
metaed
Member
 
Registered: Apr 2022
Location: US
Distribution: Slackware64 15.0
Posts: 371

Original Poster
Rep: Reputation: 172Reputation: 172
Quote:
Originally Posted by LuckyCyborg View Post
Since when Slackware became a democracy? you should convince our BDFL
Quite right. For me, step one was to ask for reactions from other Slackware enthusiasts [edit: to find out if my idea is stupid before trying that]. A poll seemed like an effective way to see the reactions in a nutshell.

Last edited by metaed; 12-09-2022 at 01:34 PM.
 
Old 12-09-2022, 12:42 PM   #11
metaed
Member
 
Registered: Apr 2022
Location: US
Distribution: Slackware64 15.0
Posts: 371

Original Poster
Rep: Reputation: 172Reputation: 172
Quote:
Originally Posted by LuckyCyborg View Post
WHY not?
That's a fair question. A package shouldn't create or modify an rc.local_shutdown because it is likely to break the operator's existing carefully crafted one.

The package can certainly give the operator instructions for doing it on their own, and that's a reasonable "plan B" if this proposal gets shot down. But I don't prefer that approach because any manual procedure is error prone. I'd rather that a package install process involve as little manual post-installation as possible.
 
Old 12-09-2022, 12:42 PM   #12
ponce
LQ Guru
 
Registered: Aug 2004
Location: Pisa, Italy
Distribution: Slackware
Posts: 7,117

Rep: Reputation: 4192Reputation: 4192Reputation: 4192Reputation: 4192Reputation: 4192Reputation: 4192Reputation: 4192Reputation: 4192Reputation: 4192Reputation: 4192Reputation: 4192
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, a call in rc.6 shouldn't be needed to save the existing rules.
what you are asking looks related to settings specific to your application so, IMHO, it should be fine loading it with a dedicated rc.yourapp called in rc.local with the "start" option (and loading of existing rules, if present) and shutted down with the "stop" option (with saving of the rules) in rc.local_shutdown (like all the third-party scripts on SBo do).
it seems to me that, also if they do similar things rc.firewall and the script you are referring to should be separate.

Last edited by ponce; 12-09-2022 at 12:44 PM.
 
4 members found this post helpful.
Old 12-09-2022, 01:08 PM   #13
henca
Member
 
Registered: Aug 2007
Location: Linköping, Sweden
Distribution: Slackware
Posts: 990

Rep: Reputation: 674Reputation: 674Reputation: 674Reputation: 674Reputation: 674Reputation: 674
Quote:
Originally Posted by kingbeowulf View Post
I see no reason not to have a similar hook in rc.6 (or where ever appropriate) for completeness. Any service/daemon that Slackware (optionally) starts, Slackware should stop on shutdown or reboot.
The problem here is that rc.firewall is not distributed with Slackware and 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.

regards Henrik
 
2 members found this post helpful.
Old 12-09-2022, 01:24 PM   #14
hitest
Guru
 
Registered: Mar 2004
Location: Canada
Distribution: Void, Slackware, Debian, OpenBSD
Posts: 7,345

Rep: Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746
Thumbs up

Quote:
Originally Posted by LuckyCyborg View Post
Since when Slackware became a democracy?
I'm grateful that it is not a democracy. The development model of Slackware has never failed us thanks to the steady hand of our BDFL.
 
2 members found this post helpful.
Old 12-09-2022, 01:25 PM   #15
henca
Member
 
Registered: Aug 2007
Location: Linköping, Sweden
Distribution: Slackware
Posts: 990

Rep: Reputation: 674Reputation: 674Reputation: 674Reputation: 674Reputation: 674Reputation: 674
Quote:
Originally Posted by metaed View Post
That's a fair question. A package shouldn't create or modify an rc.local_shutdown because it is likely to break the operator's existing carefully crafted one.
I have created some custom packages where doinst.sh checks with grep if the startup script already contains what it wants there and otherwise adds it at the end of the script something like this:

However, in my case, I have a fixed /etc/rc.d/rc.local and /etc/rc.d/rc.shutdown which calls my custom scripts like /usr/local/etc/rc.d/rc.local and those scripts might call other more machine custom scripts like /usr/local/etc/rc.d/rc.custom

Still, here is an example of such doinst.sh which might modify not only a startup script but also a configuration file for snmpd:

Code:
#!/bin/bash

(cd opt/lsi/snmp/lib ; ln -sf libstorelib.so.4.02-0 libstorelib.so)
(cd usr/lib64 ; ln -sf libsas_objects.so.1.43-1 libsas_objects.so)

grep lsi_mrdsnmpmain etc/snmp/snmpd.conf
if [ $? -ne 0 ]; then
  echo "# This pass is required for MegaRAID SCSI/iSCSI SNMP" >> etc/snmp/snmpd.conf
  echo "pass .1.3.6.1.4.1.3582 /etc/lsi_mrdsnmp/lsi_mrdsnmpmain" >> etc/snmp/snmpd.conf
fi

grep lsi_mrdsnmpagent usr/local/etc/rc.d/rc.custom
if [ $? -ne 0 ]; then
  grep /bin usr/local/etc/rc.d/rc.custom
  if [ $? -ne 0 ]; then
    echo "#!/bin/sh" >> usr/local/etc/rc.d/rc.custom
    echo  >> usr/local/etc/rc.d/rc.custom
    chmod u+x usr/local/etc/rc.d/rc.custom
  fi
  echo "if [ -x /etc/lsi_mrdsnmp/lsi_mrdsnmpagent ]; then" >> usr/local/etc/rc.d/rc.custom
  echo "  /etc/lsi_mrdsnmp/lsi_mrdsnmpagent -c /etc/snmp/snmpd.conf" >> usr/local/etc/rc.d/rc.custom
  echo "fi" >> usr/local/etc/rc.d/rc.custom
fi
But these custom packages are only intended for machines where I am the administrator.

regards Henrik
 
2 members found this post helpful.
  


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 01:58 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