hostapd/src/utils
Patrick Steinhardt e680a51e94 ext_password: Implement new file-based backend
It was not easily possible to separate configuration of an interface and
credentials when using the configuration file instead of the control
interface or D-Bus interface for setting up the network profiles. This
makes it hard to distribute configuration across a set of nodes which
use wpa_supplicant without also having to store credentials in the same
file. While this can be solved via scripting, having a native way to
achieve this would be preferable.

Turns out there already is a framework to have external password
storages. It only had a single "test" backend though, which is kind of
an in-memory store which gets initialized with all passwords up front
and is mainly for testing purposes. This isn't really suitable for the
above use case: the backend cannot be initialized as part of the central
configuration given that it needs the credentials, and we want to avoid
scripting.

This commit thus extends the infrastructure to implement a new backend,
which instead uses a simple configuration file containing key-value
pairs. The file follows the format which wpa_supplicant.conf(5) uses:
empty lines and comments are ignored, while passwords can be specified
with simple `password-name=password-value` assignments.

With this new backend, splitting up credentials and configuration
becomes trivial:

    # /etc/wpa_supplicant/wpa_supplicant.conf
    ext_password_backend=file:/etc/wpa_supplicant/psk.conf

    network={
        ssid="foobar"
        psk=ext:foobar
    }

    # /etc/wpa_supplicant/psk.conf
    foobar=ecdabff9c80632ec6fcffc4a8875e95d45cf93376d3b99da6881298853dc686b

