Koozali.org: home of the SME Server

Help making cutom template for iptables

Offline gelcube

  • ***
  • 55
  • +0/-0
    • http://www.ninetails.net
Help making cutom template for iptables
« on: December 12, 2005, 07:44:09 PM »
Hiya, everyone.  I'm playing with Shoutcast on my SME 6.0.1_01 server, and the server comes up just fine.  My problem is the iptables config.  I found out that by running.
 
Code: [Select]
iptables -A InboundTCP_21265 -p tcp --dport 8000 -j ACCEPT
iptables -A InboundTCP_21265 -p tcp --dport 8001 -j ACCEPT


Everything runs great.  My problem started when I attempted to create a custom template.  It appears the InboundTCP chain is created new after reboots and such.  What do I need in my custom template to make sure it goes into the correct chain?

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: Help making cutom template for iptables
« Reply #1 on: December 12, 2005, 07:50:07 PM »
Quote from: "gelcube"

What do I need in my custom template to make sure it goes into the correct chain?


Have a look at some of the /etc/e-smith/templates/etc/rc.d/init.d/masq/45Allow* fragments.

You'll need to do:

/sbin/e-smith/config set shoutcast service \
 status enabled \
 access public

for a fragment like those to work correctly.

For SME 7.0, you won't need a template fragment, just a db property to list the ports which need to be open for that service.

Offline gelcube

  • ***
  • 55
  • +0/-0
    • http://www.ninetails.net
Help making cutom template for iptables
« Reply #2 on: December 12, 2005, 08:24:58 PM »
Ahh, that worked like a charm, thanks Charlie!   :-D

I just made the directory /etc/e-smith/templates-custom/etc/rc.d/init.d/masq, then copied /etc/e-smith/templates/etc/rc.d/init.d/masq/45AllowPPTP (picked at random) to /etc/e-smith/templates-custom/etc/rc.d/init.d/masq/45AllowShoutcast, edited the port lines, dropped your config command into the console, ran

Code: [Select]
/sbin/e-smith/expand-template /etc/rc.d/init.d/masq
/sbin/e-smith/signal-event reboot

 and voila, there it is.

Now all I have to do is figure out how to get shoutcast to run at startup.  On to another search!  LOL

Again, thanks Charlie.