Skip to content

Commit

Permalink
attempting to add better debug logs for root_child
Browse files Browse the repository at this point in the history
This commit adds more debug output to tell us what user & group is currently executing BusKill and what are the permissions & owners on the root_child process.

This can help resolve issues related to the permissions restrictions in-place when launching our root_child process as root, such as happened in bug #77:

 * #77
  • Loading branch information
maltfield committed Feb 26, 2024
1 parent 5a53577 commit 791d3aa
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
10 changes: 7 additions & 3 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
File: main.py
Authors: Michael Altfield <[email protected]>
Created: 2020-06-23
Updated: 2023-06-14
Version: 0.2
Updated: 2024-02-25
Version: 0.3
This is the main wrapper script for launching the BusKill app.
Expand All @@ -19,7 +19,7 @@

# this is needed for supporting Windows 10 with OpenGL < v2.0
# Example: VirtualBox w/ OpenGL v1.1
import platform, os
import platform, os, grp
CURRENT_PLATFORM = platform.system().upper()
if CURRENT_PLATFORM.startswith( 'WIN' ):
os.environ['KIVY_GL_BACKEND'] = 'angle_sdl2'
Expand Down Expand Up @@ -66,6 +66,10 @@

logging.debug( 'BUSKILL_VERSION|' +str(BUSKILL_VERSION)+ '|' )
logging.debug( 'os.environ|' +str(os.environ)+ '|' )
logging.debug( 'user|' +str(os.getlogin())+ '|' )
logging.debug( 'uid|' +str(os.getuid())+ '|' )
logging.debug( 'group|' +str(grp.getgrgid( os.getgid() ))+ '|' )
logging.debug( 'gid|' +str(os.getgid())+ '|' )
logging.debug( 'sys.argv|' +str(sys.argv)+ '|' )
logging.debug( 'sys.builtin_modules_names|' +str(sys.builtin_module_names)+ '|' )
logging.debug( 'sys.executable|' +str(sys.executable)+ '|' )
Expand Down
21 changes: 18 additions & 3 deletions src/packages/buskill/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
Authors: Michael Altfield <[email protected]>
Co-Auth: Steven Johnson <[email protected]>
Created: 2020-06-23
Updated: 2023-06-16
Version: 0.5
Updated: 2024-02-25
Version: 0.6
This is the heart of the buskill app, shared by both the cli and gui
Expand All @@ -19,7 +19,7 @@
################################################################################

import platform, multiprocessing, traceback, subprocess
import urllib.request, re, json, certifi, sys, os, math, shutil, tempfile, random, gnupg, configparser
import urllib.request, re, json, certifi, sys, os, grp, pwd, math, shutil, tempfile, random, gnupg, configparser
import os.path
from buskill_version import BUSKILL_VERSION
from distutils.version import LooseVersion
Expand Down Expand Up @@ -662,6 +662,21 @@ def spawn_root_child(self):
owner = os.stat(root_child_path).st_uid
group = os.stat(root_child_path).st_gid

msg = "DEBUG: root_child mode:|" +str(mode)+ "|"
print( msg ); logger.debug( msg )

msg = "DEBUG: root_child uid owner:|" +str(owner)+ "|"
print( msg ); logger.debug( msg )

msg = "DEBUG: root_child user owner name:|" +str(pwd.getpwuid(owner))+ "|"
print( msg ); logger.debug( msg )

msg = "DEBUG: root_child gid owner:|" +str(group)+ "|"
print( msg ); logger.debug( msg )

msg = "DEBUG: root_child group owner name:|" +str(grp.getgrgid(group))+ "|"
print( msg ); logger.debug( msg )

# verify the mode of the file is exactly 0500 (octal)
if mode != '0500':
msg = 'ERROR: Permissions on root_child are not 0500. Refusing to spawn script as root!'
Expand Down

0 comments on commit 791d3aa

Please sign in to comment.