You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+8-40Lines changed: 8 additions & 40 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -152,48 +152,11 @@ To create an initial configuration, run as `root` (you may be prompted for a `su
152
152
$ opencanaryd --copyconfig
153
153
[*] A sample config file is ready /etc/opencanaryd/opencanary.conf
154
154
155
-
[*] Edit your configuration, then launch with "opencanaryd --start"
155
+
[*] Edit your configuration, then launch with "opencanaryd --start --uid=nobody --gid=nogroup"
156
156
```
157
157
158
158
This creates the path and file `/etc/opencanaryd/opencanary.conf`. You must now edit the config file to determine which services and logging options you want to enable.
159
159
160
-
### Setting privileges
161
-
162
-
OpenCanary requires root to bind to privileged ports, after which it attempts to drop to a less privileged
163
-
user and group ID (default is `opencanary/nogroup`).
164
-
165
-
If this behaviour is not desired, one can use the `--allow-run-as-root` flag, e.g.,
166
-
167
-
```
168
-
$ opencanaryd --start --allow-run-as-root
169
-
```
170
-
171
-
Creating the `opencanary` user and giving necessary privileges, run `./bin/opencanaryd --createuser`. To drop to a
172
-
custom user or group, simply use the `--uid` and `--gid` options respectively:
2. Install Opencanary distribution `pip3 install /path/to/opencanary-<version>.tar.gz`.
189
-
4. Activate the `opencanary` virtual environment from a user that is able to use `sudo`
190
-
(necessary to bind to privileged ports), e.g., `source /home/opencanary/.venv/bin/activate`
191
-
5. Navigate back to `opencanary`'s home, e.g., `cd /home/opencanary` or `cd /Users/opencanary`. If this step is not done,
192
-
there may be issues when the `opencanary` user tries to navigate from this (possibly more privileged) directory.
193
-
6. Run the `opencanaryd` binary as usual , e.g., `opencanaryd --start`.
194
-
195
-
This should drop to the `opencanary` user once bound to privileged ports, and safely operate in an isolated environment.
196
-
197
160
### Enabling protocol modules and alerting
198
161
199
162
Configuration is performed via the JSON config file. Edit the file, and when happy save and exit.
@@ -224,17 +187,22 @@ Start OpenCanary by running:
224
187
225
188
```
226
189
$ . env/bin/activate
227
-
$ opencanaryd --start --allow-run-as-root
190
+
$ opencanaryd --start --uid=nobody --gid=nogroup
228
191
```
229
192
193
+
With the `uid` and `gid` flags, OpenCanary drops root privileges after binding to its ports. This can be changed to other low-privileged user/group or omitted to keep running with root privileges.
With the `uid` and `gid` flags, OpenCanary drops root privileges after binding to its ports. This can be changed to other low-privileged user/group or omitted to keep running with root privileges.
204
+
205
+
238
206
### With docker-compose
239
207
240
208
The route requires [Docker](https://docs.docker.com/get-docker/) and [Docker Compose](https://docs.docker.com/compose/install/) to be installed.
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."
67
38
fi
68
39
69
-
# Only run the following if we expect to run a sudoers command later
70
-
if [[ "${cmd}"!="--help"&&"${cmd}"!="--version"&&"${cmd}"!="--createuser"&&$(id $uid_&>/dev/null;echo$?)-eq 0 ]];then
71
-
# Ensure logging file and HTTP static content perms are correct
0 commit comments