Skip to content

Commit

Permalink
fix release
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkst-az committed Oct 17, 2024
1 parent 8839e65 commit 9644d16
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions bin/opencanaryd
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@ for arg in "$@"; do
esac
done

if [[ -z $TWISTD_UID_FLAG || -z $TWISTD_GID_FLAG ]]; then
echo "WARNING: OpenCanary will not drop root user or group privileges after launching. Set both --uid=nobody and --gid=nogroup (another other low privilege user/group) to silence this warning."
fi
function warn_drop_privileges {
if [[ -z $TWISTD_UID_FLAG || -z $TWISTD_GID_FLAG ]]; then
echo "WARNING: OpenCanary will not drop root user or group privileges after launching. Set both --uid=nobody and --gid=nogroup (or another low privilege user/group) to silence this warning." >&2
fi
}

# Use sudo when not running as root
function sudo() {
Expand All @@ -48,8 +50,10 @@ function sudo() {
}

if [ "${cmd}" == "--start" ]; then
warn_drop_privileges
sudo -E "${DIR}/twistd" -y "${DIR}/opencanary.tac" --pidfile "${PIDFILE}" --syslog --prefix=opencanaryd ${TWISTD_UID_FLAG:-} ${TWISTD_GID_FLAG:-}
elif [ "${cmd}" == "--dev" ]; then
warn_drop_privileges
sudo -E "${DIR}/twistd" -noy "${DIR}/opencanary.tac" ${TWISTD_UID_FLAG:-} ${TWISTD_GID_FLAG:-}
elif [ "${cmd}" == "--usermodule" ]; then
usermodconf=$(python -c "from pkg_resources import resource_filename; print(resource_filename('opencanary', 'data/settings-usermodule.json'))")
Expand All @@ -67,6 +71,7 @@ elif [ "${cmd}" == "--usermodule" ]; then
elif [ "${cmd}" == "--restart" ]; then
pid=`sudo -E cat "${PIDFILE}"`
sudo -E kill "$pid"
warn_drop_privileges
sudo -E "${DIR}/twistd" -y "${DIR}/opencanary.tac" --pidfile "${PIDFILE}" --syslog --prefix=opencanaryd ${TWISTD_UID_FLAG:-} ${TWISTD_GID_FLAG:-}
elif [ "${cmd}" == "--stop" ]; then
pid=`sudo -E cat "${PIDFILE}"`
Expand Down
2 changes: 1 addition & 1 deletion opencanary/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import subprocess

__version__ = "0.9.4"
__version__ = "0.9.5"

from os import PathLike
from typing import Union
Expand Down

0 comments on commit 9644d16

Please sign in to comment.