On 09/19/2015 09:01 AM, Ob Noxious wrote:
> Hi,
> 
> I'm playing a bit with GlusterFS - https://www.gluster.org/ - and of
> course, I want it to work flawlessly with Shorewall.
> 
> GlusterFS needs some TCP ports for the control channel (the easy part:
> 24007/tcp) but it also need some dynamically opened ports.
> 
> In a nutshell : If you create a distributed filesystem consisting of 4
> nodes (called bricks in GFS jargon) then it needs TCP port 49152 + 3
> more for for the 4 bricks.
> 
> See here for the details :
> https://www.gluster.org/community/documentation/index.php/Basic_Gluster_Troubleshooting
> 
> How could we declare a smart macro for GlusterFS without pre-allowing to
> many ports? (ie: avoid hardcoding something like 49152-49160)

Attached is an inlineable action that accepts two parameters:

- The number of bricks in the cluster   :Default is 2
- Enable Infiniband port 24008 (0 or 1) :Default is 0 (Don't open 24008)

Add

  GlusterFS             inline   # Handles Gluster FS

to /etc/shorewall/actions and place the attached file in /etc/shorewall.

This will be a standard Shorewall action in 5.0.0 Beta 2.

-Tom
-- 
Tom Eastep        \ When I die, I want to go like my Grandfather who
Shoreline,         \ died peacefully in his sleep. Not screaming like
Washington, USA     \ all of the passengers in his car
http://shorewall.net \________________________________________________
#
# Shorewall version 5 - GlusterFS Handler for GlusterFS 3.4 and Later
#
# /etc/shorewall/action.GlusterFS
#
# Parameters:
#       Bricks:         Number of bricks
#       IB:             0 or 1, indicating whether Infiniband is used or not
#
#########################################################################################
?format 2

DEFAULTS 2,0

?begin perl

use Shorewall::Config qw(:DEFAULT :internal);
use Shorewall::Chains;
use Shorewall::Rules;
use strict;

my ( $bricks, $ib ) = get_action_params( 2 );

fatal_error "Invalid value for Bricks ( $bricks )" unless $bricks =~ /^\d+$/ && 
$bricks > 1 && $bricks < 1024;
fatal_error "Invalid value for IB ( $ib )" unless $ib =~ /^[01]$/;

?end perl


#ACTION         SOURCE          DEST            PROTO   DEST    SOURCE          
ORIGINAL        RATE            USER/   MARK    CONNLIMIT       TIME         
HEADERS         SWITCH        HELPER
#                                                       PORT    PORT(S)         
DEST            LIMIT           GROUP
ACCEPT          -               -               udp     111,2049
ACCEPT          -               -               tcp     38465:38467

?if @{2}
ACCEPT          -               -               tcp     24007:24008
?else
ACCEPT          -               -               tcp     24007
?endif

?set last_port 49150 + @{1}

ACCEPT          -               -               tcp     49151:$last_port

Attachment: signature.asc
Description: OpenPGP digital signature

------------------------------------------------------------------------------
_______________________________________________
Shorewall-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/shorewall-users

Reply via email to