Skip to content

Commit 2509734

Browse files
authored
fix release (#380)
1 parent 8839e65 commit 2509734

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

bin/opencanaryd

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,11 @@ for arg in "$@"; do
3333
esac
3434
done
3535

36-
if [[ -z $TWISTD_UID_FLAG || -z $TWISTD_GID_FLAG ]]; then
37-
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."
38-
fi
36+
function warn_drop_privileges {
37+
if [[ -z $TWISTD_UID_FLAG || -z $TWISTD_GID_FLAG ]]; then
38+
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
39+
fi
40+
}
3941

4042
# Use sudo when not running as root
4143
function sudo() {
@@ -48,8 +50,10 @@ function sudo() {
4850
}
4951

5052
if [ "${cmd}" == "--start" ]; then
53+
warn_drop_privileges
5154
sudo -E "${DIR}/twistd" -y "${DIR}/opencanary.tac" --pidfile "${PIDFILE}" --syslog --prefix=opencanaryd ${TWISTD_UID_FLAG:-} ${TWISTD_GID_FLAG:-}
5255
elif [ "${cmd}" == "--dev" ]; then
56+
warn_drop_privileges
5357
sudo -E "${DIR}/twistd" -noy "${DIR}/opencanary.tac" ${TWISTD_UID_FLAG:-} ${TWISTD_GID_FLAG:-}
5458
elif [ "${cmd}" == "--usermodule" ]; then
5559
usermodconf=$(python -c "from pkg_resources import resource_filename; print(resource_filename('opencanary', 'data/settings-usermodule.json'))")
@@ -67,6 +71,7 @@ elif [ "${cmd}" == "--usermodule" ]; then
6771
elif [ "${cmd}" == "--restart" ]; then
6872
pid=`sudo -E cat "${PIDFILE}"`
6973
sudo -E kill "$pid"
74+
warn_drop_privileges
7075
sudo -E "${DIR}/twistd" -y "${DIR}/opencanary.tac" --pidfile "${PIDFILE}" --syslog --prefix=opencanaryd ${TWISTD_UID_FLAG:-} ${TWISTD_GID_FLAG:-}
7176
elif [ "${cmd}" == "--stop" ]; then
7277
pid=`sudo -E cat "${PIDFILE}"`

opencanary/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22
import subprocess
33

4-
__version__ = "0.9.4"
4+
__version__ = "0.9.5"
55

66
from os import PathLike
77
from typing import Union

0 commit comments

Comments
 (0)