rda-python-setuid 1.0.7__py3-none-any.whl → 1.0.8__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,8 +11,11 @@
11
11
  # Github: https://github.com/NCAR/rda-python-setuid.git
12
12
  #
13
13
  # Usage:
14
+ # # 0. Display this user guide:
15
+ # pywrapper-install
16
+ #
14
17
  # # 1. Compile and install pywrapper (run once per environment):
15
- # pywrapper-install [-u gdexdata] [-e $ENVHOME]
18
+ # pywrapper-install -c [-u gdexdata] [-e $ENVHOME]
16
19
  #
17
20
  # # 2. Create pgstart_USER entry so USER can run commands as themselves:
18
21
  # pywrapper-install -p [-u zji] [-e $ENVHOME]
@@ -65,9 +68,6 @@ def show_usage():
65
68
 
66
69
  def main():
67
70
 
68
- if len(sys.argv) == 1:
69
- show_usage()
70
-
71
71
  parser = argparse.ArgumentParser(
72
72
  description="Compile and install the pywrapper setuid C binary."
73
73
  )
@@ -84,6 +84,10 @@ def main():
84
84
  help="Simple install: create symlink PROGRAM -> setuid_PROGRAM, skipping setuid (use with -l/--link)"
85
85
  )
86
86
  group = parser.add_mutually_exclusive_group()
87
+ group.add_argument(
88
+ '-c', '--compile', action='store_true',
89
+ help="Compile pywrapper.c and install bin/pywrapper as a setuid binary (run once per environment)"
90
+ )
87
91
  group.add_argument(
88
92
  '-p', '--pgstart', action='store_true',
89
93
  help="Create pgstart_USER for running commands as USER (Mode 2)"
@@ -94,6 +98,9 @@ def main():
94
98
  )
95
99
  args = parser.parse_args()
96
100
 
101
+ if not (args.compile or args.pgstart or args.link):
102
+ show_usage()
103
+
97
104
  if args.user is None and not args.simple:
98
105
  import pwd
99
106
  if args.pgstart:
@@ -142,8 +149,8 @@ def main():
142
149
  run(['sudo', '-u', args.user, 'chmod', '4750', target])
143
150
  print("Installed: {} (setuid, owned by {})".format(target, args.user))
144
151
 
145
- else:
146
- # Default: compile pywrapper.c and install pywrapper with setuid
152
+ elif args.compile:
153
+ # Compile pywrapper.c and install pywrapper with setuid
147
154
  src = get_c_source()
148
155
  src_dest = os.path.join(bindir, 'pywrapper.c')
149
156
  shutil.copy(src, src_dest)
@@ -2,7 +2,14 @@
2
2
  that execute Python scripts as a common or effective user via the setuid mechanism.
3
3
  Must be run inside the target Python virtual environment.
4
4
 
5
- Usage: pywrapper-install [-u USER] [-e ENVHOME] [-p | -l PROGRAM [-s]]
5
+ Usage: pywrapper-install [-u|--user USER] [-e|--envhome ENVHOME]
6
+ ( -c|--compile
7
+ | -p|--pgstart
8
+ | -l|--link PROGRAM [-s|--simple] )
9
+
10
+ Run pywrapper-install with no arguments to display this user guide. Exactly
11
+ one of -c/--compile, -p/--pgstart, or -l/--link must be given to perform an
12
+ action.
6
13
 
7
14
  - Option -u or --user USER
8
15
  The user name to own the setuid binary. For Mode 1 (CommonUser program),
@@ -16,16 +23,22 @@
16
23
  Only needed when installing into an environment other than the one
17
24
  currently active.
18
25
 
26
+ - Option -c or --compile
27
+ Compile pywrapper.c (bundled with this package) and install it as
28
+ bin/pywrapper, owned by USER with chmod 4750 (setuid). Must be done
29
+ once per environment before using -p/--pgstart or -l/--link. Cannot
30
+ be combined with -p/--pgstart or -l/--link.
31
+
19
32
  - Option -p or --pgstart
20
33
  Mode 2: copy the compiled pywrapper binary to pgstart_USER (owned by USER,
21
34
  chmod 4750). Allows USER to run arbitrary commands as themselves via the
22
- setuid wrapper. Cannot be combined with -l/--link.
35
+ setuid wrapper. Cannot be combined with -c/--compile or -l/--link.
23
36
 
