pywebexec 1.7.2__py3-none-any.whl → 1.7.3__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.
- pywebexec/pywebexec.py +12 -11
- pywebexec/static/js/script.js +1 -1
- pywebexec/version.py +2 -2
- {pywebexec-1.7.2.dist-info → pywebexec-1.7.3.dist-info}/METADATA +3 -3
- {pywebexec-1.7.2.dist-info → pywebexec-1.7.3.dist-info}/RECORD +9 -9
- {pywebexec-1.7.2.dist-info → pywebexec-1.7.3.dist-info}/LICENSE +0 -0
- {pywebexec-1.7.2.dist-info → pywebexec-1.7.3.dist-info}/WHEEL +0 -0
- {pywebexec-1.7.2.dist-info → pywebexec-1.7.3.dist-info}/entry_points.txt +0 -0
- {pywebexec-1.7.2.dist-info → pywebexec-1.7.3.dist-info}/top_level.txt +0 -0
pywebexec/pywebexec.py
CHANGED
@@ -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=
|
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
|
711
|
+
if conn.result["result"] == 0:
|
706
712
|
return True
|
707
|
-
|
708
|
-
|
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:
|
pywebexec/static/js/script.js
CHANGED
@@ -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 || ''}
|
pywebexec/version.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: pywebexec
|
3
|
-
Version: 1.7.
|
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
|
@@ -1,6 +1,6 @@
|
|
1
1
|
pywebexec/__init__.py,sha256=4spIsVaF8RJt8S58AG_wWoORRNkws9Iwqprj27C3ljM,99
|
2
|
-
pywebexec/pywebexec.py,sha256=
|
3
|
-
pywebexec/version.py,sha256=
|
2
|
+
pywebexec/pywebexec.py,sha256=YlPtbHqISlpQN5S0gPVk0gRbvuJtg1rXrF2SPzgUXjA,33456
|
3
|
+
pywebexec/version.py,sha256=Lv0gR-NbC-8DxwfmwXEmOzSq6Hgx6MH4xF1fYh_opXo,411
|
4
4
|
pywebexec/static/css/Consolas NF.ttf,sha256=DJEOzF0eqZ-kxu3Gs_VE8X0NJqiobBzmxWDGpdgGRxI,1313900
|
5
5
|
pywebexec/static/css/style.css,sha256=3s7QgbCh4wb7kfZ7Pjo-B6o3lDIBogZ-3j6AfaPdpzU,8209
|
6
6
|
pywebexec/static/css/xterm.css,sha256=uo5phWaUiJgcz0DAzv46uoByLLbJLeetYosL1xf68rY,5559
|
@@ -22,7 +22,7 @@ pywebexec/static/images/running.svg,sha256=fBCYwYb2O9K4N3waC2nURP25NRwZlqR4PbDZy
|
|
22
22
|
pywebexec/static/images/success.svg,sha256=NVwezvVMplt46ElW798vqGfrL21Mw_DWHUp_qiD_FU8,489
|
23
23
|
pywebexec/static/js/commands.js,sha256=h2fkd9qpypLBxvhEEbay23nwuqUwcKJA0vHugcyL8pU,7961
|
24
24
|
pywebexec/static/js/popup.js,sha256=UPKtjPLIR5KaAV2i1iWUGwcCTX1tT3vnOIMc8VKQqag,9311
|
25
|
-
pywebexec/static/js/script.js,sha256=
|
25
|
+
pywebexec/static/js/script.js,sha256=yO2PEsyO1F5w3lSCJyKkAtp21Tb7I3MQMPibxvdmFOc,18198
|
26
26
|
pywebexec/static/js/xterm/LICENSE,sha256=EU1P4eXTull-_T9I80VuwnJXubB-zLzUl3xpEYj2T1M,1083
|
27
27
|
pywebexec/static/js/xterm/addon-canvas.js,sha256=ez6QTVvsmLVNJmdJlM-ZQ5bErwlxAQ_9DUmDIptl2TM,94607
|
28
28
|
pywebexec/static/js/xterm/addon-canvas.js.map,sha256=ECBA4B-BqUpdFeRzlsEWLSQnudnhLP-yPQJ8_hKquMo,379537
|
@@ -35,9 +35,9 @@ pywebexec/static/js/xterm/xterm.js.map,sha256=Y7O2Pb-fIS7Z8AC1D5s04_aiW_Jf1f4mCf
|
|
35
35
|
pywebexec/templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
36
36
|
pywebexec/templates/index.html,sha256=2fEN8cggHBEd8-RamDFpnekVJtIbRembFSw0-1YEptc,2979
|
37
37
|
pywebexec/templates/popup.html,sha256=GT2jY7oOxpCaBaRl924QJWdFBmfSOP952T13d37R_pY,1506
|
38
|
-
pywebexec-1.7.
|
39
|
-
pywebexec-1.7.
|
40
|
-
pywebexec-1.7.
|
41
|
-
pywebexec-1.7.
|
42
|
-
pywebexec-1.7.
|
43
|
-
pywebexec-1.7.
|
38
|
+
pywebexec-1.7.3.dist-info/LICENSE,sha256=gRJf0JPT_wsZJsUGlWPTS8Vypfl9vQ1qjp6sNbKykuA,1064
|
39
|
+
pywebexec-1.7.3.dist-info/METADATA,sha256=-JC0TqKo6F5B43R4TKYjxzoyXvL986W-djlTshi6dUM,8060
|
40
|
+
pywebexec-1.7.3.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
41
|
+
pywebexec-1.7.3.dist-info/entry_points.txt,sha256=l52GBkPCXRkmlHfEyoVauyfBdg8o-CAtC8qQpOIjJK0,55
|
42
|
+
pywebexec-1.7.3.dist-info/top_level.txt,sha256=vHoHyzngrfGdm_nM7Xn_5iLmaCrf10XO1EhldgNLEQ8,10
|
43
|
+
pywebexec-1.7.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|