mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-13 00:07:26 +00:00
System: Access: Users - add "system list shells" and hook to shell field, closes https://github.com/opnsense/core/issues/8155
This commit is contained in:
parent
e0e7e0b638
commit
96a1145c3e
1
plist
1
plist
@ -1264,6 +1264,7 @@
|
||||
/usr/local/opnsense/scripts/system/flush_config_history
|
||||
/usr/local/opnsense/scripts/system/get_locales.php
|
||||
/usr/local/opnsense/scripts/system/ha_xmlrpc_exec.php
|
||||
/usr/local/opnsense/scripts/system/list_shells.py
|
||||
/usr/local/opnsense/scripts/system/nameservers.php
|
||||
/usr/local/opnsense/scripts/system/remote_backup.php
|
||||
/usr/local/opnsense/scripts/system/rfc5246_cipher_suites.csv
|
||||
|
||||
@ -24,13 +24,9 @@
|
||||
<expires type=".\ExpiresField"/>
|
||||
<authorizedkeys type=".\StoreB64Field"/>
|
||||
<otp_seed type="TextField"/>
|
||||
<shell type="OptionField">
|
||||
<shell type="JsonKeyValueStoreField">
|
||||
<ConfigdPopulateAct>system list shells</ConfigdPopulateAct>
|
||||
<BlankDesc>Default (none for all but root)</BlankDesc>
|
||||
<OptionValues>
|
||||
<o0 value="/bin/csh">/bin/csh</o0>
|
||||
<o1 value="/bin/sh">/bin/sh</o1>
|
||||
<o2 value="/bin/tcsh">/bin/tcsh</o2>
|
||||
</OptionValues>
|
||||
</shell>
|
||||
<password type="UpdateOnlyTextField"/>
|
||||
<scrambled_password type="BooleanField" volatile="true"/>
|
||||
|
||||
35
src/opnsense/scripts/system/list_shells.py
Executable file
35
src/opnsense/scripts/system/list_shells.py
Executable file
@ -0,0 +1,35 @@
|
||||
#!/usr/local/bin/python3
|
||||
|
||||
"""
|
||||
Copyright (c) 2024 Ad Schellevis <ad@opnsense.org>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
"""
|
||||
|
||||
import json
|
||||
|
||||
result = {}
|
||||
for line in [line.rstrip() for line in open('/etc/shells')]:
|
||||
if line.startswith('/') and line.find('opnsense-') == -1:
|
||||
result[line] = line
|
||||
print(json.dumps(result))
|
||||
@ -143,6 +143,14 @@ type:script_output
|
||||
message:list locales
|
||||
cache_ttl:300
|
||||
|
||||
[list.shells]
|
||||
command:/usr/local/opnsense/scripts/system/list_shells.py
|
||||
parameters:
|
||||
type:script_output
|
||||
message:list shells
|
||||
cache_ttl:300
|
||||
|
||||
|
||||
[status]
|
||||
command:/usr/local/opnsense/scripts/system/status.php
|
||||
parameters:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user