#!/usr/sbin/sh # # # # Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. # . /lib/svc/share/ipf_include.sh create_ipf_rules() { FMRI=$1 ipf_file=`fmri_to_file ${FMRI} $IPF_SUFFIX` nat_file=`fmri_to_file ${FMRI} $NAT_SUFFIX` policy=`get_policy ${FMRI}` # # Ftp uses two ports, ftp and ftp-data, see /etc/services which # is why it's necessary to have this custom method. # conn_port=`$SERVINFO -p -t -s ftp 2>/dev/null` data_port=`$SERVINFO -p -t -s ftp-data 2>/dev/null` echo "# $FMRI" >$ipf_file generate_rules $FMRI $policy "tcp" "any" $conn_port $ipf_file generate_rules $FMRI $policy "tcp" "any" $data_port $ipf_file # Generate a custom NAT rule here to use the ftp-proxy # echo "# $FMRI" >$nat_file echo "rdr * any -> 0/32 proxy port ftp ftp/tcp" >>$nat_file } case "$1" in 'ipfilter') create_ipf_rules $2 ;; *) echo "Usage: $0 ipfilter" ;; esac exit 0