Alternative approaches would be to support including other configuration
files in the main configuration, such that common configuration and
network declarations including credentials are split up into separate
files. But the implementation would probably have been more complex
compared to reusing the already-existing framework for external password
backends.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
2021-02-16 00:47:43 +02:00
..
base64.c base64: Add no-LF variant for encoding 2020-06-15 20:18:12 +03:00
base64.h base64: Add no-LF variant for encoding 2020-06-15 20:18:12 +03:00
bitfield.c Fix bitfield_get_first_zero() to not read beyond buffer 2015-03-14 13:50:12 +02:00
bitfield.h Add bitfield routines 2013-04-27 22:16:40 +03:00
browser-android.c hs20_web_browser() to allow TLS server validation to be enabled 2020-02-16 17:40:52 +02:00
browser-system.c hs20_web_browser() to allow TLS server validation to be enabled 2020-02-16 17:40:52 +02:00
browser-wpadebug.c hs20_web_browser() to allow TLS server validation to be enabled 2020-02-16 17:40:52 +02:00
browser.c webkit2: Fix http://localhost:12345/ redirect handling 2020-03-07 11:51:23 +02:00
browser.h hs20_web_browser() to allow TLS server validation to be enabled 2020-02-16 17:40:52 +02:00
build_config.h Remove forgotten Xcode defines 2013-07-09 15:20:17 +03:00
common.c Convert int_array to use size_t instead of int as the length 2020-03-22 18:50:04 +02:00
common.h Add PRINTF_FORMAT for printf wrapper functions 2020-05-02 21:04:17 +03:00
config.c wpa_supplicant: Move wpa_config_get_line() into utils 2021-02-16 00:47:43 +02:00
config.h wpa_supplicant: Move wpa_config_get_line() into utils 2021-02-16 00:47:43 +02:00
const_time.h Add helper functions for constant time operations 2019-04-09 17:11:15 +03:00
crc32.c Move CRC-32 routine from wlantest to src/utils 2016-10-09 17:13:23 +03:00
crc32.h Move CRC-32 routine from wlantest to src/utils 2016-10-09 17:13:23 +03:00
edit.c edit: Increase buffer size to 4096 bytes 2014-03-31 12:30:50 +03:00
edit.h edit: Add support for setting prompt string 2012-08-05 20:46:34 +03:00
edit_readline.c edit: Fix libreadline history clearing with WPA_TRACE 2013-05-14 16:46:38 +03:00
edit_simple.c wpa_cli: Add backspace key process for some terminal 2016-05-13 18:48:45 +03:00
eloop.c loop: Use size_t for eloop.count 2020-03-22 18:50:04 +02:00
eloop.h eloop: Fix comments mismatch eloop_event/timeout_handler definitions 2017-02-04 20:41:12 +02:00
eloop_win.c eloop: Use size_t for signal_count 2020-03-22 18:50:04 +02:00
ext_password.c ext_password: Implement new file-based backend 2021-02-16 00:47:43 +02:00
ext_password.h EXT PW: Add framework for supporting external password storage 2012-08-03 22:15:42 +03:00
ext_password_file.c ext_password: Implement new file-based backend 2021-02-16 00:47:43 +02:00
ext_password_i.h ext_password: Implement new file-based backend 2021-02-16 00:47:43 +02:00
ext_password_test.c Clear wpa_supplicant configuration keys explicitly 2014-07-02 12:38:48 +03:00
http-utils.h hs20-osu-client: Use size_t for certificate components 2020-03-22 18:50:04 +02:00
http_curl.c HTTP (curl): Replace deprecated ASN1_STRING_data() 2019-01-01 20:29:34 +02:00
includes.h Include stdbool.h to allow C99 bool to be used 2020-04-20 20:29:31 +03:00
ip_addr.c Remove unused hostapd_ip_diff() 2014-05-26 17:21:44 +03:00
ip_addr.h Remove unused hostapd_ip_diff() 2014-05-26 17:21:44 +03:00
json.c JSON: Add base64 helper functions 2020-06-15 20:19:19 +03:00
json.h JSON: Add base64 helper functions 2020-06-15 20:19:19 +03:00
list.h Fix gcc-10 build with -Werror=array-bounds and dl_list_for_each() 2020-12-04 13:59:37 +02:00
Makefile wpa_supplicant: Move wpa_config_get_line() into utils 2021-02-16 00:47:43 +02:00
module_tests.h tests: Declare module test functions in a header file 2016-06-23 18:26:09 +03:00
os.h Introduce os_memdup() 2017-03-07 13:18:49 +02:00
os_internal.c os_sleep: Use nanosleep for POSIX versions 2008 and higher 2019-09-09 16:45:40 +03:00
os_none.c Remove forgotten os_strncpy() implementations 2019-03-10 15:56:51 +02:00
os_unix.c Fix gcc-10 build with -Werror=array-bounds and dl_list_for_each() 2020-12-04 13:59:37 +02:00
os_win32.c Introduce os_memdup() 2017-03-07 13:18:49 +02:00
pcsc_funcs.c Link to, and adjust types for, the PCSC framework included with OSX 2016-08-07 11:20:33 +03:00
pcsc_funcs.h SCARD: Clean up SIM/USIM selection 2013-11-17 16:47:38 +02:00
platform.h radiotap: Silence sparse warnings about byte order swapping 2016-06-23 18:08:11 +03:00
radiotap.c radiotap: Update radiotap parser 2021-02-07 13:25:13 +02:00
radiotap.h radiotap: Update radiotap parser 2021-02-07 13:25:13 +02:00
radiotap_iter.h radiotap: Silence sparse warnings about byte order swapping 2016-06-23 18:08:11 +03:00
state_machine.h state_machine: Convert Boolean to C99 bool 2020-04-24 17:06:50 +03:00
trace.c trace: Handle binutils bfd.h breakage 2020-01-20 21:17:21 +02:00
trace.h trace: Free symbols on program exit 2016-02-16 14:10:29 +02:00
utils_module_tests.c Convert int_array to use size_t instead of int as the length 2020-03-22 18:50:04 +02:00
uuid.c WPS: Add option for using random UUID 2017-04-13 17:38:55 +03:00
uuid.h WPS: Add option for using random UUID 2017-04-13 17:38:55 +03:00
wpa_debug.c Allow debug log to be written to both syslog and file 2019-12-28 18:28:10 +02:00
wpa_debug.h Allow debug log to be written to both syslog and file 2019-12-28 18:28:10 +02:00
wpabuf.c Removed redundant NULL check for b in wpabuf_concat() 2016-10-28 19:05:08 +03:00
wpabuf.h Global parser functions to return 1 when property unchanged 2020-10-09 16:50:36 +03:00
xml-utils.c XML: Do not add empty Value node for nodes with child nodes in TNDS 2018-09-10 21:43:43 +03:00
xml-utils.h XML: Remove forgotten, unused definition of debug_print_func 2014-03-31 12:25:13 +03:00
xml_libxml2.c Clean up base64_{encode,decode} pointer types 2019-11-28 16:39:09 +02:00