OCF_HEARTBEAT_PORTBL(7)
π ocf_heartbeat_portblock β OCF resource agents π
okay bestie, welcome to the ocf_heartbeat_portblock era β an OCF resource agent page and honestly? it's giving network bouncer energy. let's get into it β¨
πΈ NAME
ocf_heartbeat_portblock β blocks and unblocks access to TCP and UDP ports. that's it, that's the gig π
β¨ SYNOPSIS
portblock [start | stop | status | monitor | promote | demote |
meta-data | validate-all]
π¦ DESCRIPTION
so this is the resource script for portblock, and what it does is block ports using nftables or iptables. iconic behavior. on top of that, it may allow for faster TCP reconnects for clients on failover β use that if there are long lived TCP connections to an HA service π«Ά
the way you turn that feature on is by setting the tickle_dir parameter, and it only works in concert with action set to unblock. iykyk.
πΌ heads up bestie: the tickle ACK function is new as of version 3.0.2 and hasn't yet seen widespread use. so likeβ¦ it's cute, it's fresh, it's lowkey unproven. ngl, ship it with your eyes open π
and in Promotable mode? okay so the promote action unblocks the port(s) on the Promoted node and blocks the port(s) on the Unpromoted node(s) when action=unblock β and vice versa when action=block. main character energy, honestly π
π SUPPORTED PARAMETERS
firewallβ which firewall to use. e.g.auto(default),nft, oriptables. (optional, string, default"auto")protocolβ the protocol that's getting blocked/unblocked. (required, string, no default) π¨ you gotta give us this oneportnoβ the port number that's getting blocked/unblocked. (required, string, no default)actionβ the action (block/unblock) to be done on theprotocol::portno. β¨
in Promotable mode it's the action for the promote action, and the opposite action gets used for the start and demote actions. sneaky but slay.
(required, string, no default)
methodβ the block method, choose your fighter:drop: use a DROP rule.reject: use a REJECT rule with conntrack to clear connections when blocking.
(optional, string, default "drop")
status_checkβ the status check style:rule: check the rule.pseudo: check pseudo status when the rule is absent.
(optional, string, default "pseudo")
reset_local_on_unblock_stopβ okay bestie, story time π if for some reason the long lived server side TCP sessions won't be cleaned up by a reconfiguration/flush/stop of whatever services this portblock protects, they would linger in the connection table β even after the IP is gone and services have been switched over to another node. messy.
an example would be the default NFS kernel server π
these "known" connections may seriously confuse and delay a later switchback. not the vibe.
enabling this option will cause this agent to try to get rid of these connections by injecting a temporary iptables rule to TCP-reset outgoing packets from the blocked ports, and additionally tickle them locally, just before it starts to DROP incoming packets on "unblock stop". literally doing the most, but for a good reason π
(optional, boolean, default false)
ipβ the IP address that's getting blocked/unblocked. (optional, string, default"0.0.0.0/0")tickle_dirβ the shared or local directory (must be an absolute path, fr fr) which stores the established TCP connections. (optional, string, no default)sync_scriptβ iftickle_diris a local directory, then the TCP connection state file has to be replicated to other nodes in the cluster. it can becsync2(default), some wrapper ofrsync, or whatever. it takes the file name as a single argument. forcsync2, set it to"csync2 -xv". π§ (optional, string, no default)directionβ whether to block incoming or outgoing traffic. can be either"in","out", or"both"."in"β the incoming ports are blocked on theINPUTchain."out"β the outgoing ports are blocked on theOUTPUTchain."both"β both the incoming and outgoing ports are blocked.
(optional, string, default "in")
π SUPPORTED ACTIONS
this resource agent supports the following actions (operations):
startβ starts the resource. suggested minimum timeout:20s.stopβ stops the resource. suggested minimum timeout:20s.promoteβ promotes the resource to the Master role. suggested minimum timeout:10s.demoteβ demotes the resource to the Slave role. suggested minimum timeout:10s.statusβ performs a status check. suggested minimum timeout:10s. suggested interval:10s.monitorβ performs a detailed status check. suggested minimum timeout:10s. suggested interval:10s.monitor (Promoted role)β performs a detailed status check. suggested minimum timeout:10s. suggested interval:9s.meta-dataβ retrieves resource agent metadata (internal use only π). suggested minimum timeout:5s.validate-allβ performs a validation of the resource configuration. suggested minimum timeout:5s.
π EXAMPLE CRM SHELL
here's an example config for a portblock resource using the crm(8) shell β copy it exactly bestie, no improvising β¨
primitive p_portblock ocf:heartbeat:portblock \
params \
protocol=string \
portno=string \
action=string \
op monitor depth="0" timeout="10s" interval="10s" \
op monitor depth="0" timeout="10s" interval="9s" role="Promoted"
ms ms_portblock p_portblock \
meta notify="true" interleave="true"
β EXAMPLE PCS
and here's the same situation but with pcs(8) β chef's kiss π
pcs resource create p_portblock ocf:heartbeat:portblock \
protocol=string \
portno=string \
action=string \
op monitor OCF_CHECK_LEVEL="0" timeout="10s" interval="10s" \
op monitor OCF_CHECK_LEVEL="0" timeout="10s" interval="9s" role="Promoted" promotable
π₯ SEE ALSO
http://clusterlabs.org/β go say hi, they're lovely π
π«Ά AUTHOR
ClusterLabs contributors (see the resource agent source for information about individual authors) β iconic collective behavior, no cap π
πΈ okay that's the whole page, bestie. you ate. periodt. this wasresource-agentsversionUNKNOWN, dated10/01/2026, and the manual page you just read isOCF_HEARTBEAT_PORTBL(7). mwah πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: resource-agents 4.18.0+git105.9ea1183-160000.1.1 Β· GPL-2.0-only AND LGPL-2.1-or-later AND GPL-3.0-or-later
- opensuse-leap 16.0: resource-agents 4.18.0+git105.9ea1183-160000.1.1 Β· GPL-2.0-only AND LGPL-2.1-or-later AND GPL-3.0-or-later
- opensuse-leap 16.0: resource-agents 4.18.0+git105.9ea1183-160000.1.1 Β· GPL-2.0-only AND LGPL-2.1-or-later AND GPL-3.0-or-later
- opensuse-leap 16.0: resource-agents 4.18.0+git105.9ea1183-160000.1.1 Β· GPL-2.0-only AND LGPL-2.1-or-later AND GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms