p7zip: assorted fixes
[oi-userland.git] / components / network / proftpd / svc-ftp
blob05a5aaa87ae2d1d30c52d85ef3bedc66ec96562c
1 #!/sbin/sh
3 # CDDL HEADER START
5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
20 # CDDL HEADER END
23 # Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
26 . /lib/svc/share/ipf_include.sh
28 create_ipf_rules()
30 FMRI=$1
31 ipf_file=`fmri_to_file ${FMRI} $IPF_SUFFIX`
32 nat_file=`fmri_to_file ${FMRI} $NAT_SUFFIX`
33 policy=`get_policy ${FMRI}`
36 # Ftp uses two ports, ftp and ftp-data, see /etc/services which
37 # is why it's necessary to have this custom method.
39 conn_port=`$SERVINFO -p -t -s ftp 2>/dev/null`
40 data_port=`$SERVINFO -p -t -s ftp-data 2>/dev/null`
42 echo "# $FMRI" >$ipf_file
43 generate_rules $FMRI $policy "tcp" $conn_port $ipf_file
44 generate_rules $FMRI $policy "tcp" $data_port $ipf_file
46 # Generate a custom NAT rule here to use the ftp-proxy
48 echo "# $FMRI" >$nat_file
49 echo "rdr * any -> 0/32 proxy port ftp ftp/tcp" >>$nat_file
52 case "$1" in
53 'ipfilter')
54 create_ipf_rules $2
58 echo "Usage: $0 ipfilter"
60 esac
61 exit 0