diff options
Diffstat (limited to 'net-firewall')
10 files changed, 437 insertions, 9 deletions
diff --git a/net-firewall/shorewall-init/ChangeLog b/net-firewall/shorewall-init/ChangeLog index cd9c6f80e64f..8ce8b69e91ac 100644 --- a/net-firewall/shorewall-init/ChangeLog +++ b/net-firewall/shorewall-init/ChangeLog @@ -1,6 +1,16 @@ # ChangeLog for net-firewall/shorewall-init -# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-firewall/shorewall-init/ChangeLog,v 1.2 2013/12/02 19:58:43 constanze Exp $ +# Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/net-firewall/shorewall-init/ChangeLog,v 1.3 2014/03/15 23:01:59 hwoarang Exp $ + +*shorewall-init-4.5.21.7 (15 Mar 2014) + + 15 Mar 2014; Markos Chandras <hwoarang@gentoo.org> + +files/4.5.21.7/01_Remove-ipset-functionality.patch, + +files/4.5.21.7/10-releasenotes.patch, +files/4.5.21.7/README.Gentoo.txt, + +files/4.5.21.7/shorewall-init.confd, +files/4.5.21.7/shorewall-init.initd, + +files/4.5.21.7/shorewall-init.systemd, +files/4.5.21.7/shorewallrc, + +shorewall-init-4.5.21.7.ebuild, metadata.xml: + Version bump. Bug #499174 thanks to Thomas D. *shorewall-init-4.5.21.4 (02 Dec 2013) @@ -19,4 +29,3 @@ +files/4.5.21.2/shorewall-init.initd, +files/4.5.21.2/shorewall-init.systemd, +shorewall-init-4.5.21.2.ebuild, +files/4.5.21.2/shorewallrc, +metadata.xml: Initial version of shorewall-init; Thanks to Thomas D. - diff --git a/net-firewall/shorewall-init/files/4.5.21.7/01_Remove-ipset-functionality.patch b/net-firewall/shorewall-init/files/4.5.21.7/01_Remove-ipset-functionality.patch new file mode 100644 index 000000000000..620e479f92fc --- /dev/null +++ b/net-firewall/shorewall-init/files/4.5.21.7/01_Remove-ipset-functionality.patch @@ -0,0 +1,27 @@ +--- shorewall-init.old 2013-09-08 23:25:36.364924304 +0200 ++++ shorewall-init 2013-09-08 23:29:27.418736392 +0200 +@@ -79,10 +79,6 @@ + fi + done + +- if [ -n "$SAVE_IPSETS" -a -f "$SAVE_IPSETS" ]; then +- ipset -R < "$SAVE_IPSETS" +- fi +- + return 0 + } + +@@ -100,13 +96,6 @@ + fi + done + +- if [ -n "$SAVE_IPSETS" ]; then +- mkdir -p $(dirname "$SAVE_IPSETS") +- if ipset -S > "${SAVE_IPSETS}.tmp"; then +- grep -qE -- '^(-N|create )' "${SAVE_IPSETS}.tmp" && mv -f "${SAVE_IPSETS}.tmp" "$SAVE_IPSETS" +- fi +- fi +- + return 0 + } + diff --git a/net-firewall/shorewall-init/files/4.5.21.7/10-releasenotes.patch b/net-firewall/shorewall-init/files/4.5.21.7/10-releasenotes.patch new file mode 100644 index 000000000000..2b7a21af798b --- /dev/null +++ b/net-firewall/shorewall-init/files/4.5.21.7/10-releasenotes.patch @@ -0,0 +1,13 @@ +This patch will update the version number in the release notes. + +See http://thread.gmane.org/gmane.comp.security.shorewall/30808 + +--- shorewall-init-4.5.21.7.old/releasenotes.txt 2014-03-08 16:35:39.000000000 +0100 ++++ shorewall-init-4.5.21.7/releasenotes.txt 2014-03-09 14:38:19.503337459 +0100 +@@ -1,5 +1,5 @@ + ---------------------------------------------------------------------------- +- S H O R E W A L L 4 . 5 . 2 1 . 6 ++ S H O R E W A L L 4 . 5 . 2 1 . 7 + ------------------------------------ + M a r c h 0 8 , 2 0 1 4 + ---------------------------------------------------------------------------- diff --git a/net-firewall/shorewall-init/files/4.5.21.7/README.Gentoo.txt b/net-firewall/shorewall-init/files/4.5.21.7/README.Gentoo.txt new file mode 100644 index 000000000000..f7b13fed3de6 --- /dev/null +++ b/net-firewall/shorewall-init/files/4.5.21.7/README.Gentoo.txt @@ -0,0 +1,30 @@ +shorewall-init from upstream offers two features (taken from [1]): + + 1. It can 'close' the firewall before the network interfaces are + brought up during boot. + + 2. It can change the firewall state as the result of interfaces + being brought up or taken down. + +On Gentoo we only support the first feature -- the firewall lockdown during +boot. + +We do not support the second feature, because Gentoo doesn't support a +if-{up,down}.d folder like other distributions do. If you would want to use +such a feature, you would have to add a custom action to /etc/conf.d/net +(please refer to the Gentoo Linux Handbook [2] for more information). +If you are able to add your custom {pre,post}{up,down} action, your are +also able to specify what shorewall{6,-lite,6-lite} should do, so there is +no need for upstream's scripts in Gentoo. + +If you disagree with us, feel free to open a bug [3] and contribute your +solution for Gentoo. + +Upstream's original init script also supports saving and restoring of +ipsets. Please use the init script from net-firewall/ipset if you need +such a feature. + + +[1] http://www.shorewall.net/Shorewall-init.html +[2] http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=4&chap=5 +[3] https://bugs.gentoo.org diff --git a/net-firewall/shorewall-init/files/4.5.21.7/shorewall-init.confd b/net-firewall/shorewall-init/files/4.5.21.7/shorewall-init.confd new file mode 100644 index 000000000000..4ca0024579f7 --- /dev/null +++ b/net-firewall/shorewall-init/files/4.5.21.7/shorewall-init.confd @@ -0,0 +1,9 @@ +# List the Shorewall products that Shorewall-init is to +# initialize (space-separated list). +# +# Sample: PRODUCTS="shorewall shorewall6-lite" +# +PRODUCTS="" + +# Startup options - set verbosity to 0 (minimal reporting) +OPTIONS="-V0" diff --git a/net-firewall/shorewall-init/files/4.5.21.7/shorewall-init.initd b/net-firewall/shorewall-init/files/4.5.21.7/shorewall-init.initd new file mode 100644 index 000000000000..95c5581f5961 --- /dev/null +++ b/net-firewall/shorewall-init/files/4.5.21.7/shorewall-init.initd @@ -0,0 +1,196 @@ +#!/sbin/runscript +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-firewall/shorewall-init/files/4.5.21.7/shorewall-init.initd,v 1.1 2014/03/15 23:01:59 hwoarang Exp $ + +SHOREWALLRC_FILE="@GENTOO_PORTAGE_EPREFIX@/usr/share/shorewall/shorewallrc" +CONFIG_FILE="@GENTOO_PORTAGE_EPREFIX@/etc/conf.d/${SVCNAME}" + +description="Puts Shorewall in a safe state at boot time" +description="${description} prior to bringing up the network." + +required_files="$SHOREWALLRC_FILE" + +depend() { + need localmount + before net + after bootmisc ipset tmpfiles.setup ulogd +} + + +. $SHOREWALLRC_FILE + +checkconfig() { + local PRODUCT= + + if [ -z "${VARLIB}" ]; then + eerror "\"VARLIB\" isn't defined or empty! Please check" \ + "\"${SHOREWALLRC_FILE}\"." + + + return 1 + fi + + if [ -z "${PRODUCTS}" ]; then + eerror "${SVCNAME} isn't configured! Please check" \ + "\"${CONFIG_FILE}\"." + + + return 1 + fi + + for PRODUCT in ${PRODUCTS}; do + if [ ! -x ${SBINDIR}/${PRODUCT} ]; then + eerror "Invalid product \"${PRODUCT}\" specified" \ + "in \"${CONFIG_FILE}\"!" + eerror "Maybe \"${PRODUCT}\" isn't installed?" + + + return 1 + fi + done + + + return 0 +} + +check_firewall_script() { + if [ ! -x ${STATEDIR}/firewall ]; then + if [ ${PRODUCT} = shorewall -o ${PRODUCT} = shorewall6 ]; then + ebegin "Creating \"${STATEDIR}/firewall\"" + ${SBINDIR}/${PRODUCT} compile 1>/dev/null + eend $? + else + eerror "\"${PRODUCT}\" isn't configured!" + eerror "Please go to your 'administrative system'" \ + "and deploy the compiled firewall" \ + "configuration for this system." + + + return 1 + fi + fi + + + return 0 +} + +is_allowed_to_be_executed() { + # This is not a real service. shorewall-init is an intermediate + # script to put your Shorewall-based firewall into a safe state + # at boot time prior to bringing up the network. + # Please read /usr/share/doc/shorewall-init-*/README.gentoo.gz + # for more information. + # When your system is up, there is no need to call shorewall-init. + # Please call shorewall{,6,-lite,6-lite} directly. That's the + # reason why we are preventing start, stop or restart here. + + local PRODUCT= + + if [ "${RC_RUNLEVEL}" != "boot" -a "${RC_CMD}" = "start" ]; then + # Starting shorewall-init is only allowed at boot time + eerror "This is a boot service, which can only be started" \ + "at boot." + eerror "If you want to get your shorewall-based firewall" \ + "into the same safe boot state again, run" + eerror "" + eindent + for PRODUCT in ${PRODUCTS}; do + eerror "/etc/init.d/${PRODUCT} stop" + done + eoutdent + eerror "" + eerror "Yes, \"stop\" and not start." + eerror "" + return 1 + fi + + if [ "${RC_RUNLEVEL}" != "shutdown" -a "${RC_CMD}" = "stop" ]; then + # Stopping shorewall-init is only allowed at shutdown + eerror "This is a boot service, which cannot be stopped." + eerror "If you really want to stop your Shorewall-based" \ + "firewall the same way this service would stop" \ + "Shorewall at shutdown, please run" + eerror "" + eindent + for PRODUCT in ${PRODUCTS}; do + eerror "/etc/init.d/${PRODUCT} clear" + done + eoutdent + eerror "" + eerror "Keep in mind that this will clear (=bring down)" \ + "your firewall!" + eerror "" + return 1 + fi + + if [ "${RC_CMD}" = "restart" ]; then + eerror "This is a boot service, which cannot be restarted." + eerror "If you want to restart any of your Shorewall-based" \ + "firewalls, run" + eerror "" + eindent + for PRODUCT in ${PRODUCTS}; do + eerror "/etc/init.d/${PRODUCT} restart" + done + eoutdent + eerror "" + return 1 + fi + + + return 0 +} + +set_statedir() { + STATEDIR= + local VARDIR= + + if [ -f ${CONFDIR}/${PRODUCT}/vardir ]; then + STATEDIR=$( . ${CONFDIR}/${PRODUCT}/vardir && echo ${VARDIR} ) + fi + + [ ! -n "${STATEDIR}" ] && STATEDIR=${VARLIB}/${PRODUCT} +} + +start_pre() { + checkconfig || return 1 + + is_allowed_to_be_executed || return 1 +} + +start() { + local PRODUCT= + local STATEDIR= + + for PRODUCT in ${PRODUCTS}; do + set_statedir + + check_firewall_script || return 1 + + ebegin "Initializing \"${PRODUCT}\"" + ${STATEDIR}/firewall stop 1>/dev/null + eend $? + done +} + +stop_pre() { + checkconfig || return 1 + + is_allowed_to_be_executed || return 1 +} + +stop() { + local PRODUCT= + local STATEDIR= + + for PRODUCT in ${PRODUCTS}; do + set_statedir + + check_firewall_script || return 1 + + ebegin "Clearing \"${PRODUCT}\"" + ${STATEDIR}/firewall clear 1>/dev/null + eend $? + done +} diff --git a/net-firewall/shorewall-init/files/4.5.21.7/shorewall-init.systemd b/net-firewall/shorewall-init/files/4.5.21.7/shorewall-init.systemd new file mode 100644 index 000000000000..e48a729105b8 --- /dev/null +++ b/net-firewall/shorewall-init/files/4.5.21.7/shorewall-init.systemd @@ -0,0 +1,16 @@ +# +# The Shoreline Firewall (Shorewall) Packet Filtering Firewall - V4.5 +# +[Unit] +Description=shorewall-init +Documentation=http://www.shorewall.net/Shorewall-init.html +Before=network.target + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/sbin/shorewall-init start +ExecStop=/sbin/shorewall-init stop + +[Install] +WantedBy=multi-user.target diff --git a/net-firewall/shorewall-init/files/4.5.21.7/shorewallrc b/net-firewall/shorewall-init/files/4.5.21.7/shorewallrc new file mode 100644 index 000000000000..46f5eb9a3603 --- /dev/null +++ b/net-firewall/shorewall-init/files/4.5.21.7/shorewallrc @@ -0,0 +1,23 @@ +# +# Gentoo Shorewall 4.5 rc file +# +BUILD= #Default is to detect the build system +HOST=gentoo #Gentoo GNU Linux +PREFIX=@GENTOO_PORTAGE_EPREFIX@/usr #Top-level directory for shared files, libraries, etc. +SHAREDIR=${PREFIX}/share #Directory for arch-neutral files. +LIBEXECDIR=${PREFIX}/share #Directory for executable scripts. +PERLLIBDIR=${PREFIX}/share/shorewall #Directory to install Shorewall Perl module directory +CONFDIR=@GENTOO_PORTAGE_EPREFIX@/etc #Directory where subsystem configurations are installed +SBINDIR=@GENTOO_PORTAGE_EPREFIX@/sbin #Directory where system administration programs are installed +MANDIR=${PREFIX}/share/man #Directory where manpages are installed. +INITDIR=${CONFDIR}/init.d #Directory where SysV init scripts are installed. +INITFILE=${PRODUCT} #Name of the product's installed SysV init script +INITSOURCE=init.gentoo.sh #Name of the distributed file to be installed as the SysV init script +ANNOTATED= #If non-zero, annotated configuration files are installed +SYSTEMD=@GENTOO_PORTAGE_EPREFIX@/usr/lib/systemd/system #Directory where .service files are installed (systems running systemd only) +SERVICEFILE=gentoo.service #Name of the distributed file to be installed as systemd service file +SYSCONFFILE=default.gentoo #Name of the distributed file to be installed in $SYSCONFDIR +SYSCONFDIR=${CONFDIR}/conf.d #Directory where SysV init parameter files are installed +SPARSE= #If non-empty, only install $PRODUCT/$PRODUCT.conf in $CONFDIR +VARLIB=@GENTOO_PORTAGE_EPREFIX@/var/lib #Directory where product variable data is stored. +VARDIR=${VARLIB}/${PRODUCT} #Directory where product variable data is stored. diff --git a/net-firewall/shorewall-init/metadata.xml b/net-firewall/shorewall-init/metadata.xml index 03caed7b9582..52ffdde3f9be 100644 --- a/net-firewall/shorewall-init/metadata.xml +++ b/net-firewall/shorewall-init/metadata.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> <pkgmetadata> -<herd>netmon</herd> -<herd>proxy-maintainers</herd> -<maintainer> - <email>whissi@whissi.de</email> - <name>Thomas D.</name> -</maintainer> + <herd>netmon</herd> + <herd>proxy-maintainers</herd> + <maintainer> + <email>whissi@whissi.de</email> + <name>Thomas D. (Whissi)</name> + </maintainer> </pkgmetadata> diff --git a/net-firewall/shorewall-init/shorewall-init-4.5.21.7.ebuild b/net-firewall/shorewall-init/shorewall-init-4.5.21.7.ebuild new file mode 100644 index 000000000000..9d281367d6cf --- /dev/null +++ b/net-firewall/shorewall-init/shorewall-init-4.5.21.7.ebuild @@ -0,0 +1,105 @@ +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-firewall/shorewall-init/shorewall-init-4.5.21.7.ebuild,v 1.1 2014/03/15 23:01:59 hwoarang Exp $ + +EAPI="5" + +inherit eutils versionator prefix + +MY_URL_PREFIX= +case ${P} in + *_beta* | \ + *_rc*) + MY_URL_PREFIX='development/' + ;; +esac + +MY_PV=${PV/_rc/-RC} +MY_PV=${MY_PV/_beta/-Beta} +MY_P=${PN}-${MY_PV} + +MY_MAJOR_RELEASE_NUMBER=$(get_version_component_range 1-2) +MY_MAJORMINOR_RELEASE_NUMBER=$(get_version_component_range 1-3) + +DESCRIPTION="Component to secure a Shorewall-protected system at boot time prior to bringing up the network." +HOMEPAGE="http://www.shorewall.net/" +SRC_URI="http://www1.shorewall.net/pub/shorewall/${MY_URL_PREFIX}${MY_MAJOR_RELEASE_NUMBER}/shorewall-${MY_MAJORMINOR_RELEASE_NUMBER}/${MY_P}.tar.bz2" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~hppa ~ppc ~ppc64 ~sparc ~x86" +IUSE="" + +DEPEND=">=sys-apps/coreutils-8.20" +RDEPEND=" + ${DEPEND} + || ( =net-firewall/shorewall-${PVR} =net-firewall/shorewall6-${PVR} =net-firewall/shorewall-lite-${PVR} =net-firewall/shorewall6-lite-${PVR} ) +" + +S=${WORKDIR}/${MY_P} + +src_prepare() { + cp "${FILESDIR}"/${PVR}/shorewallrc "${S}"/shorewallrc.gentoo || die "Copying shorewallrc failed" + eprefixify "${S}"/shorewallrc.gentoo + + cp "${FILESDIR}"/${PVR}/${PN}.confd "${S}"/default.gentoo || die "Copying ${PN}.confd failed" + + cp "${FILESDIR}"/${PVR}/${PN}.initd "${S}"/init.gentoo.sh || die "Copying ${PN}.initd failed" + eprefixify "${S}"/init.gentoo.sh + + cp "${FILESDIR}"/${PVR}/${PN}.systemd "${S}"/gentoo.service || die "Copying ${PN}.systemd failed" + + epatch "${FILESDIR}"/${PVR}/01_Remove-ipset-functionality.patch + epatch "${FILESDIR}"/${PVR}/10-releasenotes.patch + epatch_user +} + +src_configure() { + :; +} + +src_compile() { + :; +} + +src_install() { + DESTDIR="${D}" ./install.sh shorewallrc.gentoo || die "install.sh failed" + + if [ -d "${D}/etc/logrotate.d" ]; then + # On Gentoo, shorewall-init will not create shorewall-ifupdown.log, + # so we don't need a logrotate folder at all + rm -rf "${D}"/etc/logrotate.d + fi + + if [ -d "${D}/etc/NetworkManager" ]; then + # On Gentoo, we don't support NetworkManager + # so we don't need these folder at all + rm -rf "${D}"/etc/NetworkManager + fi + + if [ -f "${D}/usr/share/shorewall-init/ifupdown" ]; then + # This script won't work on Gentoo + rm -rf "${D}"/usr/share/shorewall-init/ifupdown + fi + + dodoc changelog.txt releasenotes.txt "${FILESDIR}"/${PVR}/README.Gentoo.txt +} + +pkg_postinst() { + if [[ -z "${REPLACING_VERSIONS}" ]]; then + # This is a new installation + elog "Before you can use ${PN}, you need to edit its configuration in:" + elog "" + elog " ${EPREFIX}/etc/conf.d/${PN}" + elog "" + elog "To use ${PN}, please add ${PN} to your boot runlevel:" + elog "" + elog " # rc-update add ${PN} boot" + elog "" + ewarn "Notice:" + ewarn "${PN} is more like a start script than a service." + ewarn "Therefore you cannot start or stop ${PN} at default runlevel." + ewarn "" + ewarn "For more information read ${EPREFIX}/usr/share/doc/${PF}/README.Gentoo.txt.bz2" + fi +} |