pywebexec 1.7.2__tar.gz → 1.7.3__tar.gz

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.
Files changed (50) hide show
  1. {pywebexec-1.7.2/pywebexec.egg-info → pywebexec-1.7.3}/PKG-INFO +3 -3
  2. {pywebexec-1.7.2 → pywebexec-1.7.3}/README.md +2 -2
  3. {pywebexec-1.7.2 → pywebexec-1.7.3}/pywebexec/pywebexec.py +12 -11
  4. {pywebexec-1.7.2 → pywebexec-1.7.3}/pywebexec/static/js/script.js +1 -1
  5. {pywebexec-1.7.2 → pywebexec-1.7.3}/pywebexec/version.py +2 -2
  6. {pywebexec-1.7.2 → pywebexec-1.7.3/pywebexec.egg-info}/PKG-INFO +3 -3
  7. {pywebexec-1.7.2 → pywebexec-1.7.3}/.github/workflows/python-publish.yml +0 -0
  8. {pywebexec-1.7.2 → pywebexec-1.7.3}/.gitignore +0 -0
  9. {pywebexec-1.7.2 → pywebexec-1.7.3}/LICENSE +0 -0
  10. {pywebexec-1.7.2 → pywebexec-1.7.3}/pyproject.toml +0 -0
  11. {pywebexec-1.7.2 → pywebexec-1.7.3}/pywebexec/__init__.py +0 -0
  12. {pywebexec-1.7.2 → pywebexec-1.7.3}/pywebexec/static/css/Consolas NF.ttf +0 -0
  13. {pywebexec-1.7.2 → pywebexec-1.7.3}/pywebexec/static/css/style.css +0 -0
  14. {pywebexec-1.7.2 → pywebexec-1.7.3}/pywebexec/static/css/xterm.css +0 -0
  15. {pywebexec-1.7.2 → pywebexec-1.7.3}/pywebexec/static/images/aborted.svg +0 -0
  16. {pywebexec-1.7.2 → pywebexec-1.7.3}/pywebexec/static/images/copy.svg +0 -0
  17. {pywebexec-1.7.2 → pywebexec-1.7.3}/pywebexec/static/images/copy_ok.svg +0 -0
  18. {pywebexec-1.7.2 → pywebexec-1.7.3}/pywebexec/static/images/down-arrow.svg +0 -0
  19. {pywebexec-1.7.2 → pywebexec-1.7.3}/pywebexec/static/images/failed.svg +0 -0
  20. {pywebexec-1.7.2 → pywebexec-1.7.3}/pywebexec/static/images/favicon.svg +0 -0
  21. {pywebexec-1.7.2 → pywebexec-1.7.3}/pywebexec/static/images/fit-tty.svg +0 -0
  22. {pywebexec-1.7.2 → pywebexec-1.7.3}/pywebexec/static/images/fit-win.svg +0 -0
  23. {pywebexec-1.7.2 → pywebexec-1.7.3}/pywebexec/static/images/font-decrease.svg +0 -0
  24. {pywebexec-1.7.2 → pywebexec-1.7.3}/pywebexec/static/images/font-increase.svg +0 -0
  25. {pywebexec-1.7.2 → pywebexec-1.7.3}/pywebexec/static/images/norun.svg +0 -0
  26. {pywebexec-1.7.2 → pywebexec-1.7.3}/pywebexec/static/images/pause.svg +0 -0
  27. {pywebexec-1.7.2 → pywebexec-1.7.3}/pywebexec/static/images/popup.svg +0 -0
  28. {pywebexec-1.7.2 → pywebexec-1.7.3}/pywebexec/static/images/resume.svg +0 -0
  29. {pywebexec-1.7.2 → pywebexec-1.7.3}/pywebexec/static/images/running.svg +0 -0
  30. {pywebexec-1.7.2 → pywebexec-1.7.3}/pywebexec/static/images/success.svg +0 -0
  31. {pywebexec-1.7.2 → pywebexec-1.7.3}/pywebexec/static/js/commands.js +0 -0
  32. {pywebexec-1.7.2 → pywebexec-1.7.3}/pywebexec/static/js/popup.js +0 -0
  33. {pywebexec-1.7.2 → pywebexec-1.7.3}/pywebexec/static/js/xterm/LICENSE +0 -0
  34. {pywebexec-1.7.2 → pywebexec-1.7.3}/pywebexec/static/js/xterm/addon-canvas.js +0 -0
  35. {pywebexec-1.7.2 → pywebexec-1.7.3}/pywebexec/static/js/xterm/addon-canvas.js.map +0 -0
  36. {pywebexec-1.7.2 → pywebexec-1.7.3}/pywebexec/static/js/xterm/addon-fit.js +0 -0
  37. {pywebexec-1.7.2 → pywebexec-1.7.3}/pywebexec/static/js/xterm/addon-fit.js.map +0 -0
  38. {pywebexec-1.7.2 → pywebexec-1.7.3}/pywebexec/static/js/xterm/addon-unicode11.js +0 -0
  39. {pywebexec-1.7.2 → pywebexec-1.7.3}/pywebexec/static/js/xterm/addon-unicode11.js.map +0 -0
  40. {pywebexec-1.7.2 → pywebexec-1.7.3}/pywebexec/static/js/xterm/xterm.js +0 -0
  41. {pywebexec-1.7.2 → pywebexec-1.7.3}/pywebexec/static/js/xterm/xterm.js.map +0 -0
  42. {pywebexec-1.7.2 → pywebexec-1.7.3}/pywebexec/templates/__init__.py +0 -0
  43. {pywebexec-1.7.2 → pywebexec-1.7.3}/pywebexec/templates/index.html +0 -0
  44. {pywebexec-1.7.2 → pywebexec-1.7.3}/pywebexec/templates/popup.html +0 -0
  45. {pywebexec-1.7.2 → pywebexec-1.7.3}/pywebexec.egg-info/SOURCES.txt +0 -0
  46. {pywebexec-1.7.2 → pywebexec-1.7.3}/pywebexec.egg-info/dependency_links.txt +0 -0
  47. {pywebexec-1.7.2 → pywebexec-1.7.3}/pywebexec.egg-info/entry_points.txt +0 -0
  48. {pywebexec-1.7.2 → pywebexec-1.7.3}/pywebexec.egg-info/requires.txt +0 -0
  49. {pywebexec-1.7.2 → pywebexec-1.7.3}/pywebexec.egg-info/top_level.txt +0 -0
  50. {pywebexec-1.7.2 → pywebexec-1.7.3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: pywebexec
3
- Version: 1.7.2
3
+ Version: 1.7.3
4
4
  Summary: Simple Python HTTP Exec Server
5
5
  Home-page: https://github.com/joknarf/pywebexec
6
6
  Author: Franck Jouvanceau
@@ -157,9 +157,9 @@ Generated password is given if no `--pasword` option
157
157
  $ export PYWEBEXEC_LDAP_SERVER=ldap://ldap.forumsys.com:389
158
158
  $ export PYWEBEXEC_LDAP_BIND_DN="cn=read-only-admin,dc=example,dc=com"
159
159
  $ export PYWEBEXEC_LDAP_BIND_PASSWORD="password"
160
- $ export PYWEBEXEC_LDAP_GROUPS="ou=mathematicians,ou=scientists"
161
- $ export PYWEBEXEC_LDAP_USER_ID="uid"
162
160
  $ export PYWEBEXEC_LDAP_BASE_DN="dc=example,dc=com"
161
+ $ export PYWEBEXEC_LDAP_USER_ID="uid" # sAMAccountName for AD
162
+ $ export PYWEBEXEC_LDAP_GROUPS="ou=mathematicians,dc=example,dc=com ou=scientists,dc=example,dc=com"
163
163
  $ pywebexec
164
164
  ```
165
165
  ## HTTPS server
@@ -94,9 +94,9 @@ Generated password is given if no `--pasword` option
94
94
  $ export PYWEBEXEC_LDAP_SERVER=ldap://ldap.forumsys.com:389
95
95
  $ export PYWEBEXEC_LDAP_BIND_DN="cn=read-only-admin,dc=example,dc=com"
96
96
  $ export PYWEBEXEC_LDAP_BIND_PASSWORD="password"
97
- $ export PYWEBEXEC_LDAP_GROUPS="ou=mathematicians,ou=scientists"
98
- $ export PYWEBEXEC_LDAP_USER_ID="uid"
99
97
  $ export PYWEBEXEC_LDAP_BASE_DN="dc=example,dc=com"
98
+ $ export PYWEBEXEC_LDAP_USER_ID="uid" # sAMAccountName for AD
99
+ $ export PYWEBEXEC_LDAP_GROUPS="ou=mathematicians,dc=example,dc=com ou=scientists,dc=example,dc=com"
100
100
  $ pywebexec
101
101
  ```
102
102
  ## HTTPS server
@@ -36,7 +36,7 @@ app.config['SESSION_COOKIE_SAMESITE'] = 'Lax' # Add SameSite attribute to sessi
36
36
  auth = HTTPBasicAuth()
37
37
 
38
38
  app.config['LDAP_SERVER'] = os.environ.get('PYWEBEXEC_LDAP_SERVER')
39
- app.config['LDAP_USER_ID'] = os.environ.get('PYWEBEXEC_LDAP_USER_ID', "uid")
39
+ app.config['LDAP_USER_ID'] = os.environ.get('PYWEBEXEC_LDAP_USER_ID', "uid") # sAMAccountName
40
40
  app.config['LDAP_GROUPS'] = os.environ.get('PYWEBEXEC_LDAP_GROUPS')
41
41
  app.config['LDAP_BASE_DN'] = os.environ.get('PYWEBEXEC_LDAP_BASE_DN')
42
42
  app.config['LDAP_BIND_DN'] = os.environ.get('PYWEBEXEC_LDAP_BIND_DN')
@@ -593,6 +593,7 @@ def read_commands():
593
593
  'start_time': status.get('start_time', 'N/A'),
594
594
  'end_time': status.get('end_time', 'N/A'),
595
595
  'command': command,
596
+ 'user': status.get('user'),
596
597
  'exit_code': status.get('exit_code', 'N/A'),
597
598
  'last_output_line': status.get('last_output_line'),
598
599
  })
