Skip to content

Commit

Permalink
finish permanent mode
Browse files Browse the repository at this point in the history
  • Loading branch information
nyxnor committed Feb 21, 2022
1 parent b97f941 commit 6fbfc86
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions usr/bin/tor-ctrl-onion
Expand Up @@ -250,13 +250,13 @@ if [ "${add_onion}" -eq 1 ]; then
if [ -n "${permanent_onion_save}" ]; then
test -d "${permanent_onion_save}" || error_msg "Permanent directory to save onion does not exist: ${permanent_onion_save}"
trap "rm -f -- ${permanent_onion_save%*/}/onion.tmp" INT EXIT
printf '%s\n' "${port} ${client_pub_key} ${max_streams} ${flags}" | tee "${permanent_onion_save%*/}"/onion.tmp
printf '%s\n' "${port} ${client_pub_key} ${max_streams} ${flags}" | tr -s " " | tee "${permanent_onion_save%*/}"/onion.tmp
# shellcheck disable=SC2086
tor-ctrl ${cli_args} ADD_ONION ${key:="NEW:BEST"} "${port}" ${client_pub_key} ${max_streams} ${flags} | grep "^250-" | tee -a "${permanent_onion_save%*/}"/onion.tmp
exit_code="${?}"
[ "${exit_code}" -ne 0 ] && error_msg "Failed to create onion"
onion_id_file="$(grep "250-ServiceID=" "${permanent_onion_save}"/onion.tmp | sed "s/250-ServiceID=//" | tr -d "\\r")"
## save file with its Service Identification
## save file with its Service Identification, good practive to identify the service
mv "${permanent_onion_save%*/}"/onion.tmp "${permanent_onion_save%*/}/${onion_id_file}"
exit "${?}"
elif [ -n "${permanent_onion_restore}" ]; then
Expand All @@ -277,10 +277,6 @@ if [ "${add_onion}" -eq 1 ]; then
fi



alg:pk Port= ClientAuthV3= MaxStreams= Flags=


#########
## Client

Expand Down

0 comments on commit 6fbfc86

Please sign in to comment.