Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config file support #326

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ m4/lt~obsolete.m4
tests/.deps/
tests/dlsym_check
man/pam_u2f.8
man/pam_u2f.8.txt
pamu2fcfg/cmdline.c
pamu2fcfg/cmdline.h
pamu2fcfg/pamu2fcfg
man/pamu2fcfg.1
tests/get_devices
tests/cfg
fuzz/fuzz_format_parsers
2 changes: 2 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ AM_CPPFLAGS = $(LIBFIDO2_CFLAGS) $(LIBCRYPTO_CFLAGS)
if ENABLE_FUZZING
AM_CPPFLAGS += -fsanitize=fuzzer-no-link
endif
AM_CPPFLAGS += -D SCONFDIR='"@SCONFDIR@"'

noinst_LTLIBRARIES = libmodule.la
libmodule_la_SOURCES = pam-u2f.c
Expand All @@ -26,6 +27,7 @@ libmodule_la_SOURCES += drop_privs.h
libmodule_la_SOURCES += expand.c
libmodule_la_SOURCES += explicit_bzero.c
libmodule_la_SOURCES += util.c util.h
libmodule_la_SOURCES += cfg.c cfg.h
libmodule_la_LIBADD = -lpam $(LIBFIDO2_LIBS) $(LIBCRYPTO_LIBS)

pampluginexecdir = $(PAMDIR)
Expand Down
32 changes: 32 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ recommended that you start a separate shell with root privileges while
configuring PAM to be able to revert changes if something goes wrong.
Test your configuration thoroughly before closing the root shell.

[[moduleArguments]]
=== Module Arguments

[horizontal]
Expand Down Expand Up @@ -240,6 +241,14 @@ FIDO devices. It is not possible to mix native credentials and SSH
credentials. Once this option is enabled all credentials will be parsed
as SSH.

conf=/path/to/pam_u2f.conf::
Set an alternative location for the <<confFile,configuration file>>.
The supplied path must be absolute and must correspond to an existing
regular file.

The options specified on the module command line override the values
from the <<confFile,configuration file>>.

IMPORTANT: On dynamic networks (e.g. where hostnames are set by DHCP),
users should not rely on the default origin and appid
("pam://$HOSTNAME") but set those parameters explicitly to the same
Expand Down Expand Up @@ -404,6 +413,29 @@ defined in the authorization mapping file. If during an authentication attempt
a connected device is removed or a new device is plugged in, the authentication
restarts from the top of the list.

[[confFile]]
== Configuration file

A configuration file can be used to set the default
<<moduleArguments,module arguments>>.

The file has a `name = value` format, with comments starting with the `#`
character.
White spaces at the beginning of line, end of line, and around
the `=` sign are ignored.

Any `conf` argument in the configuration file is ignored.

The maximum size for the configuration file is 4 KiB.

The default path for the configuration file is
`/etc/security/pam_u2f.conf`. Note that it may have been set to another
value by the distribution. The default file is allowed to not exist. An
alternative path may be set in the module command line options.

The options specified on the module command line override the values
from the configuration file.

== SELinux Note

Due to an issue with Fedora Linux, and possibly with other
Expand Down
Loading
Loading