Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revisionBoth sides next revision
docs:guide-user:advanced:ipset_extras [2023/09/23 18:31] – [Instructions] optimize code vgaeteradocs:guide-user:advanced:ipset_extras [2023/10/18 07:56] – consolidate terminology vgaetera
Line 16: Line 16:
   * Fetch ASN prefixes using [[https://stat.ripe.net/docs/data_api|RIPEstat Data API]].   * Fetch ASN prefixes using [[https://stat.ripe.net/docs/data_api|RIPEstat Data API]].
   * Fetch GeoIP data using [[https://www.ipdeny.com/ipblocks/|IPdeny GeoIP Data]].   * Fetch GeoIP data using [[https://www.ipdeny.com/ipblocks/|IPdeny GeoIP Data]].
-  * Use [[docs:guide-user:base-system:hotplug|Hotplug]] to trigger setup automatically.+  * Use [[docs:guide-user:advanced:hotplug_extras|Hotplug extras]] to trigger setup automatically.
  
 ===== Commands ===== ===== Commands =====
Line 41: Line 41:
 config_foreach ipset_proc_"${IPSET_CMD}" ipset config_foreach ipset_proc_"${IPSET_CMD}" ipset
 uci_commit firewall uci_commit firewall
-/etc/init.d/firewall reload+service firewall reload
 fw4 reload-sets fw4 reload-sets
 } }
Line 52: Line 52:
 config_list_foreach "${IPSET_CONF}" cidr ipset_cidr config_list_foreach "${IPSET_CONF}" cidr ipset_cidr
 config_list_foreach "${IPSET_CONF}" asn ipset_asn config_list_foreach "${IPSET_CONF}" asn ipset_asn
-config_list_foreach "${IPSET_CONF}" geo ipset_geo+config_list_foreach "${IPSET_CONF}" geoip ipset_geoip
 } | sort -u > "${IPSET_TEMP}" } | sort -u > "${IPSET_TEMP}"
 config_list_foreach "${IPSET_CONF}" name ipset_"${IPSET_CMD}" config_list_foreach "${IPSET_CONF}" name ipset_"${IPSET_CMD}"
Line 108: Line 108:
 } }
  
-ipset_geo() {+ipset_geoip() {
 local IPSET_ENTRY="${1}" local IPSET_ENTRY="${1}"
 wget -O - "https://www.ipdeny.com/ipblocks/data/\ wget -O - "https://www.ipdeny.com/ipblocks/data/\
Line 124: Line 124:
 && [ ! -e /var/lock/ipset-setup ] \ && [ ! -e /var/lock/ipset-setup ] \
 || [ -n "${TERM}" ] \ || [ -n "${TERM}" ] \
-&& lock -n /var/lock/ipset-setup+&& lock -n /var/lock/ipset-setup 
 +&& sleep 10
 then . /etc/profile.d/ipset.sh then . /etc/profile.d/ipset.sh
 ipset setup ipset setup
Line 138: Line 139:
 0 */3 * * * . /etc/hotplug.d/online/70-ipset-setup 0 */3 * * * . /etc/hotplug.d/online/70-ipset-setup
 EOF EOF
-/etc/init.d/cron restart+service cron restart
 </code> </code>
  
Line 157: Line 158:
 uci add_list dhcp.example.asn="2906" uci add_list dhcp.example.asn="2906"
 uci add_list dhcp.example.asn="40027" uci add_list dhcp.example.asn="40027"
-uci add_list dhcp.example.geo="cn" +uci add_list dhcp.example.geoip="cn" 
-uci add_list dhcp.example.geo="ru"+uci add_list dhcp.example.geoip="ru"
 uci commit dhcp uci commit dhcp
  
  • Last modified: 2024/04/17 19:58
  • by fail-safe1