From owner-freebsd-standards@freebsd.org Sun Feb 28 08:04:47 2016 Return-Path: Delivered-To: freebsd-standards@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D001FAB74DC for ; Sun, 28 Feb 2016 08:04:47 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C005A1BE3 for ; Sun, 28 Feb 2016 08:04:47 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id u1S84l51083364 for ; Sun, 28 Feb 2016 08:04:47 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-standards@FreeBSD.org Subject: [Bug 207553] A New variable of `firewall_nat_rules' in /etc/rc.conf Date: Sun, 28 Feb 2016 08:04:47 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: standards X-Bugzilla-Version: 11.0-CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Many People X-Bugzilla-Who: kiri@kx.openedu.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-standards@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Feb 2016 08:04:48 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D207553 Bug ID: 207553 Summary: A New variable of `firewall_nat_rules' in /etc/rc.conf Product: Base System Version: 11.0-CURRENT Hardware: Any OS: Any Status: New Severity: Affects Many People Priority: --- Component: standards Assignee: freebsd-standards@FreeBSD.org Reporter: kiri@kx.openedu.org Created attachment 167503 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D167503&action= =3Dedit Patchs for `firewall_nat_rules' of /etc/rc.firewall and /etc/defaults/rc.co= nf Now ipfw(8) firewall nat is represented by firewall_nat_* variables in /etc/rc.conf. All flags of nat rules were described by firewall_nat_flags like: firewall_nat_flags=3D"deny_in reset same_ports unreg_only redirect_port tcp 192.168.2.253:22 22253 redirect_port tcp 192.168.2.252:22 22252 " But more redirections add, longer firewall_nat_flags line expand. To use ipfw nat practically, redirection rules described in another file like a `/etc/ipfw_nat.rules' and specify it's file name in rc.conf by `firewall_nat_rules' variable. The new ipfw nat configuration is 1) Enable ipfw nat and specify nat global variables by firewall_nat_flags firewall_nat_enable=3D"YES" firewall_nat_interface=3D"em0" firewall_nat_flags=3D"deny_in reset same_ports unreg_only" 2) Then nat redirections specify in /etc/ipfw_nat.rules like redirect_port tcp 192.168.2.3:25 25 redirect_port tcp 192.168.2.4:80 80 redirect_port tcp 192.168.2.5:21 21 redirect_port tcp 192.168.2.254:12345 12345 redirect_port tcp 192.168.2.1:22 66932 redirect_port tcp 192.168.2.2:22 66053 redirect_port tcp 192.168.2.3:22 66025 redirect_port tcp 192.168.2.4:22 66080 redirect_port tcp 192.168.2.5:22 66401 redirect_port tcp 192.168.2.17:67890 66419 redirect_port tcp 192.168.2.132:22 66132 3) Set /etc/ipfw_nat.rules to firewall_nat_rules in /etc/rc.conf firewall_nat_rules=3D"/etc/ipfw_nat.rules" To be able to this, /etc/rc.firewall changes as follows: --- /etc/rc.firewall.org 2016-02-27 10:33:06.845684000 +0900 +++ /etc/rc.firewall 2016-02-28 16:02:08.404038000 +0900 @@ -162,6 +162,9 @@ case ${firewall_nat_enable} in [Yy][Ee][Ss]) if [ -n "${firewall_nat_interface}" ]; then + if [ -n "${firewall_nat_rules}" -a -r ${firewall_nat_rules} ]; then + firewall_nat_flags=3D"${firewall_nat_flags}= `cat ${firewall_nat_rules}`" + fi if echo "${firewall_nat_interface}" | \ grep -q -E '^[0-9]+(\.[0-9]+){0,3}$'; then firewall_nat_flags=3D"ip ${firewall_nat_interface} ${firewall_nat_flags}" --=20 You are receiving this mail because: You are the assignee for the bug.=