@@ -687,13 +688,18 @@ def verify_ldap(username, password):
687
688
  tls_configuration = Tls(validate=ssl.CERT_NONE, version=ssl.PROTOCOL_TLSv1_2) if app.config['LDAP_SERVER'].startswith("ldaps:") else None
688
689
  server = Server(app.config['LDAP_SERVER'], tls=tls_configuration, get_info=ALL)
689
690
  user_filter = f"({app.config['LDAP_USER_ID']}={username})"
691
+ group_filter = ""
692
+ if app.config["LDAP_GROUPS"]:
693
+ group_filter = "".join(f"(memberOf={group})" for group in app.config['LDAP_GROUPS'].split(" "))
694
+ group_filter = f"(|{group_filter})"
695
+ ldap_filter = f"(&(objectClass=person){user_filter}{group_filter})"
690
696
  try:
691
697
  # Bind with the bind DN and password
692
698
  conn = Connection(server, user=app.config['LDAP_BIND_DN'], password=app.config['LDAP_BIND_PASSWORD'], authentication=SIMPLE, auto_bind=True, read_only=True)
693
699
  try:
694
- conn.search(search_base=app.config['LDAP_BASE_DN'], search_filter=user_filter, search_scope=SUBTREE)
700
+ conn.search(search_base=app.config['LDAP_BASE_DN'], search_filter=ldap_filter, search_scope=SUBTREE)
695
701
  if len(conn.entries) == 0:
696
- print(f"User {username} not found in LDAP.")
702
+ print(f"User {username} not found in LDAP in allowed groups.")
697
703
  return False
698
704
  user_dn = conn.entries[0].entry_dn
699
705
  finally:
@@ -702,15 +708,10 @@ def verify_ldap(username, password):
702
708
  # Bind with the user DN and password to verify credentials
703
709
  conn = Connection(server, user=user_dn, password=password, authentication=SIMPLE, auto_bind=True, read_only=True)
704
710
  try:
705
- if not app.config['LDAP_GROUPS'] and conn.result["result"] == 0:
711
+ if conn.result["result"] == 0:
706
712
  return True
707
- group_filter = "".join([f'({group})' for group in app.config['LDAP_GROUPS'].split(",")])
708
- group_filter = f"(&{group_filter}(|(member={user_dn})(uniqueMember={user_dn})))"
709
- conn.search(search_base=app.config['LDAP_BASE_DN'], search_filter=group_filter, search_scope=SUBTREE)
710
- result = len(conn.entries) > 0
711
- if not result:
712
- print(f"User {username} is not a member of groups {app.config['LDAP_GROUPS']}.")
713
- return result
713
+ print(f"{username}: Password mismatch")
714
+ return False
714
715
  finally:
715
716
  conn.unbind()
