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

openbsd_privdrop.py 0.1.2: add fattr to pledge_promises #560

Merged
merged 1 commit into from
Aug 19, 2024
Merged
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
17 changes: 13 additions & 4 deletions python/openbsd_privdrop.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2022 Alvar Penning <[email protected]>
# Copyright (c) 2022, 2024 Alvar Penning <[email protected]>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
Expand Down Expand Up @@ -27,9 +27,17 @@
#
# - https://man.openbsd.org/pledge.2
# - https://man.openbsd.org/unveil.2
#
# The config options for the SETTINGS below are:
# - plugins.var.python.openbsd_privdrop.pledge_promises
# - plugins.var.python.openbsd_privdrop.pledge_execpromises
# - plugins.var.python.openbsd_privdrop.unveil

# History:
#
# 2024-08-19, Alvar Penning <[email protected]>
# version 0.1.2: add fattr to pledge_promises and a bit more documentation
#
# 2022-11-09, Alvar Penning <[email protected]>
# version 0.1.1: sane defaults for unveil
#
Expand All @@ -45,13 +53,13 @@

SCRIPT_NAME = "openbsd_privdrop"
SCRIPT_AUTHOR = "Alvar Penning <[email protected]>"
SCRIPT_VERSION = "0.1.1"
SCRIPT_VERSION = "0.1.2"
SCRIPT_LICENSE = "ISC"
SCRIPT_DESC = "Drop WeeChat's privileges through OpenBSD's pledge(2) and unveil(2)."

SETTINGS = {
"pledge_promises": (
"stdio rpath wpath cpath dpath inet flock unix dns sendfd recvfd tty proc error",
"stdio rpath wpath cpath dpath inet fattr flock unix dns sendfd recvfd tty proc error",
"List of promises for pledge(2).",
),
"pledge_execpromises": (
Expand All @@ -64,7 +72,8 @@
# This may be tightened, especially if WeeChat is not run as a separate user.
"~:rwc",
# WeeChat `stat`s /home while building the path to /home/$USER/...
# Might be changed if the home directory lies somehwere else.
# Might be changed if the home directory lies somewhere else.
# This happens by weechat_mkdir_parents calls, e.g., from logger_create_directory.
"/home:r",
# Other scripts might load some library or a third-party Python modules later.
"/usr/local/lib:r",
Expand Down
Loading