Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support run in systemd #42

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/CreateTorProcess
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function CreateTorProcess() {
fi

# shellcheck disable=SC2024
sudo -u "$_arg_uname" tor -f "${_torrc_config}" \
runuser -u "$_arg_uname" -- tor -f "${_torrc_config}" \
--RunAsDaemon 1 \
--CookieAuthentication 0 \
--SocksPort "$_arg_socks" \
Expand Down
10 changes: 5 additions & 5 deletions src/__init__
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ function __main__() {

# We place here used commands at script runtime, as strings to anything
# unnecessarily run.
readonly commands=(basename dirname stat ps date grep cut sed awk chown \
chmod mkdir pidof tor sudo nc kill \
readonly commands=(basename dirname stat ps date grep cut sed awk chown openssl \
chmod mkdir pidof tor runuser nc kill \
haproxy polipo privoxy hpts)

# If you intend to specify the full path to the command we do it like:
Expand Down Expand Up @@ -521,9 +521,9 @@ function __main__() {
# Generate random password.
# Does storing the password in this form is security issue?
# shellcheck disable=SC2034
_pass_gen=$(< /dev/urandom tr -dc 'a-zA-Z0-9' | fold -w 18 | head -n 1)
_pass_gen=$(openssl rand -base64 20 | tr -dc 'a-zA-Z0-9' | fold -w 18)
# shellcheck disable=SC2034
_pass_hash=$(sudo -u "$user_name" tor --hash-password "$_pass_gen" | grep "16:")
_pass_hash=$(runuser -u "$user_name" -- tor --hash-password "$_pass_gen" | grep "16:")

if [[ "$proxy_state" -eq 1 ]] ; then

Expand Down Expand Up @@ -554,7 +554,7 @@ function __main__() {
cp "${_tml_ha0}" "${_tml_ha1}"

# shellcheck disable=SC2034
_pass_gen_ha=$(< /dev/urandom tr -dc 'a-zA-Z0-9' | fold -w 18 | head -n 1)
_pass_gen_ha=$(openssl rand -base64 20 | tr -dc 'a-zA-Z0-9' | fold -w 18)

sed -i "s/__PASSWORD__/$_pass_gen_ha/g" "${_tml_ha1}"

Expand Down