716
717
  except Exception as e:
@@ -186,7 +186,7 @@ async function fetchCommands(hide=false) {
186
186
  <td>
187
187
  ${command.command.startsWith('term') ? '' : command.status === 'running' ? `<button onclick="stopCommand('${command.command_id}', event)">Stop</button>` : `<button onclick="relaunchCommand('${command.command_id}', event)">Run</button>`}
188
188
  </td>
189
- <td class="system-font">${command.command.replace(/^\.\//, '')}</td>
189
+ <td class="system-font" title="${command.user == '-' ? '' : command.user}">${command.command.replace(/^\.\//, '')}</td>
190
190
  <td class="monospace outcol">
191
191
  <button class="popup-button" onclick="openPopup('${command.command_id}', event)"></button>
192
192
  ${command.last_output_line || ''}
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '1.7.2'
16
- __version_tuple__ = version_tuple = (1, 7, 2)
15
+ __version__ = version = '1.7.3'
16
+ __version_tuple__ = version_tuple = (1, 7, 3)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: pywebexec
3
- Version: 1.7.2
3
+ Version: 1.7.3
4
4
  Summary: Simple Python HTTP Exec Server
5
5
  Home-page: https://github.com/joknarf/pywebexec
6
6
  Author: Franck Jouvanceau
@@ -157,9 +157,9 @@ Generated password is given if no `--pasword` option
157
157
  $ export PYWEBEXEC_LDAP_SERVER=ldap://ldap.forumsys.com:389
158
158
  $ export PYWEBEXEC_LDAP_BIND_DN="cn=read-only-admin,dc=example,dc=com"
159
159
  $ export PYWEBEXEC_LDAP_BIND_PASSWORD="password"
160
- $ export PYWEBEXEC_LDAP_GROUPS="ou=mathematicians,ou=scientists"
161
- $ export PYWEBEXEC_LDAP_USER_ID="uid"
162
160
  $ export PYWEBEXEC_LDAP_BASE_DN="dc=example,dc=com"
161
+ $ export PYWEBEXEC_LDAP_USER_ID="uid" # sAMAccountName for AD
162
+ $ export PYWEBEXEC_LDAP_GROUPS="ou=mathematicians,dc=example,dc=com ou=scientists,dc=example,dc=com"
163
163
  $ pywebexec
164
164
  ```
165
165
  ## HTTPS server
File without changes
File without changes
File without changes
File without changes