24
37
  - Option -l or --link PROGRAM
25
38
  Mode 1: create a symlink PROGRAM -> pywrapper in the bin/ directory, then
26
39
  lock down setuid_PROGRAM (chmod 700, owned by USER) so users cannot bypass
27
40
  the setuid wrapper by running setuid_PROGRAM directly. Cannot be combined
28
- with -p/--pgstart.
41
+ with -c/--compile or -p/--pgstart.
29
42
 
30
43
  - Option -s or --simple (use with -l/--link)
31
44
  Simple install: create a symlink PROGRAM -> setuid_PROGRAM directly,
@@ -33,11 +46,6 @@
33
46
  user with no privilege change. -u/--user is not required with this option.
34
47
  Useful for users who do not need or cannot set up the setuid wrapper.
35
48
 
36
- When run without --pgstart or --link, the default action is to compile pywrapper.c
37
- (bundled with this package) and install it as bin/pywrapper, owned by USER with
38
- chmod 4750 (setuid). This step must be done once per environment before using
39
- --pgstart or --link.
40
-
41
49
  Convention for wrapped programs:
42
50
  Any Python package whose program is to be run via pywrapper must:
43
51
 
@@ -99,7 +107,7 @@
99
107
  pip install rda_python_dsarch
100
108
 
101
109
  2. Compile pywrapper (once per environment):
102
- pywrapper-install
110
+ pywrapper-install -c
103
111
 
104
112
  3. Wire up each program as a setuid entry:
105
113
  pywrapper-install -l dsarch
@@ -118,10 +126,10 @@
118
126
  Examples:
119
127
 
120
128
  1. Compile and install pywrapper for common user gdexdata (default):
121
- pywrapper-install
129
+ pywrapper-install -c
122
130
 
123
131
  2. Same, but targeting a specific environment:
124
- pywrapper-install -e /glade/u/home/gdexdata/gdexmsenv
132
+ pywrapper-install -c -e /glade/u/home/gdexdata/gdexmsenv
125
133
 
126
134
  3. Wire up dsarch to run as gdexdata via pywrapper:
127
135
  pywrapper-install -l dsarch
@@ -10,15 +10,15 @@
10
10
  * python -m pip install rda_python_setuid
11
11
  *
12
12
  * # Compile pywrapper and set setuid bit (owned by CommonUser):
13
- * pywrapper-install [-u CommonUser] [-e $ENVHOME/bin]
13
+ * pywrapper-install -c|--compile [-u|--user CommonUser] [-e|--envhome $ENVHOME]
14
14
  *
15
15
  * # For an existing python program, $ENVHOME/bin/setuid_CommonProgram, to execute it
16
16
  * # as the common user (Mode 1 - symlink):
17
- * pywrapper-install -l CommonProgram [-u CommonUser] [-e $ENVHOME/bin]
17
+ * pywrapper-install -l|--link CommonProgram [-u|--user CommonUser] [-e|--envhome $ENVHOME]
18
18
  * CommonProgram [options]
19
19
  *
20
20
  * # For a specialist to run commands as themselves via pgstart (Mode 2):
21
- * pywrapper-install -p [-u EffectUser] [-e $ENVHOME/bin]
21
+ * pywrapper-install -p|--pgstart [-u|--user EffectUser] [-e|--envhome $ENVHOME]
22
22
  * pgstart_EffectUser EffectProgram [options]
23
23
  *
24
24
  * N: python 3 release number, it is 10 for Python 3.10.12
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rda_python_setuid
3
- Version: 1.0.7
3
+ Version: 1.0.8
4
4
  Summary: RDA Python Package to setuid for program executions as an effective or common user
5
5
  Author-email: Zaihua Ji <zji@ucar.edu>
6
6
  Project-URL: Homepage, https://github.com/NCAR/rda-python-setuid
@@ -113,13 +113,13 @@ pywrapper-install
113
113
  pip install rda_python_dsarch
114
114
 
115
115
  # 2. Compile pywrapper C binary (once per environment):
116
- pywrapper-install
116
+ pywrapper-install -c|--compile
117
117
 
118
118
  # 3. Wire up each program as a setuid entry:
119
- pywrapper-install -l dsarch
119
+ pywrapper-install -l|--link dsarch
120
120
 
121
121
  # 4. Optionally, allow a specialist to run commands as themselves:
122
- pywrapper-install -p -u zji
122
+ pywrapper-install -p|--pgstart -u|--user zji
123
123
  ```
124
124
 
125
125
  ### Simple install (no sudo required, runs as current user)
@@ -129,7 +129,7 @@ direct symlink from `dsarch` to `setuid_dsarch`:
129
129
 
130
130
  ```bash
131
131
  pip install rda_python_dsarch
132
- pywrapper-install -l dsarch -s
132
+ pywrapper-install -l|--link dsarch -s|--simple
133
133
  ```
134
134
 
135
135
  ## Runtime flow
@@ -0,0 +1,12 @@
1
+ rda_python_setuid/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
2
+ rda_python_setuid/install.py,sha256=-YoqQ9OTguOwVaWGOkVEQgzZMxfpHIyG4MEM_oRA8oE,6379
3
+ rda_python_setuid/install.usg,sha256=V2sbJo5hTB4hWKGZClAHBojm7wg1B1cQRZN7NdvTEHo,5543
4
+ rda_python_setuid/pgstart.py,sha256=dzYzuc2ce60RNx7FBxVhUgHYwlVnbiZcCrxVQ6MvZZ4,3909
5
+ rda_python_setuid/pywrapper.c,sha256=Dp9EOFU9IShduQ4WMeFRiiIJLQvgZHsiQlc89vJgtII,4190
6
+ rda_python_setuid/pywrapper.py,sha256=pyQZfITTpxQ_lVkWc_0ZJRF_sZnq8NQdOvR5lObu6mw,2898
7
+ rda_python_setuid-1.0.8.dist-info/licenses/LICENSE,sha256=1dck4EAQwv8QweDWCXDx-4Or0S8YwiCstaso_H57Pno,1097
8
+ rda_python_setuid-1.0.8.dist-info/METADATA,sha256=sxD3iWI8gQ0iHRxYJdN853asC8dlvKP1yMae1aYOJJQ,5048
9
+ rda_python_setuid-1.0.8.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
10
+ rda_python_setuid-1.0.8.dist-info/entry_points.txt,sha256=mWZUCa2KYzGsYVa33M7W03CY9SMsJYsywlIDF-4iMaQ,165
11
+ rda_python_setuid-1.0.8.dist-info/top_level.txt,sha256=ONMhKLagyTBktuz5dTyipSnRC0YhomTMs8eFRjM9kHQ,18
12
+ rda_python_setuid-1.0.8.dist-info/RECORD,,
@@ -1,12 +0,0 @@
1
- rda_python_setuid/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
2
- rda_python_setuid/install.py,sha256=eDVHdI2T7Yr1G3I-lWonnGnVfLHp_-zwyQtaL5KieWc,6106
3
- rda_python_setuid/install.usg,sha256=CqFcedPP27cHInSVGCv4HqO5hnyehAQOxoYfkpV3zmA,5147
4
- rda_python_setuid/pgstart.py,sha256=dzYzuc2ce60RNx7FBxVhUgHYwlVnbiZcCrxVQ6MvZZ4,3909
5
- rda_python_setuid/pywrapper.c,sha256=hqLY69JIClKhQ8a26tEF-NyzjGzNS_Yu6wlnfv5DFKI,4121
6
- rda_python_setuid/pywrapper.py,sha256=pyQZfITTpxQ_lVkWc_0ZJRF_sZnq8NQdOvR5lObu6mw,2898
7
- rda_python_setuid-1.0.7.dist-info/licenses/LICENSE,sha256=1dck4EAQwv8QweDWCXDx-4Or0S8YwiCstaso_H57Pno,1097
8
- rda_python_setuid-1.0.7.dist-info/METADATA,sha256=k4ULqMhiQY9HBuGtQEuKZOawd1s29wRCyO2EHbh_ulA,4995
9
- rda_python_setuid-1.0.7.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
10
- rda_python_setuid-1.0.7.dist-info/entry_points.txt,sha256=mWZUCa2KYzGsYVa33M7W03CY9SMsJYsywlIDF-4iMaQ,165
11
- rda_python_setuid-1.0.7.dist-info/top_level.txt,sha256=ONMhKLagyTBktuz5dTyipSnRC0YhomTMs8eFRjM9kHQ,18
12
- rda_python_setuid-1.0.7.dist-info/RECORD,,