On 9/19/10 3:31 PM, Tom Eastep wrote:
> On 9/19/10 2:53 PM, Laurent CARON wrote:
>> Hi,
>>
>> I'm wondering what the best way to include IP addresses from a file (not 
>> params) is.
>>
>> I eg have a list of ip addresses in /etc/shorewall/ssh_allow.list and 
>> want to include it in shorewall's config.
>>
>> What's the best way to proceed ?
> 
> /etc/shorewall/params is processed by the shell. Write yourself some
> shell code that load the file as a comma-separated list into a shell
> variable.
> 
> e.g., SSH_ALLOW=ip1,ip2,...

For future reference, the following seems to work:

listify_file() { # $1 = file to 'listify'
    local list
    local addr

    while read addr; do
        [ -n "$list" ] && list=$list,$addr || list=$addr
    done < $1

    echo $list
}

SSH_ALLOW=$(listify_file $(find_file ssh_allow.list))


-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 \________________________________________________

Attachment: signature.asc
Description: OpenPGP digital signature

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Shorewall-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/shorewall-users

Reply via email to