import ipset-7.11-6.el9
This commit is contained in:
commit
2decd6b0ce
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
SOURCES/ipset-7.11.tar.bz2
|
1
.ipset.metadata
Normal file
1
.ipset.metadata
Normal file
@ -0,0 +1 @@
|
|||||||
|
a10e4e8f0ed2fa540b653d987a93069c0c276f61 SOURCES/ipset-7.11.tar.bz2
|
48
SOURCES/0001-Add-deprecation-notice-to-ipset.8.patch
Normal file
48
SOURCES/0001-Add-deprecation-notice-to-ipset.8.patch
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
From e9398b721855f8fbfb30a21d475d0aeb7f85bbe5 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Phil Sutter <psutter@redhat.com>
|
||||||
|
Date: Fri, 25 Jun 2021 13:47:57 +0200
|
||||||
|
Subject: [PATCH] Add deprecation notice to ipset.8
|
||||||
|
|
||||||
|
This is RHEL9 trying to friendly kick people towards nftables.
|
||||||
|
---
|
||||||
|
src/ipset.8 | 17 +++++++++++++++--
|
||||||
|
1 file changed, 15 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/ipset.8 b/src/ipset.8
|
||||||
|
index 97cece9fb04b5..d68e9bbc22891 100644
|
||||||
|
--- a/src/ipset.8
|
||||||
|
+++ b/src/ipset.8
|
||||||
|
@@ -51,6 +51,18 @@ COMMANDS := { \fBcreate\fR | \fBadd\fR | \fBdel\fR | \fBtest\fR | \fBdestroy\fR
|
||||||
|
.PP
|
||||||
|
\fBipset\fR \fB\-\fR
|
||||||
|
.SH "DESCRIPTION"
|
||||||
|
+This tool is
|
||||||
|
+.B deprecated
|
||||||
|
+in Red Hat Enterprise Linux. It is maintenance only and will not receive new
|
||||||
|
+features. New setups should use
|
||||||
|
+.BR nft (8).
|
||||||
|
+Existing setups should migrate to
|
||||||
|
+.BR nft (8)
|
||||||
|
+when possible. See
|
||||||
|
+.UR https://red.ht/nft_your_tables
|
||||||
|
+.UE
|
||||||
|
+for details.
|
||||||
|
+.PP
|
||||||
|
\fBipset\fR
|
||||||
|
is used to set up, maintain and inspect so called IP sets in the Linux
|
||||||
|
kernel. Depending on the type of the set, an IP set may store IP(v4/v6)
|
||||||
|
@@ -1099,8 +1111,9 @@ Bugs? No, just funny features. :\-)
|
||||||
|
OK, just kidding...
|
||||||
|
.SH "SEE ALSO"
|
||||||
|
\fBiptables\fR(8),
|
||||||
|
-\fBip6tables\fR(8)
|
||||||
|
-\fBiptables-extensions\fR(8)
|
||||||
|
+\fBip6tables\fR(8),
|
||||||
|
+\fBiptables-extensions\fR(8),
|
||||||
|
+\fBnft\fR(8)
|
||||||
|
.SH "AUTHORS"
|
||||||
|
Jozsef Kadlecsik wrote ipset, which is based on ippool by
|
||||||
|
Joakim Axelsson, Patrick Schaaf and Martin Josefsson.
|
||||||
|
--
|
||||||
|
2.31.1
|
||||||
|
|
5
SOURCES/ipset-config
Normal file
5
SOURCES/ipset-config
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# Save current ipsets on stop.
|
||||||
|
# Value: yes|no, default: no
|
||||||
|
# Saves all ipsets to /etc/ipset/ipset if service gets stopped
|
||||||
|
# (e.g. on system shutdown).
|
||||||
|
IPSET_SAVE_ON_STOP="no"
|
2
SOURCES/ipset.save-legacy
Normal file
2
SOURCES/ipset.save-legacy
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
exec /usr/libexec/ipset/ipset.start-stop save
|
19
SOURCES/ipset.service
Normal file
19
SOURCES/ipset.service
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=IP sets for iptables
|
||||||
|
Before=iptables.service
|
||||||
|
Before=ip6tables.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
RemainAfterExit=yes
|
||||||
|
ExecStart=/usr/libexec/ipset/ipset.start-stop start
|
||||||
|
ExecStop=/usr/libexec/ipset/ipset.start-stop stop
|
||||||
|
ExecReload=/usr/libexec/ipset/ipset.start-stop reload
|
||||||
|
# Save current ipset entries on stop.
|
||||||
|
# Value: yes|no, default: no
|
||||||
|
# Saves all ipsets to /etc/sysconfig/ipset if ipset gets stopped
|
||||||
|
Environment=IPSET_SAVE_ON_STOP=no
|
||||||
|
EnvironmentFile=-/etc/sysconfig/ipset-config
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=basic.target
|
353
SOURCES/ipset.start-stop
Normal file
353
SOURCES/ipset.start-stop
Normal file
@ -0,0 +1,353 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# ipset Start and stop ipset firewall sets
|
||||||
|
#
|
||||||
|
# config: /etc/sysconfig/ipset-config
|
||||||
|
|
||||||
|
IPSET_BIN=/usr/sbin/ipset
|
||||||
|
IPSET_CONFIG=/etc/sysconfig/ipset-config
|
||||||
|
IPSET_DATA_COMPAT=/etc/sysconfig/ipset
|
||||||
|
IPSET_DATA_COMPAT_BACKUP=${IPSET_DATA_COMPAT}.save
|
||||||
|
IPSET_DATA_DIR=/etc/sysconfig/ipset.d
|
||||||
|
IPSET_DATA_DIR_BACKUP=${IPSET_DATA_DIR}.save
|
||||||
|
IPSET_DATA_SAVED_FLAG=${IPSET_DATA_DIR}/.saved
|
||||||
|
IPSET_LOCK=/run/ipset.lock
|
||||||
|
IPSET_RUN=/run/ipset.run
|
||||||
|
CLEAN_FILES=""
|
||||||
|
|
||||||
|
trap "rm -rf \${CLEAN_FILES}" EXIT
|
||||||
|
|
||||||
|
info() {
|
||||||
|
echo "ipset: ${*}" >&2
|
||||||
|
}
|
||||||
|
|
||||||
|
warn() {
|
||||||
|
echo "<4>ipset: ${*}" >&2
|
||||||
|
}
|
||||||
|
|
||||||
|
err() {
|
||||||
|
echo "<3>ipset: ${*}" >&2
|
||||||
|
}
|
||||||
|
|
||||||
|
[ -x ${IPSET_BIN} ] || { err "Cannot execute ${IPSET_BIN}"; exit 1; }
|
||||||
|
|
||||||
|
# Source ipset configuration
|
||||||
|
# shellcheck source=ipset-config
|
||||||
|
[ -f ${IPSET_CONFIG} ] && . ${IPSET_CONFIG}
|
||||||
|
|
||||||
|
set -f
|
||||||
|
|
||||||
|
lock() {
|
||||||
|
CLEAN_FILES="${CLEAN_FILES} ${IPSET_LOCK}"
|
||||||
|
until mkdir ${IPSET_LOCK} 2>/dev/null; do :; done
|
||||||
|
}
|
||||||
|
|
||||||
|
save() {
|
||||||
|
fail=0
|
||||||
|
|
||||||
|
# Make backups of existing configuration first, if any
|
||||||
|
[ -d ${IPSET_DATA_DIR} ] && mv -Tf ${IPSET_DATA_DIR} ${IPSET_DATA_DIR_BACKUP}
|
||||||
|
[ -f ${IPSET_DATA_COMPAT} ] && mv -Tf ${IPSET_DATA_COMPAT} ${IPSET_DATA_COMPAT_BACKUP}
|
||||||
|
|
||||||
|
rm -f ${IPSET_DATA_SAVED_FLAG}
|
||||||
|
|
||||||
|
# Save each set in a separate file
|
||||||
|
mkdir -p ${IPSET_DATA_DIR}
|
||||||
|
chmod 0700 ${IPSET_DATA_DIR}
|
||||||
|
IFS="
|
||||||
|
"
|
||||||
|
for set in $(${IPSET_BIN} list -n -t); do
|
||||||
|
# Empty name allowed, use ".set" as suffix. 'ipset save' doesn't
|
||||||
|
# quote set names with spaces: if we have a space in the name,
|
||||||
|
# work around this by quoting it ourselves in the output.
|
||||||
|
# shellcheck disable=SC2003 # No POSIX equivalent to expr index
|
||||||
|
if expr index "${set}" " " >/dev/null; then
|
||||||
|
:> "${IPSET_DATA_DIR}/${set}.set"
|
||||||
|
for line in $(${IPSET_BIN} save "${set}"); do
|
||||||
|
create=0
|
||||||
|
echo "${line}" | grep -q "^create " && create=1
|
||||||
|
if [ $create -eq 1 ]; then
|
||||||
|
line=${line#create *}
|
||||||
|
else
|
||||||
|
line=${line#add *}
|
||||||
|
fi
|
||||||
|
line=${line#${set} *}
|
||||||
|
set="$(echo "${set}" | sed 's/"/\\"/g')"
|
||||||
|
if [ $create -eq 1 ]; then
|
||||||
|
echo "create \"${set}\" ${line}" >> "${IPSET_DATA_DIR}/${set}.set"
|
||||||
|
else
|
||||||
|
echo "add \"${set}\" ${line}" >> "${IPSET_DATA_DIR}/${set}.set"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
${IPSET_BIN} save "${set}" > "${IPSET_DATA_DIR}/${set}.set" || fail=1
|
||||||
|
fi
|
||||||
|
[ -f "${IPSET_DATA_DIR}/${set}.set" ] && chmod 600 "${IPSET_DATA_DIR}/${set}.set"
|
||||||
|
[ $fail -eq 1 ] && err "Cannot save set ${set}" && unset IFS && return 1
|
||||||
|
done
|
||||||
|
touch ${IPSET_DATA_SAVED_FLAG} || { unset IFS; return 1; }
|
||||||
|
unset IFS
|
||||||
|
|
||||||
|
# Done: remove backups
|
||||||
|
rm -rf ${IPSET_DATA_DIR_BACKUP}
|
||||||
|
rm -rf ${IPSET_DATA_COMPAT_BACKUP}
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Generate a grep regexp matching abbreviated command forms. E.g., for create:
|
||||||
|
# \(c\|cr\|cre\|crea\|creat\|create\)
|
||||||
|
cmd_short_expr() {
|
||||||
|
out=
|
||||||
|
cmd_len=1
|
||||||
|
while [ "${cmd_len}" -le "${#1}" ]; do
|
||||||
|
[ -z "${out}" ] && out='\(' || out="${out}"'\|'
|
||||||
|
# shellcheck disable=SC2003 # No POSIX equivalent to expr substr
|
||||||
|
out="${out}$(expr substr "${1}" 1 "${cmd_len}")"
|
||||||
|
cmd_len=$((cmd_len + 1))
|
||||||
|
done
|
||||||
|
echo "${out}"'\)'
|
||||||
|
}
|
||||||
|
|
||||||
|
ipset_restore() {
|
||||||
|
file="${1}"
|
||||||
|
|
||||||
|
retfile="$(mktemp -q /tmp/ipset.XXXXXX)"
|
||||||
|
CLEAN_FILES="${CLEAN_FILES} ${retfile}"
|
||||||
|
|
||||||
|
# If restore fails due to invalid lines, remove them and retry
|
||||||
|
while ! restore_err="$( (${IPSET_BIN} -f "${file}" -! restore 2>&1; echo $? >"${retfile}") | head -n1; exit "$(cat "${retfile}")" )"; do
|
||||||
|
warn "${restore_err}"
|
||||||
|
case ${restore_err#*: } in
|
||||||
|
"No command specified"*)
|
||||||
|
line="$(grep -m1 -n "^${restore_err##* }" "${file}")"
|
||||||
|
line="${line%:*}"
|
||||||
|
;;
|
||||||
|
"Missing second mandatory argument to command "*)
|
||||||
|
cmd="${restore_err##* }"
|
||||||
|
cmd_expr="$(cmd_short_expr "${cmd}")"
|
||||||
|
line="$(grep -n '^'"${cmd_expr}" "${file}" | grep -m1 -v '^[0-9]\+\:'"${cmd_expr}"'[[:blank:]]\+[^[:blank:]]\+[[:blank:]]\+[^[:blank:]]\+')"
|
||||||
|
line="${line%:*}"
|
||||||
|
;;
|
||||||
|
"Missing mandatory argument to command "*)
|
||||||
|
cmd="${restore_err##* }"
|
||||||
|
cmd_expr="$(cmd_short_expr "${cmd}")"
|
||||||
|
line="$(grep -n '^'"${cmd_expr}" "${file}" | grep -m1 -v '^[0-9]\+\:'"${cmd_expr}"'[[:blank:]]\+[^[:blank:]]\+')"
|
||||||
|
line="${line%:*}"
|
||||||
|
;;
|
||||||
|
"Command "*"is invalid in restore mode"*)
|
||||||
|
restore_err_cmd="${restore_err#*: }"
|
||||||
|
restore_err_cmd="${restore_err_cmd#*\`}"
|
||||||
|
restore_err_cmd="${restore_err_cmd%%\'*}"
|
||||||
|
cmd="${restore_err_cmd##* }"
|
||||||
|
cmd_expr="$(cmd_short_expr "${cmd}")"
|
||||||
|
line="$(grep -m1 -ne '^'"${cmd_expr}"'[[:blank:]]\+' -e '^'"${restore_err_cmd}"'$' "${file}")"
|
||||||
|
line="${line%:*}"
|
||||||
|
;;
|
||||||
|
"Error in line "*)
|
||||||
|
line="${restore_err%: *}"
|
||||||
|
line="${line##* }"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
rm "${retfile}"
|
||||||
|
CLEAN_FILES="${CLEAN_FILES%* ${retfile}}"
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
[ -z "${line}" ] && return 1
|
||||||
|
|
||||||
|
warn "Skipped invalid entry: $(sed "${line}q;d" "${file}")"
|
||||||
|
sed -i -e "${line}d" "${file}"
|
||||||
|
|
||||||
|
[ -s "${file}" ] || return 1
|
||||||
|
done
|
||||||
|
|
||||||
|
rm "${retfile}"
|
||||||
|
CLEAN_FILES="${CLEAN_FILES%* ${retfile}}"
|
||||||
|
}
|
||||||
|
|
||||||
|
load() {
|
||||||
|
if [ -f ${IPSET_DATA_SAVED_FLAG} ]; then
|
||||||
|
# If we have a cleanly saved directory with all sets, we can
|
||||||
|
# delete any left-overs and use it
|
||||||
|
rm -rf ${IPSET_DATA_DIR_BACKUP}
|
||||||
|
rm -f ${IPSET_DATA_COMPAT_BACKUP}
|
||||||
|
else
|
||||||
|
# If sets weren't cleanly saved, restore from backups
|
||||||
|
[ -d ${IPSET_DATA_DIR_BACKUP} ] && rm -rf ${IPSET_DATA_DIR} && mv -Tf ${IPSET_DATA_DIR_BACKUP} ${IPSET_DATA_DIR}
|
||||||
|
[ -f ${IPSET_DATA_COMPAT_BACKUP} ] && rm -f ${IPSET_DATA_COMPAT} && mv -Tf ${IPSET_DATA_COMPAT_BACKUP} ${IPSET_DATA_COMPAT}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d ${IPSET_DATA_DIR} ] && [ ! -f ${IPSET_DATA_COMPAT} ]; then
|
||||||
|
info "No existing configuration available, none loaded"
|
||||||
|
touch ${IPSET_RUN}
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Merge all sets into temporary file
|
||||||
|
merged="$(mktemp -q /tmp/ipset.XXXXXX)"
|
||||||
|
CLEAN_FILES="${CLEAN_FILES} ${merged}"
|
||||||
|
chmod 600 "${merged}"
|
||||||
|
set +f
|
||||||
|
if [ -d ${IPSET_DATA_DIR} ]; then
|
||||||
|
# Copy create commands from each saved set first, then the rest:
|
||||||
|
# list:set entries depend on other sets, so make sure they all
|
||||||
|
# get created first
|
||||||
|
for f in "${IPSET_DATA_DIR}"/*; do
|
||||||
|
[ "${f}" = "${IPSET_DATA_DIR}/*" ] && break
|
||||||
|
[ -f "${f}" ] || continue
|
||||||
|
grep '^c' "${f}" >> "${merged}"
|
||||||
|
done
|
||||||
|
for f in "${IPSET_DATA_DIR}"/*; do
|
||||||
|
[ "${f}" = "${IPSET_DATA_DIR}/*" ] && break
|
||||||
|
[ -f "${f}" ] || continue
|
||||||
|
grep -v '^c' "${f}" >> "${merged}"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
set -f
|
||||||
|
[ -f ${IPSET_DATA_COMPAT} ] && cat ${IPSET_DATA_COMPAT} >> "${merged}"
|
||||||
|
|
||||||
|
# Drop sets that aren't in saved data, mark conflicts with existing sets
|
||||||
|
conflicts=""
|
||||||
|
IFS="
|
||||||
|
"
|
||||||
|
for set in $(${IPSET_BIN} list -n -t); do
|
||||||
|
grep -q "^create ${set} " "${merged}" && conflicts="${conflicts}|${set}" && continue
|
||||||
|
|
||||||
|
# We can't destroy the set if it's in use, flush it instead
|
||||||
|
if ! ${IPSET_BIN} destroy "${set}" 2>/dev/null; then
|
||||||
|
${IPSET_BIN} flush "${set}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
unset IFS
|
||||||
|
conflicts="${conflicts#|*}"
|
||||||
|
|
||||||
|
# Common case: if we have no conflicts, just restore in one shot
|
||||||
|
if [ -z "${conflicts}" ]; then
|
||||||
|
if ! ipset_restore "${merged}"; then
|
||||||
|
err "Failed to restore configured sets"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
rm "${merged}"
|
||||||
|
CLEAN_FILES="${CLEAN_FILES%* ${merged}}"
|
||||||
|
touch ${IPSET_RUN}
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Find a salt for md5sum that makes names of saved sets unique
|
||||||
|
salt=0
|
||||||
|
while true; do
|
||||||
|
unique=1
|
||||||
|
IFS="
|
||||||
|
"
|
||||||
|
for set in $(${IPSET_BIN} list -n -t); do
|
||||||
|
if grep -q "^create $(echo "${salt}${set}" | md5sum | head -c31) " "${merged}"; then
|
||||||
|
unique=0
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
unset IFS
|
||||||
|
[ ${unique} -eq 1 ] && break
|
||||||
|
salt=$((salt + 1))
|
||||||
|
done
|
||||||
|
|
||||||
|
# Add sets, mangling names for conflicting sets
|
||||||
|
mangled="$(mktemp -q /tmp/ipset.XXXXXX)"
|
||||||
|
CLEAN_FILES="${CLEAN_FILES} ${mangled}"
|
||||||
|
chmod 600 "${mangled}"
|
||||||
|
|
||||||
|
awk '/^(add|create) ('"${conflicts}"')/ { printf "%s ",$1; system("echo '${salt}'" $2 " | md5sum | head -c31"); $1=""; $2=""; print; next} {print}' "${merged}" > "${mangled}"
|
||||||
|
if ! ipset_restore "${mangled}"; then
|
||||||
|
err "Failed to restore configured sets"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm "${mangled}"
|
||||||
|
CLEAN_FILES="${CLEAN_FILES%* ${mangled}}"
|
||||||
|
|
||||||
|
# Swap and delete old sets
|
||||||
|
IFS='|'
|
||||||
|
for set in ${conflicts}; do
|
||||||
|
mangled="$(echo "${salt}${set}" | md5sum | head -c31)"
|
||||||
|
if ! ${IPSET_BIN} swap "${set}" "${mangled}" 2>/dev/null; then
|
||||||
|
# This fails if set types are different: try to destroy
|
||||||
|
# existing set
|
||||||
|
if ! ${IPSET_BIN} destroy "${set}" 2>/dev/null; then
|
||||||
|
# Conflicting set is in use, we can only warn
|
||||||
|
# and flush the existing set
|
||||||
|
err "Cannot load set \"${set}\", set with same name and conflicting type in use"
|
||||||
|
${IPSET_BIN} flush "${set}"
|
||||||
|
${IPSET_BIN} destroy "${mangled}"
|
||||||
|
else
|
||||||
|
${IPSET_BIN} rename "${mangled}" "${set}"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
${IPSET_BIN} destroy "${mangled}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
unset IFS
|
||||||
|
|
||||||
|
rm "${merged}"
|
||||||
|
CLEAN_FILES="${CLEAN_FILES%* ${merged}}"
|
||||||
|
touch ${IPSET_RUN}
|
||||||
|
}
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
${IPSET_BIN} flush || err "Failed to flush sets"
|
||||||
|
|
||||||
|
# Try to destroy all sets at once. This will fail if some are in use,
|
||||||
|
# destroy all the other ones in that case
|
||||||
|
${IPSET_BIN} destroy 2>/dev/null && return
|
||||||
|
IFS="
|
||||||
|
"
|
||||||
|
for set in $(${IPSET_BIN} list -n -t); do
|
||||||
|
if ! ${IPSET_BIN} destroy "${set}"; then
|
||||||
|
err "Failed to destroy set ${set}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
unset IFS
|
||||||
|
}
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
[ -f ${IPSET_RUN} ] || { info "Not running"; return 0; }
|
||||||
|
[ "${IPSET_SAVE_ON_STOP}" = "yes" ] && { save || err "Failed to save sets"; }
|
||||||
|
|
||||||
|
# Nothing to stop if the ip_set module is not loaded
|
||||||
|
lsmod | grep -q "^ip_set " || { info "Not running"; rm ${IPSET_RUN}; return 0; }
|
||||||
|
|
||||||
|
# If the xt_set module is in use, then iptables is using ipset, so
|
||||||
|
# refuse to stop the service
|
||||||
|
if mod="$(lsmod | grep ^xt_set)"; then
|
||||||
|
if [ "$(echo "${mod}" | tr -s ' ' | cut -d' ' -f3)" != "0" ]; then
|
||||||
|
err "Current iptables configuration requires ipset" && return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
cleanup
|
||||||
|
|
||||||
|
rm ${IPSET_RUN}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
lock
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
load
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
stop
|
||||||
|
;;
|
||||||
|
reload)
|
||||||
|
cleanup
|
||||||
|
load
|
||||||
|
;;
|
||||||
|
save)
|
||||||
|
save
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
info "Usage: $0 {start|stop|reload|save}"
|
||||||
|
exit 1
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit $?
|
337
SPECS/ipset.spec
Normal file
337
SPECS/ipset.spec
Normal file
@ -0,0 +1,337 @@
|
|||||||
|
# service legacy actions
|
||||||
|
%define legacy_actions %{_libexecdir}/initscripts/legacy-actions
|
||||||
|
|
||||||
|
Name: ipset
|
||||||
|
Version: 7.11
|
||||||
|
Release: 6%{?dist}
|
||||||
|
Summary: Manage Linux IP sets
|
||||||
|
|
||||||
|
License: GPLv2
|
||||||
|
URL: http://ipset.netfilter.org/
|
||||||
|
Source0: %{url}/%{name}-%{version}.tar.bz2
|
||||||
|
Source1: %{name}.service
|
||||||
|
Source2: %{name}.start-stop
|
||||||
|
Source3: %{name}-config
|
||||||
|
Source4: %{name}.save-legacy
|
||||||
|
|
||||||
|
Patch1: 0001-Add-deprecation-notice-to-ipset.8.patch
|
||||||
|
|
||||||
|
BuildRequires: libmnl-devel
|
||||||
|
BuildRequires: automake
|
||||||
|
BuildRequires: autoconf
|
||||||
|
BuildRequires: make
|
||||||
|
BuildRequires: libtool
|
||||||
|
BuildRequires: libtool-ltdl-devel
|
||||||
|
|
||||||
|
# An explicit requirement is needed here, to avoid cases where a user would
|
||||||
|
# explicitly update only one of the two (e.g 'yum update ipset')
|
||||||
|
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
|
||||||
|
|
||||||
|
%description
|
||||||
|
IP sets are a framework inside the Linux kernel since version 2.4.x, which can
|
||||||
|
be administered by the ipset utility. Depending on the type, currently an IP
|
||||||
|
set may store IP addresses, (TCP/UDP) port numbers or IP addresses with MAC
|
||||||
|
addresses in a way, which ensures lightning speed when matching an entry
|
||||||
|
against a set.
|
||||||
|
|
||||||
|
If you want to:
|
||||||
|
- store multiple IP addresses or port numbers and match against the collection
|
||||||
|
by iptables at one swoop;
|
||||||
|
- dynamically update iptables rules against IP addresses or ports without
|
||||||
|
performance penalty;
|
||||||
|
- express complex IP address and ports based rulesets with one single iptables
|
||||||
|
rule and benefit from the speed of IP sets
|
||||||
|
then ipset may be the proper tool for you.
|
||||||
|
|
||||||
|
|
||||||
|
%package libs
|
||||||
|
Summary: Shared library providing the IP sets functionality
|
||||||
|
|
||||||
|
%description libs
|
||||||
|
This package contains the libraries which provide the IP sets funcionality.
|
||||||
|
|
||||||
|
|
||||||
|
%package devel
|
||||||
|
Summary: Development files for %{name}
|
||||||
|
Requires: %{name}-libs%{?_isa} == %{version}-%{release}
|
||||||
|
Requires: kernel-headers
|
||||||
|
|
||||||
|
%description devel
|
||||||
|
This package contains the files required to develop software using the %{name}
|
||||||
|
libraries.
|
||||||
|
|
||||||
|
|
||||||
|
%package service
|
||||||
|
Summary: %{name} service for %{name}s
|
||||||
|
Requires: %{name} = %{version}-%{release}
|
||||||
|
BuildRequires: systemd
|
||||||
|
Requires: iptables-nft-services
|
||||||
|
Requires(post): systemd
|
||||||
|
Requires(preun): systemd
|
||||||
|
Requires(postun): systemd
|
||||||
|
BuildArch: noarch
|
||||||
|
|
||||||
|
%description service
|
||||||
|
This package provides the service %{name} that is split
|
||||||
|
out of the base package since it is not active by default.
|
||||||
|
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%autosetup -p1
|
||||||
|
|
||||||
|
|
||||||
|
%build
|
||||||
|
./autogen.sh
|
||||||
|
%configure --enable-static=no --with-kmod=no
|
||||||
|
|
||||||
|
# Just to make absolutely sure we are not building the bundled kernel module
|
||||||
|
# I have to do it after the configure run unfortunately
|
||||||
|
rm -fr kernel
|
||||||
|
|
||||||
|
# Prevent libtool from defining rpath
|
||||||
|
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
|
||||||
|
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
|
||||||
|
|
||||||
|
%make_build
|
||||||
|
|
||||||
|
|
||||||
|
%install
|
||||||
|
%make_install
|
||||||
|
find %{buildroot} -name '*.la' -exec rm -f '{}' \;
|
||||||
|
|
||||||
|
# install systemd unit file
|
||||||
|
install -d -m 755 %{buildroot}/%{_unitdir}
|
||||||
|
install -c -m 644 %{SOURCE1} %{buildroot}/%{_unitdir}
|
||||||
|
|
||||||
|
# install supporting script
|
||||||
|
install -d -m 755 %{buildroot}%{_libexecdir}/%{name}
|
||||||
|
install -c -m 755 %{SOURCE2} %{buildroot}%{_libexecdir}/%{name}
|
||||||
|
|
||||||
|
# install ipset-config
|
||||||
|
install -d -m 755 %{buildroot}%{_sysconfdir}/sysconfig
|
||||||
|
install -c -m 600 %{SOURCE3} %{buildroot}%{_sysconfdir}/sysconfig/%{name}-config
|
||||||
|
|
||||||
|
# install legacy actions for service command
|
||||||
|
install -d %{buildroot}/%{legacy_actions}/ipset
|
||||||
|
install -c -m 755 %{SOURCE4} %{buildroot}/%{legacy_actions}/ipset/save
|
||||||
|
|
||||||
|
# Create directory for configuration
|
||||||
|
mkdir -p %{buildroot}%{_sysconfdir}/%{name}
|
||||||
|
|
||||||
|
|
||||||
|
%preun
|
||||||
|
if [[ $1 -eq 0 && -n $(lsmod | grep "^xt_set ") ]]; then
|
||||||
|
rmmod xt_set 2>/dev/null
|
||||||
|
[[ $? -ne 0 ]] && echo Current iptables configuration requires ipsets && exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
%ldconfig_scriptlets libs
|
||||||
|
|
||||||
|
|
||||||
|
%post service
|
||||||
|
%systemd_post %{name}.service
|
||||||
|
|
||||||
|
%preun service
|
||||||
|
if [[ $1 -eq 0 && -n $(lsmod | grep "^xt_set ") ]]; then
|
||||||
|
rmmod xt_set 2>/dev/null
|
||||||
|
[[ $? -ne 0 ]] && echo Current iptables configuration requires ipsets && exit 1
|
||||||
|
fi
|
||||||
|
%systemd_preun %{name}.service
|
||||||
|
|
||||||
|
%postun service
|
||||||
|
%systemd_postun_with_restart %{name}.service
|
||||||
|
|
||||||
|
|
||||||
|
%files
|
||||||
|
%doc ChangeLog
|
||||||
|
%license COPYING
|
||||||
|
%{_mandir}/man8/%{name}.8.*
|
||||||
|
%{_sbindir}/%{name}
|
||||||
|
|
||||||
|
%files libs
|
||||||
|
%license COPYING
|
||||||
|
%{_libdir}/lib%{name}.so.13*
|
||||||
|
|
||||||
|
%files devel
|
||||||
|
%{_includedir}/lib%{name}
|
||||||
|
%{_libdir}/lib%{name}.so
|
||||||
|
%{_libdir}/pkgconfig/lib%{name}.pc
|
||||||
|
%{_mandir}/man3/libipset.3.*
|
||||||
|
|
||||||
|
%files service
|
||||||
|
%{_unitdir}/%{name}.service
|
||||||
|
%dir %{_libexecdir}/%{name}
|
||||||
|
%config(noreplace) %attr(0600,root,root) %{_sysconfdir}/sysconfig/ipset-config
|
||||||
|
%ghost %config(noreplace) %attr(0600,root,root) %{_sysconfdir}/sysconfig/ipset
|
||||||
|
%attr(0755,root,root) %{_libexecdir}/%{name}/%{name}.start-stop
|
||||||
|
%dir %{legacy_actions}/ipset
|
||||||
|
%{legacy_actions}/ipset/save
|
||||||
|
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Mon Nov 08 2021 Phil Sutter <psutter@redhat.com> - 7.11-6
|
||||||
|
- Sync ipset.service with RHEL8, fix the required package name
|
||||||
|
|
||||||
|
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 7.11-5
|
||||||
|
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
|
||||||
|
Related: rhbz#1991688
|
||||||
|
|
||||||
|
* Fri Jul 02 2021 Phil Sutter <psutter@redhat.com> - 7.11-4
|
||||||
|
- Improve deprecation notice a bit
|
||||||
|
|
||||||
|
* Fri Jun 25 2021 Phil Sutter <psutter@redhat.com> - 7.11-3
|
||||||
|
- Add deprecation notice to ipset.8
|
||||||
|
|
||||||
|
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 7.11-2
|
||||||
|
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
|
||||||
|
|
||||||
|
* Mon Mar 01 2021 Nicolas Chauvet <kwizart@gmail.com> - 7.11-1
|
||||||
|
- Update to 7.11
|
||||||
|
|
||||||
|
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 7.10-2
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
||||||
|
|
||||||
|
* Mon Dec 21 2020 Nicolas Chauvet <kwizart@gmail.com> - 7.10-1
|
||||||
|
- Update to 7.10
|
||||||
|
|
||||||
|
* Wed Dec 16 2020 Nicolas Chauvet <kwizart@gmail.com> - 7.9-1
|
||||||
|
- Update to 7.9
|
||||||
|
|
||||||
|
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 7.6-2
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
||||||
|
|
||||||
|
* Mon Feb 24 2020 Nicolas Chauvet <kwizart@gmail.com> - 7.6-1
|
||||||
|
- Update to 7.6
|
||||||
|
|
||||||
|
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 7.5-2
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||||
|
|
||||||
|
* Fri Jan 10 2020 Nicolas Chauvet <kwizart@gmail.com> - 7.5-1
|
||||||
|
- Update to 7.5
|
||||||
|
|
||||||
|
* Mon Nov 04 2019 Eric Garver <eric@garver.life> - 7.4-1
|
||||||
|
- Update to 7.4
|
||||||
|
|
||||||
|
* Mon Aug 19 2019 Nicolas Chauvet <kwizart@gmail.com> - 7.3-1
|
||||||
|
- Update to 7.3
|
||||||
|
|
||||||
|
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 7.2-2
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
||||||
|
|
||||||
|
* Thu Jul 11 2019 Nicolas Chauvet <kwizart@gmail.com> - 7.2-1
|
||||||
|
- Update to 7.2
|
||||||
|
|
||||||
|
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 6.38-2
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
||||||
|
|
||||||
|
* Mon Aug 13 2018 Nicolas Chauvet <kwizart@gmail.com> - 6.38-1
|
||||||
|
- Update to 6.38
|
||||||
|
- Clean-up spec
|
||||||
|
|
||||||
|
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 6.35-4
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
|
||||||
|
|
||||||
|
* Mon Feb 12 2018 Eric Garver <egarver@redhat.com> - 6.35-3
|
||||||
|
- Patch for missing header file (RHBZ#1543596)
|
||||||
|
|
||||||
|
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 6.35-2
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
|
||||||
|
|
||||||
|
* Mon Jan 08 2018 Nicolas Chauvet <kwizart@gmail.com> - 6.35-1
|
||||||
|
- Update to 6.35
|
||||||
|
|
||||||
|
* Mon Jul 31 2017 Nicolas Chauvet <kwizart@gmail.com> - 6.32-1
|
||||||
|
- Update to 6.32
|
||||||
|
|
||||||
|
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 6.29-4
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
|
||||||
|
|
||||||
|
* Fri Apr 07 2017 Nicolas Chauvet <kwizart@gmail.com> - 6.29-3
|
||||||
|
- Userspace needs kernel-headers - rhbz#1420864
|
||||||
|
|
||||||
|
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 6.29-2
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
|
||||||
|
|
||||||
|
* Mon Apr 18 2016 Thomas Woerner <twoerner@redhat.com> - 6.29-1
|
||||||
|
- New upstream version 6.29 (RHBZ#1317208)
|
||||||
|
- Suppress unnecessary stderr in command loop for resize and list
|
||||||
|
- Correction in comment test
|
||||||
|
- Support chroot buildroots (reported by Jan Engelhardt)
|
||||||
|
- Fix "configure" breakage due to pkg-config related changes
|
||||||
|
(reported by Jan Engelhardt)
|
||||||
|
- Support older pkg-config packages
|
||||||
|
- Add bash completion to the install routine (Mart Frauenlob)
|
||||||
|
- Fix misleading error message with comment extension
|
||||||
|
- Test added to check 0.0.0.0/0,iface to be matched in hash:net,iface type
|
||||||
|
- Fix link with libtool >= 2.4.4 (Olivier Blin)
|
||||||
|
|
||||||
|
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 6.27-2
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
|
||||||
|
|
||||||
|
* Tue Nov 10 2015 Thomas Woerner <twoerner@redhat.com> - 6.27-1
|
||||||
|
- New upstream version 6.27 (RHBZ#1145913)
|
||||||
|
|
||||||
|
* Sat Oct 10 2015 Haïkel Guémar <hguemar@fedoraproject.org> - 6.26-1
|
||||||
|
- Upstream 6.26 (RHBZ#1145913)
|
||||||
|
|
||||||
|
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 6.22-2
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
|
||||||
|
|
||||||
|
* Thu Sep 18 2014 Mathieu Bridon <bochecha@fedoraproject.org> - 6.22-1
|
||||||
|
- New upstream release.
|
||||||
|
|
||||||
|
* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 6.21.1-4
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
|
||||||
|
|
||||||
|
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 6.21.1-3
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
|
||||||
|
|
||||||
|
* Tue Mar 11 2014 Mathieu Bridon <bochecha@fedoraproject.org> - 6.21.1-2
|
||||||
|
- Remove runtime requirement on the kernel.
|
||||||
|
https://lists.fedoraproject.org/pipermail/devel/2014-March/196565.html
|
||||||
|
|
||||||
|
* Tue Oct 29 2013 Mathieu Bridon <bochecha@fedoraproject.org> - 6.20.1-1
|
||||||
|
- New upstream release.
|
||||||
|
|
||||||
|
* Tue Aug 27 2013 Quentin Armitage <quentin@armitage.org.uk> 6.19-2
|
||||||
|
- Add service pkg - adds save and reload functionality on shutdown/startup
|
||||||
|
- Add requires dependency of ipset on matching ipset-libs
|
||||||
|
|
||||||
|
* Thu Aug 15 2013 Mathieu Bridon <bochecha@fedoraproject.org> - 6.19-1
|
||||||
|
- New upstream release.
|
||||||
|
|
||||||
|
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 6.16.1-3
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
|
||||||
|
|
||||||
|
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 6.16.1-2
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
|
||||||
|
|
||||||
|
* Wed Sep 26 2012 Mathieu Bridon <bochecha@fedoraproject.org> - 6.16.1-1
|
||||||
|
- New upstream release.
|
||||||
|
- Fix a requirement.
|
||||||
|
|
||||||
|
* Wed Sep 26 2012 Mathieu Bridon <bochecha@fedoraproject.org> - 6.14-1
|
||||||
|
- New upstream release.
|
||||||
|
- Fix scriptlets, ldconfig is needed for the libs subpackage, not the main one.
|
||||||
|
|
||||||
|
* Mon Jul 30 2012 Mathieu Bridon <bochecha@fedoraproject.org> - 6.13-1
|
||||||
|
- New upstream release.
|
||||||
|
- Split out the library in its own subpackage.
|
||||||
|
|
||||||
|
* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 6.11-2
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
|
||||||
|
|
||||||
|
* Mon Feb 06 2012 Mathieu Bridon <bochecha@fedoraproject.org> - 6.11-1
|
||||||
|
- New upstream release.
|
||||||
|
- Removed our patch, it has been integrated upstream. As such, we also don't
|
||||||
|
need to re-run autoreconf any more.
|
||||||
|
|
||||||
|
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 6.9.1-3
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
|
||||||
|
|
||||||
|
* Fri Sep 16 2011 Mathieu Bridon <bochecha@fedoraproject.org> - 6.9.1-2
|
||||||
|
- Some fixes based on Pierre-Yves' review feedback.
|
||||||
|
|
||||||
|
* Wed Sep 14 2011 Mathieu Bridon <bochecha@fedoraproject.org> - 6.9.1-1
|
||||||
|
- Initial packaging.
|
Loading…
Reference in New Issue
Block a user