-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Richard T Bonhomme <[email protected]>
- Loading branch information
1 parent
70f3a04
commit a05e4f1
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/sh | ||
|
||
# Connection tacking - Connect | ||
conn_trac_connect () | ||
{ | ||
[ $ENABLE_CONN_TRAC ] || return 0 | ||
[ -n "${1}" ] || return 1 | ||
[ -f "${EASYTLS_CONN_TRAC}" ] && \ | ||
conn_trac_data="$("${EASYTLS_CAT}" "${EASYTLS_CONN_TRAC}")" | ||
if [ -f "${EASYTLS_CONN_TRAC}" ] && \ | ||
"${EASYTLS_GREP}" -q "^${1}\$" "${EASYTLS_CONN_TRAC}" | ||
then | ||
# Already connected don't add another | ||
update_status \ | ||
"conn-trac: already registered ${1}" | ||
else | ||
{ # Add tlskey_serial to Easy-TLS Conn-Trac file | ||
"${EASYTLS_PRINTF}" "%s\n" "${1}" | ||
[ -z "${conn_trac_data}" ] || \ | ||
"${EASYTLS_PRINTF}" "%s" "${conn_trac_data}" | ||
} > "${EASYTLS_CONN_TRAC}" | ||
update_status "conn-trac: registered ${1}" | ||
fi | ||
unset conn_trac_data | ||
} # => conn_trac_connect () | ||
|
||
# Update connection tacking - disconnect | ||
conn_trac_disconnect () | ||
{ | ||
[ $ENABLE_CONN_TRAC ] || return 0 | ||
[ -n "${1}" ] || return 1 | ||
[ -f "${EASYTLS_CONN_TRAC}" ] && { | ||
"${EASYTLS_SED}" -i -e "/^${1}\$/d" -e "/^\$/d" "${EASYTLS_CONN_TRAC}" | ||
update_status "conn-trac: unregistered ${1}" | ||
[ -s "${EASYTLS_CONN_TRAC}" ] || "${EASYTLS_RM}" -f "${EASYTLS_CONN_TRAC}" | ||
} | ||
} # => conn_trac_disconnect () |
a05e4f1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#213