Debian Codegraph @

doc/sources/admin/external2f.rst

raw
1 External Second Factor
2 ======================
3
4 This basic plugin can be used to add a second factor authentication
5 device (SMS, OTP,...). It uses external commands to send or validate a
6 second factor. Any language is allowed to call your 2nd factor system.
7
8 Commands
9 --------
10
11 Commands receive arguments on command line and must return a 0 code if
12 succeed, another else. **Nothing must be written to STDOUT**, STDERR is
13 reported in logs (but may be lost with FastCGI server).
14
15 Configuration
16 ~~~~~~~~~~~~~
17
18 All parameters are configured in "General Parameters » Portal Parameters
19 » Extensions » External 2nd Factor".
20
21 - **Activation**
22 - **Code regex**: regular expression to create an OTP code. Let this
23 option blank to delegate code Generation / Verification to an
24 external provider
25 - **Send command**: define your command using *$attribute* like in
26 rules. Example: ``/usr/local/bin/sendOtp --uid $uid`` or
27 ``/usr/local/bin/sendCode --uid $uid --code $code`` if code is
28 generated by the Portal
29 - **Validation command**: Required ONLY if you delegate code Generation
30 / Verification to an external provider. You must also use *$code*
31 which is the value entered by user; Example:
32 ``/usr/local/bin/verify --uid $uid --code $code``
33 - **Re-send interval**: Set this to a non-empty value to allow the user to
34 re-send the code in case a transmission error occured. The value sets how
35 many seconds the user has to wait before each attempt
36 - **Authentication level** (Optional): if you want to overwrite the
37 value sent by your authentication module, you can define here the new
38 authentication level. Example: 5
39 - **Label** (Optional): label that should be displayed to the user on
40 the choice screen
41 - **Logo** (Optional): logo file (in static/<skin> directory)
42
43
44 .. attention::
45
46 The command line is split in an array and launched with
47 exec(). So you don't need to enclose arguments in quotes to protect your
48 system against shell injection. However, you can not use any space except
49 to separate arguments.
50
51 SELinux note
52 ^^^^^^^^^^^^
53
54 If your server is enforcing SELinux policies, make sure your external
55 script has a label that is allowed to be executed by ``httpd``.
56
57 For example, storing your script in ``/usr/local/bin/`` will give it a
58 ``bin_t`` label that will work correctly.
59
60 If your script has a ``httpd_sys_script_exec_t`` type, it will only be
61 able to do external network requests if the SELinux boolean
62 ``httpd_can_network_connect`` is enabled.
63
64 If your script has any other label, it will probably not work at all.