taldir

Directory service to resolve wallet mailboxes by messenger addresses
Log | Files | Refs | Submodules | README | LICENSE

commit 956d46eb5540851325e1050423ab36c958b4e835
parent 5d26139353011c22f4924b4ed94a367d2c3847ab
Author: Martin Schanzenbach <schanzen@gnunet.org>
Date:   Sat, 21 Mar 2026 09:51:43 +0100

update section naming

Diffstat:
MMakefile.in | 3++-
Mcmd/taldir-cli/main.go | 2+-
Mcmd/taldir-server/main.go | 8++++----
Mcmd/taldir-server/main_test.go | 2+-
Adoc/man/directory.conf.5 | 270+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ddoc/man/taler-directory.conf.5 | 270-------------------------------------------------------------------------------
Mpkg/taldir/command_validator.go | 4++--
Mpkg/taldir/disseminator_gns.go | 10+++++-----
Mpkg/taldir/oidc_validator.go | 6+++---
Mpkg/taldir/taldir.go | 42+++++++++++++++++++++---------------------
Mtaldir.conf.example | 12++++++------
11 files changed, 315 insertions(+), 314 deletions(-)

diff --git a/Makefile.in b/Makefile.in @@ -29,6 +29,7 @@ install: server tools chmod +x scripts/validators/* cp scripts/validators/* ${DESTDIR}${bindir} -mkdir -p ${DESTDIR}${mandir}/man1 + -mkdir -p ${DESTDIR}${mandir}/man5 cp doc/man/taler-directory-cli.1 ${DESTDIR}${mandir}/man1/ cp doc/man/taler-directory-config.1 ${DESTDIR}${mandir}/man1/ cp doc/man/taler-directory-httpd.1 ${DESTDIR}${mandir}/man1/ @@ -37,7 +38,7 @@ install: server tools cp taldir.conf.example ${DESTDIR}${TALER_DIRECTORY_HOME} uninstall: - ${RM} ${DESTDIR}${bindir}/taler-directory* + -${RM} ${DESTDIR}${bindir}/taler-directory* -${RM} -r ${DESTDIR}${TALER_DIRECTORY_HOME} -${RM} -r ${DESTDIR}${mandir}/man1/taler-directory* -${RM} -r ${DESTDIR}${mandir}/man5/taler-directory* diff --git a/cmd/taldir-cli/main.go b/cmd/taldir-cli/main.go @@ -86,7 +86,7 @@ func main() { fmt.Printf("%s %s", filepath.Base(fullName), version) return } - host := _cfg.Section("taldir").Key("base_url").MustString("http://localhost") + host := _cfg.Section("directory").Key("base_url").MustString("http://localhost") if *solveFlag { if len(*challengeFlag) == 0 || len(*pubkeyFlag) == 0 { fmt.Println("You need to provide an activation challenge and a public key to generate a solution") diff --git a/cmd/taldir-server/main.go b/cmd/taldir-server/main.go @@ -51,7 +51,7 @@ var ( ) func handleRequests(t *taldir.Taldir) { - log.Fatal(http.ListenAndServe(t.Cfg.Ini.Section("taldir").Key("bind_to").MustString("localhost:11000"), t.Router)) + log.Fatal(http.ListenAndServe(t.Cfg.Ini.Section("directory").Key("bind_to").MustString("localhost:11000"), t.Router)) } func printHelp() { @@ -102,15 +102,15 @@ func main() { log.Fatalf("Failed to read config: %v", err) os.Exit(1) } - psqlconn := cfg.Section("taldir-pq").Key("connection_string").MustString("postgres:///taler-directory") + psqlconn := cfg.Section("directory-pq").Key("connection_string").MustString("postgres:///taler-directory") db, err := sql.Open("postgres", psqlconn) if err != nil { log.Panic(err) } defer db.Close() - merchURL := cfg.Section("taldir").Key("base_url_merchant").MustString("https://backend.demo.taler.net") - merchToken := cfg.Section("taldir").Key("merchant_token").MustString("sandbox") + merchURL := cfg.Section("directory").Key("base_url_merchant").MustString("https://backend.demo.taler.net") + merchToken := cfg.Section("directory").Key("merchant_token").MustString("sandbox") cfg.WriteTo(os.Stdout) t.Initialize(taldir.TaldirConfig{ Ini: cfg, diff --git a/cmd/taldir-server/main_test.go b/cmd/taldir-server/main_test.go @@ -102,7 +102,7 @@ func TestMain(m *testing.M) { if err != nil { log.Fatalf("Failed to read config: %v", err) } - psqlconn := cfg.Section("taldir-pq").Key("connection_string").MustString("postgres:///taler-directory") + psqlconn := cfg.Section("directory-pq").Key("connection_string").MustString("postgres:///taler-directory") segments := strings.Split(strings.Split(psqlconn, "?")[0], "/") dbName := segments[len(segments)-1] diff --git a/doc/man/directory.conf.5 b/doc/man/directory.conf.5 @@ -0,0 +1,270 @@ +.\" Man page generated from reStructuredText. +. +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.TH "DIRECTORY.CONF" "5" "Mar 21, 2026" "1.0" "GNU Taler" +.SH NAME +directory.conf \- Taler directory configuration file +.SH DESCRIPTION +.sp +The configuration file is line\-oriented. Blank lines and whitespace at the +beginning and end of a line are ignored. Comments start with \fB#\fP or \fB%\fP +in the first column (after any beginning\-of\-line whitespace) and go to the end +of the line. +.sp +The file is split into sections. Every section begins with \fB[SECTIONNAME]\fP +and contains a number of options of the form \fBOPTION=VALUE\fP\&. There may be +whitespace around the \fB=\fP (equal sign). Section names and options are +\fIcase\-insensitive\fP\&. +.sp +The values, however, are \fIcase\-sensitive\fP\&. In particular, boolean values are +one of \fBYES\fP or \fBNO\fP\&. Values can include whitespace by surrounding the +entire value with \fB\(dq\fP (double quote). Note, however, that there are no +escape characters in such strings; all characters between the double quotes +(including other double quotes) are taken verbatim. +.sp +Values that represent a time duration are represented as a series +of one or more \fBNUMBER UNIT\fP pairs, e.g. \fB60 s\fP, \fB4 weeks 1 day\fP, +\fB5 years 2 minutes\fP\&. +.sp +Values that represent an amount are in the usual amount syntax: +\fBCURRENCY:VALUE.FRACTION\fP, e.g. \fBEUR:1.50\fP\&. +The \fBFRACTION\fP portion may extend up to 8 places. +.sp +Values that represent filenames can begin with a \fB/bin/sh\fP\-like variable +reference. This can be simple, such as \fB$TMPDIR/foo\fP, or complex, such as +\fB${TMPDIR:\-${TMP:\-/tmp}}/foo\fP\&. The variables are expanded either using +key\-values from the \fB[PATHS]\fP section (see below) or from the environment +(\fBgetenv()\fP). The values from \fB[PATHS]\fP take precedence over those from +the environment. If the variable name is found in neither \fB[PATHS]\fP nor the +environment, a warning is printed and the value is left unchanged. Variables (including those from the environment) are expanded recursively, so if \fBFOO=$BAR\fP and \fBBAR=buzz\fP then the result is \fBFOO=buzz\fP\&. Recursion is bounded to at most 128 levels to avoid undefined behavior for mutually recursive expansions like if \fBBAR=$FOO\fP in the example above. +.sp +The \fB[PATHS]\fP section is special in that it contains paths that can be +referenced using \fB$\fP in other configuration values that specify +\fIfilenames\fP\&. Note that configuration options that are not specifically +retrieved by the application as \fIfilenames\fP will not see “$”\-expressions +expanded. To expand \fB$\fP\-expressions when using \fBtaler\-config\fP, you must pass +the \fB\-f\fP command\-line option. +.sp +The system automatically pre\-populates the \fB[PATHS]\fP section with a few values +at run\-time (in addition to the values that are in the actual configuration +file and automatically overwriting those values if they are present). +These automatically generated values refer to installation properties +from \X'tty: link https://www.gnu.org/prep/standards/html_node/Directory-Variables.html'\fI\%GNU autoconf\fP\X'tty: link'\&. The +values are usually dependent on an \fBINSTALL_PREFIX\fP which is determined by +the \fB\-\-prefix\fP option given to configure. The canonical values are: +.INDENT 0.0 +.IP \(bu 2 +LIBEXECDIR = $INSTALL_PREFIX/taler/libexec/ +.IP \(bu 2 +DOCDIR = $INSTALL_PREFIX/share/doc/taler/ +.IP \(bu 2 +ICONDIR = $INSTALL_PREFIX/share/icons/ +.IP \(bu 2 +LOCALEDIR = $INSTALL_PREFIX/share/locale/ +.IP \(bu 2 +PREFIX = $INSTALL_PREFIX/ +.IP \(bu 2 +BINDIR = $INSTALL_PREFIX/bin/ +.IP \(bu 2 +LIBDIR = $INSTALL_PREFIX/lib/taler/ +.IP \(bu 2 +DATADIR = $INSTALL_PREFIX/share/taler/ +.UNINDENT +.sp +Note that on some platforms, the given paths may differ depending +on how the system was compiled or installed, the above are just the +canonical locations of the various resources. These +automatically generated values are never written to disk. +.sp +Files containing default values for many of the options described below +are installed under \fB$PREFIX/share/taler\-directory/config.d/\fP\&. +The configuration file given with \fB\-c\fP to taler\-directory binaries +overrides these defaults. +.sp +A configuration file may include another, by using the \fB@INLINE@\fP directive, +for example, in \fBmain.conf\fP, you could write \fB@INLINE@ sub.conf\fP to +include the entirety of \fBsub.conf\fP at that point in \fBmain.conf\fP\&. +.sp +Be extra careful when using \fBtaler\-directory\-config \-V VALUE\fP to change configuration +values: it will destroy all uses of \fB@INLINE@\fP and furthermore remove all +comments from the configuration file! +.SS GLOBAL OPTIONS +.sp +The following options are from the “[directory]” section. +.INDENT 0.0 +.TP +.B BASE_URL +The base URL of the service. If your service is proxied, the external base URL this service is availiable at. +Default: \fBhttp://localhost:11000\fP +.TP +.B CHALLENGE_BYTES +Number of bytes of the challenge. +Default: \fB16\fP +.TP +.B VALIDATION_INITIATION_MAX +Maximum number of pending validations for the same alias. +Default: \fB3\fP +.TP +.B SOLUTION_ATTEMPT_MAX +Maximum times a solution may be attempted for an active validation. +Default: \fB3\fP +.TP +.B VALIDATION_TIMEFRAME +Cooldown period between two successive validation requests (for the same alias). +Default: \fB5m\fP +.TP +.B SOLUTION_ATTEMPT_TIMEFRAME +Duration for which a solution must be provided for any given validation. +Default: \fB1h\fP +.TP +.B VALIDATION_EXPIRATION +Time until a pending validation expires +Default: \fB24h\fP +.TP +.B VALID_PAYMENT_SYSTEM_ADDRESS_REGEX +Defines valid payment system addresses that may be registered. +Default: \fB\&.*\fP +.TP +.B MONTHLY_FEE +Cost for registration of a single month. +Default: \fBKUDOS:0\fP +.TP +.B NAVIGATION +The navigation (header) HTML template file. If relative will be interpreted relative to DATADIR. +Default: \fBweb/templates/nav.html\fP +.TP +.B FOOTER +The footer HTML template file. If relative will be interpreted relative to DATADIR. +Default: \fBweb/templates/footer.html\fP +.TP +.B IMPRINT_PAGE +The imprint HTML template file. If relative will be interpreted relative to DATADIR. +Default: \fBweb/templates/imprint.html\fP +.TP +.B ABOUT_PAGE +The about HTML template file. If relative will be interpreted relative to DATADIR. +Default: \fBweb/templates/about.html\fP +.TP +.B LANDING_PAGE +The landing page HTML template file. If relative will be interpreted relative to DATADIR. +Default: \fBweb/templates/landing.html\fP +.TP +.B VALIDATION_LANDING +The validation landing HTML template file. If relative will be interpreted relative to DATADIR. +Default: \fBweb/templates/validation_landing.html\fP +.TP +.B LOOKUP_RESULT_PAGE +The lookup result HTML template file. If relative will be interpreted relative to DATADIR. +Default: \fBweb/templates/validation_landing.html\fP +.UNINDENT +.sp +The following options are from a “[directory\-<validator>]” section. +.INDENT 0.0 +.TP +.B ENABLED +Is this validator enabled or disabled. +Default: \fBfalse\fP +.TP +.B TYPE +What type of validator is this. Options: \fBcommand\fP, \fBoidc\fP\&. +Default: \fBcommand\fP +.TP +.B CHALLENGE_FEE +What does the initiation of a challenge cost. +Default: \fBKUDOS:0\fP +.TP +.B VALID_ALIAS_REGEX +Defines which aliases are valid in this validator context. +Default: empty +.TP +.B COMMAND +Only when TYPE \fBcommand\fP\&. The command to execute. Must be set if TYPE is \fBcommand\fP\&. +Default: unset +.TP +.B SENDER +What should the sender of the email be. Only read by the email validator. +Default: unset +.TP +.B AUTHORIZATION_ENDPOINT +Only when TYPE \fBoidc\fP\&. The URI of the authorization endpoint. +Default: unset +.TP +.B TOKEN_ENDPOINT +Only when TYPE \fBoidc\fP\&. The URI of the token endpoint. +Default: unset +.TP +.B USERINFO_ENDPOINT +Only when TYPE \fBoidc\fP\&. The URI of the userinfo endpoint. +Default: unset +.TP +.B CLIENT_ID +Only when TYPE \fBoidc\fP\&. The OAuth client_id. +Default: unset +.TP +.B CLIENT_SECRET +Only when TYPE \fBoidc\fP\&. The OAuth client_secret. +Default: unset +.TP +.B SCOPE +Only when TYPE \fBoidc\fP\&. The OAuth scope(s) to request. +Default: unset +.TP +.B ALIAS_CLAIM +Only when TYPE \fBoidc\fP\&. The claim to read from the userinfo response. Must be equal to the alias that is being validated. +Default: \fBsub\fP +.UNINDENT +.sp +The following options are from a “[directory\-<disseminator>]” section. +.INDENT 0.0 +.TP +.B ENABLED +Is this disseminator enabled or disabled. +Default: \fBfalse\fP +.TP +.B ZONE +The name (not ZEKY) of the local zone authoritative for publication of the directory. +Default: unset +.TP +.B EXPIRATION +The relative expiration time of the record sets. +Default: \fB1d\fP +.UNINDENT +.SH SEE ALSO +.sp +taler\-directory\-dbinit(1), taler\-directory\-httpd(1), taler\-directory\-config(1). +.SH BUGS +.sp +Report bugs by using \X'tty: link https://bugs.taler.net/'\fI\%https://bugs.taler.net/\fP\X'tty: link' or by sending electronic +mail to <\X'tty: link mailto:taler@gnu.org'\fI\%taler@gnu.org\fP\X'tty: link'>. +.SH AUTHOR +GNU Taler contributors +.SH COPYRIGHT +2014-2025 Taler Systems SA (GPLv3+ or GFDL 1.3+) +.\" Generated by docutils manpage writer. +. diff --git a/doc/man/taler-directory.conf.5 b/doc/man/taler-directory.conf.5 @@ -1,270 +0,0 @@ -.\" Man page generated from reStructuredText. -. -. -.nr rst2man-indent-level 0 -. -.de1 rstReportMargin -\\$1 \\n[an-margin] -level \\n[rst2man-indent-level] -level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] -- -\\n[rst2man-indent0] -\\n[rst2man-indent1] -\\n[rst2man-indent2] -.. -.de1 INDENT -.\" .rstReportMargin pre: -. RS \\$1 -. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] -. nr rst2man-indent-level +1 -.\" .rstReportMargin post: -.. -.de UNINDENT -. RE -.\" indent \\n[an-margin] -.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] -.nr rst2man-indent-level -1 -.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] -.in \\n[rst2man-indent\\n[rst2man-indent-level]]u -.. -.TH "TALER-DIRECTORY.CONF" "5" "Mar 21, 2026" "1.0" "GNU Taler" -.SH NAME -taler-directory.conf \- Taler directory configuration file -.SH DESCRIPTION -.sp -The configuration file is line\-oriented. Blank lines and whitespace at the -beginning and end of a line are ignored. Comments start with \fB#\fP or \fB%\fP -in the first column (after any beginning\-of\-line whitespace) and go to the end -of the line. -.sp -The file is split into sections. Every section begins with \fB[SECTIONNAME]\fP -and contains a number of options of the form \fBOPTION=VALUE\fP\&. There may be -whitespace around the \fB=\fP (equal sign). Section names and options are -\fIcase\-insensitive\fP\&. -.sp -The values, however, are \fIcase\-sensitive\fP\&. In particular, boolean values are -one of \fBYES\fP or \fBNO\fP\&. Values can include whitespace by surrounding the -entire value with \fB\(dq\fP (double quote). Note, however, that there are no -escape characters in such strings; all characters between the double quotes -(including other double quotes) are taken verbatim. -.sp -Values that represent a time duration are represented as a series -of one or more \fBNUMBER UNIT\fP pairs, e.g. \fB60 s\fP, \fB4 weeks 1 day\fP, -\fB5 years 2 minutes\fP\&. -.sp -Values that represent an amount are in the usual amount syntax: -\fBCURRENCY:VALUE.FRACTION\fP, e.g. \fBEUR:1.50\fP\&. -The \fBFRACTION\fP portion may extend up to 8 places. -.sp -Values that represent filenames can begin with a \fB/bin/sh\fP\-like variable -reference. This can be simple, such as \fB$TMPDIR/foo\fP, or complex, such as -\fB${TMPDIR:\-${TMP:\-/tmp}}/foo\fP\&. The variables are expanded either using -key\-values from the \fB[PATHS]\fP section (see below) or from the environment -(\fBgetenv()\fP). The values from \fB[PATHS]\fP take precedence over those from -the environment. If the variable name is found in neither \fB[PATHS]\fP nor the -environment, a warning is printed and the value is left unchanged. Variables (including those from the environment) are expanded recursively, so if \fBFOO=$BAR\fP and \fBBAR=buzz\fP then the result is \fBFOO=buzz\fP\&. Recursion is bounded to at most 128 levels to avoid undefined behavior for mutually recursive expansions like if \fBBAR=$FOO\fP in the example above. -.sp -The \fB[PATHS]\fP section is special in that it contains paths that can be -referenced using \fB$\fP in other configuration values that specify -\fIfilenames\fP\&. Note that configuration options that are not specifically -retrieved by the application as \fIfilenames\fP will not see “$”\-expressions -expanded. To expand \fB$\fP\-expressions when using \fBtaler\-config\fP, you must pass -the \fB\-f\fP command\-line option. -.sp -The system automatically pre\-populates the \fB[PATHS]\fP section with a few values -at run\-time (in addition to the values that are in the actual configuration -file and automatically overwriting those values if they are present). -These automatically generated values refer to installation properties -from \X'tty: link https://www.gnu.org/prep/standards/html_node/Directory-Variables.html'\fI\%GNU autoconf\fP\X'tty: link'\&. The -values are usually dependent on an \fBINSTALL_PREFIX\fP which is determined by -the \fB\-\-prefix\fP option given to configure. The canonical values are: -.INDENT 0.0 -.IP \(bu 2 -LIBEXECDIR = $INSTALL_PREFIX/taler/libexec/ -.IP \(bu 2 -DOCDIR = $INSTALL_PREFIX/share/doc/taler/ -.IP \(bu 2 -ICONDIR = $INSTALL_PREFIX/share/icons/ -.IP \(bu 2 -LOCALEDIR = $INSTALL_PREFIX/share/locale/ -.IP \(bu 2 -PREFIX = $INSTALL_PREFIX/ -.IP \(bu 2 -BINDIR = $INSTALL_PREFIX/bin/ -.IP \(bu 2 -LIBDIR = $INSTALL_PREFIX/lib/taler/ -.IP \(bu 2 -DATADIR = $INSTALL_PREFIX/share/taler/ -.UNINDENT -.sp -Note that on some platforms, the given paths may differ depending -on how the system was compiled or installed, the above are just the -canonical locations of the various resources. These -automatically generated values are never written to disk. -.sp -Files containing default values for many of the options described below -are installed under \fB$PREFIX/share/taler\-directory/config.d/\fP\&. -The configuration file given with \fB\-c\fP to taler\-directory binaries -overrides these defaults. -.sp -A configuration file may include another, by using the \fB@INLINE@\fP directive, -for example, in \fBmain.conf\fP, you could write \fB@INLINE@ sub.conf\fP to -include the entirety of \fBsub.conf\fP at that point in \fBmain.conf\fP\&. -.sp -Be extra careful when using \fBtaler\-directory\-config \-V VALUE\fP to change configuration -values: it will destroy all uses of \fB@INLINE@\fP and furthermore remove all -comments from the configuration file! -.SS GLOBAL OPTIONS -.sp -The following options are from the “[taler\-directory]” section. -.INDENT 0.0 -.TP -.B BASE_URL -The base URL of the service. If your service is proxied, the external base URL this service is availiable at. -Default: \fBhttp://localhost:11000\fP -.TP -.B CHALLENGE_BYTES -Number of bytes of the challenge. -Default: \fB16\fP -.TP -.B VALIDATION_INITIATION_MAX -Maximum number of pending validations for the same alias. -Default: \fB3\fP -.TP -.B SOLUTION_ATTEMPT_MAX -Maximum times a solution may be attempted for an active validation. -Default: \fB3\fP -.TP -.B VALIDATION_TIMEFRAME -Cooldown period between two successive validation requests (for the same alias). -Default: \fB5m\fP -.TP -.B SOLUTION_ATTEMPT_TIMEFRAME -Duration for which a solution must be provided for any given validation. -Default: \fB1h\fP -.TP -.B VALIDATION_EXPIRATION -Time until a pending validation expires -Default: \fB24h\fP -.TP -.B VALID_PAYMENT_SYSTEM_ADDRESS_REGEX -Defines valid payment system addresses that may be registered. -Default: \fB\&.*\fP -.TP -.B MONTHLY_FEE -Cost for registration of a single month. -Default: \fBKUDOS:0\fP -.TP -.B NAVIGATION -The navigation (header) HTML template file. If relative will be interpreted relative to DATADIR. -Default: \fBweb/templates/nav.html\fP -.TP -.B FOOTER -The footer HTML template file. If relative will be interpreted relative to DATADIR. -Default: \fBweb/templates/footer.html\fP -.TP -.B IMPRINT_PAGE -The imprint HTML template file. If relative will be interpreted relative to DATADIR. -Default: \fBweb/templates/imprint.html\fP -.TP -.B ABOUT_PAGE -The about HTML template file. If relative will be interpreted relative to DATADIR. -Default: \fBweb/templates/about.html\fP -.TP -.B LANDING_PAGE -The landing page HTML template file. If relative will be interpreted relative to DATADIR. -Default: \fBweb/templates/landing.html\fP -.TP -.B VALIDATION_LANDING -The validation landing HTML template file. If relative will be interpreted relative to DATADIR. -Default: \fBweb/templates/validation_landing.html\fP -.TP -.B LOOKUP_RESULT_PAGE -The lookup result HTML template file. If relative will be interpreted relative to DATADIR. -Default: \fBweb/templates/validation_landing.html\fP -.UNINDENT -.sp -The following options are from a “[taler\-directory\-<validator>]” section. -.INDENT 0.0 -.TP -.B ENABLED -Is this validator enabled or disabled. -Default: \fBfalse\fP -.TP -.B TYPE -What type of validator is this. Options: \fBcommand\fP, \fBoidc\fP\&. -Default: \fBcommand\fP -.TP -.B CHALLENGE_FEE -What does the initiation of a challenge cost. -Default: \fBKUDOS:0\fP -.TP -.B VALID_ALIAS_REGEX -Defines which aliases are valid in this validator context. -Default: empty -.TP -.B COMMAND -Only when TYPE \fBcommand\fP\&. The command to execute. Must be set if TYPE is \fBcommand\fP\&. -Default: unset -.TP -.B SENDER -What should the sender of the email be. Only read by the email validator. -Default: unset -.TP -.B AUTHORIZATION_ENDPOINT -Only when TYPE \fBoidc\fP\&. The URI of the authorization endpoint. -Default: unset -.TP -.B TOKEN_ENDPOINT -Only when TYPE \fBoidc\fP\&. The URI of the token endpoint. -Default: unset -.TP -.B USERINFO_ENDPOINT -Only when TYPE \fBoidc\fP\&. The URI of the userinfo endpoint. -Default: unset -.TP -.B CLIENT_ID -Only when TYPE \fBoidc\fP\&. The OAuth client_id. -Default: unset -.TP -.B CLIENT_SECRET -Only when TYPE \fBoidc\fP\&. The OAuth client_secret. -Default: unset -.TP -.B SCOPE -Only when TYPE \fBoidc\fP\&. The OAuth scope(s) to request. -Default: unset -.TP -.B ALIAS_CLAIM -Only when TYPE \fBoidc\fP\&. The claim to read from the userinfo response. Must be equal to the alias that is being validated. -Default: \fBsub\fP -.UNINDENT -.sp -The following options are from a “[taler\-directory\-<disseminator>]” section. -.INDENT 0.0 -.TP -.B ENABLED -Is this disseminator enabled or disabled. -Default: \fBfalse\fP -.TP -.B ZONE -The name (not ZEKY) of the local zone authoritative for publication of the directory. -Default: unset -.TP -.B EXPIRATION -The relative expiration time of the record sets. -Default: \fB1d\fP -.UNINDENT -.SH SEE ALSO -.sp -taler\-directory\-dbinit(1), taler\-directory\-httpd(1), taler\-directory\-config(1). -.SH BUGS -.sp -Report bugs by using \X'tty: link https://bugs.taler.net/'\fI\%https://bugs.taler.net/\fP\X'tty: link' or by sending electronic -mail to <\X'tty: link mailto:taler@gnu.org'\fI\%taler@gnu.org\fP\X'tty: link'>. -.SH AUTHOR -GNU Taler contributors -.SH COPYRIGHT -2014-2025 Taler Systems SA (GPLv3+ or GFDL 1.3+) -.\" Generated by docutils manpage writer. -. diff --git a/pkg/taldir/command_validator.go b/pkg/taldir/command_validator.go @@ -56,7 +56,7 @@ func (t CommandValidator) Name() string { } func (t CommandValidator) ChallengeFee() string { - return t.config.Ini.Section("taler-directory-validator-" + t.name).Key("challenge_fee").MustString("KUDOS:0") + return t.config.Ini.Section("directory-validator-" + t.name).Key("challenge_fee").MustString("KUDOS:0") } func (t CommandValidator) IsAliasValid(alias string) (err error) { @@ -85,7 +85,7 @@ func (t CommandValidator) RegistrationStart(topic string, link string, message s } func makeCommandValidator(cfg *TaldirConfig, name string, landingPageTpl *template.Template) CommandValidator { - sec := cfg.Ini.Section("taler-directory-validator-" + name) + sec := cfg.Ini.Section("directory-validator-" + name) return CommandValidator{ name: name, config: cfg, diff --git a/pkg/taldir/disseminator_gns.go b/pkg/taldir/disseminator_gns.go @@ -34,7 +34,7 @@ func (d *GnsDisseminator) gnsCheckIsDisseminated(e *Entry) bool { if err != nil { return false } - zone := d.config.Ini.Section("taler-directory-disseminator-gns").Key("zone").MustString("taldir") + zone := d.config.Ini.Section("directory-disseminator-gns").Key("zone").MustString("taldir") out, err := exec.Command(path, "--lookup", e.HsAlias+"."+zone, "--type", "TXT").Output() if err != nil { return false @@ -50,7 +50,7 @@ func (d *GnsDisseminator) DisseminateStop(e *Entry) error { if err != nil { return fmt.Errorf("path of command not found: %w", err) } - zone := d.config.Ini.Section("taler-directory-disseminator-gns").Key("zone").MustString("taldir") + zone := d.config.Ini.Section("directory-disseminator-gns").Key("zone").MustString("taldir") out, err := exec.Command(path, "--delete", "--public", "--zone", zone, "--type", "TXT", "--name", e.HsAlias, "--value", e.TargetURI).Output() if err != nil { return fmt.Errorf("failed to execute disseminator command: `%s', %w", out, err) @@ -67,8 +67,8 @@ func (d *GnsDisseminator) DisseminateStart(e *Entry) error { if err != nil { return fmt.Errorf("path of command not found: %w", err) } - expiration := d.config.Ini.Section("taler-directory-disseminator-gns").Key("expiration").MustString("1d") - zone := d.config.Ini.Section("taler-directory-disseminator-gns").Key("zone").MustString("taldir") + expiration := d.config.Ini.Section("directory-disseminator-gns").Key("expiration").MustString("1d") + zone := d.config.Ini.Section("directory-disseminator-gns").Key("zone").MustString("taldir") out, err := exec.Command(path, "--add", "--public", "--expiration", expiration, "--zone", zone, "--type", "TXT", "--name", e.HsAlias, "--value", e.TargetURI).Output() if err != nil { return fmt.Errorf("failed to execute disseminator command: `%s', %w", out, err) @@ -81,7 +81,7 @@ func (d *GnsDisseminator) Name() string { } func (d *GnsDisseminator) IsEnabled() bool { - return d.config.Ini.Section("taler-directory-disseminator-gns").Key("enabled").MustBool(false) + return d.config.Ini.Section("directory-disseminator-gns").Key("enabled").MustBool(false) } func makeGnsDisseminator(cfg *TaldirConfig) GnsDisseminator { diff --git a/pkg/taldir/oidc_validator.go b/pkg/taldir/oidc_validator.go @@ -110,7 +110,7 @@ func (t OidcValidator) Name() string { } func (t OidcValidator) ChallengeFee() string { - return t.config.Ini.Section("taler-directory-validator-" + t.name).Key("challenge_fee").MustString("KUDOS:0") + return t.config.Ini.Section("directory-validator-" + t.name).Key("challenge_fee").MustString("KUDOS:0") } func (t OidcValidator) IsAliasValid(alias string) (err error) { @@ -203,11 +203,11 @@ func (t OidcValidator) RegistrationStart(topic string, link string, message stri } func makeOidcValidator(cfg *TaldirConfig, name string, landingPageTpl *template.Template) OidcValidator { - mainSec := cfg.Ini.Section("taler-directory") + mainSec := cfg.Ini.Section("directory") baseURL := mainSec.Key("base_url").MustString("") // FIXME escape URI? redirectURI := fmt.Sprintf("%s/oidc_validator/%s", baseURL, name) - sec := cfg.Ini.Section("taler-directory-validator-" + name) + sec := cfg.Ini.Section("directory-validator-" + name) return OidcValidator{ name: name, config: cfg, diff --git a/pkg/taldir/taldir.go b/pkg/taldir/taldir.go @@ -645,7 +645,7 @@ func (t *Taldir) configResponse(w http.ResponseWriter, r *http.Request) { cfg := VersionResponse{ Version: "0:0:0", Name: "taler-directory", - MonthlyFee: t.Cfg.Ini.Section("taler-directory").Key("monthly_fee").MustString("KUDOS:1"), + MonthlyFee: t.Cfg.Ini.Section("directory").Key("monthly_fee").MustString("KUDOS:1"), AliasType: meths, } w.Header().Set("Content-Type", "application/json") @@ -740,7 +740,7 @@ func (t *Taldir) ClearDatabase() { } func (t *Taldir) termsResponse(w http.ResponseWriter, r *http.Request) { - s := t.Cfg.Ini.Section("taler-directory") + s := t.Cfg.Ini.Section("directory") termspath := t.getFileName(s.Key("default_terms_path").MustString("terms/")) tos.ServiceTermsResponse(w, r, termspath, tos.TalerTosConfig{ DefaultFileType: s.Key("default_doc_filetype").MustString("text/html"), @@ -975,9 +975,9 @@ func (t *Taldir) Initialize(cfg TaldirConfig) { } t.I18n = i18n - navTplFile := t.getFileName(cfg.Ini.Section("taler-directory").Key("navigation").MustString("web/templates/nav.html")) - footerTplFile := t.getFileName(cfg.Ini.Section("taler-directory").Key("footer").MustString("web/templates/footer.html")) - t.BaseURL = cfg.Ini.Section("taler-directory").Key("base_url").MustString("http://localhost:11000") + navTplFile := t.getFileName(cfg.Ini.Section("directory").Key("navigation").MustString("web/templates/nav.html")) + footerTplFile := t.getFileName(cfg.Ini.Section("directory").Key("footer").MustString("web/templates/footer.html")) + t.BaseURL = cfg.Ini.Section("directory").Key("base_url").MustString("http://localhost:11000") t.Validators = make(map[string]Validator) for _, sec := range cfg.Ini.Sections() { if !strings.HasPrefix(sec.Name(), "taler-directory-validator-") { @@ -1019,28 +1019,28 @@ func (t *Taldir) Initialize(cfg TaldirConfig) { t.Disseminators[gnsdisseminator.Name()] = &gnsdisseminator t.Logger.Logf(LogInfo, "Disseminator `%s' enabled.\n", gnsdisseminator.Name()) } - t.ChallengeBytes = cfg.Ini.Section("taler-directory").Key("challenge_bytes").MustInt(16) - t.ValidationInitiationMax = cfg.Ini.Section("taler-directory").Key("validation_initiation_max").MustInt64(3) - t.SolutionAttemptsMax = cfg.Ini.Section("taler-directory").Key("solution_attempt_max").MustInt(3) + t.ChallengeBytes = cfg.Ini.Section("directory").Key("challenge_bytes").MustInt(16) + t.ValidationInitiationMax = cfg.Ini.Section("directory").Key("validation_initiation_max").MustInt64(3) + t.SolutionAttemptsMax = cfg.Ini.Section("directory").Key("solution_attempt_max").MustInt(3) - validationTTLStr := cfg.Ini.Section("taler-directory").Key("validation_timeframe").MustString("5m") - t.ValidPMSRegex = cfg.Ini.Section("taler-directory").Key("valid_payment_system_address_regex").MustString(".*") + validationTTLStr := cfg.Ini.Section("directory").Key("validation_timeframe").MustString("5m") + t.ValidPMSRegex = cfg.Ini.Section("directory").Key("valid_payment_system_address_regex").MustString(".*") t.ValidationTimeframe, err = time.ParseDuration(validationTTLStr) if err != nil { t.Logger.InternalLogger.Fatal(err) os.Exit(1) } - retryTimeframeStr := cfg.Ini.Section("taler-directory").Key("solution_attempt_timeframe").MustString("1h") + retryTimeframeStr := cfg.Ini.Section("directory").Key("solution_attempt_timeframe").MustString("1h") t.SolutionTimeframe, err = time.ParseDuration(retryTimeframeStr) if err != nil { t.Logger.InternalLogger.Fatal(err) os.Exit(1) } - t.MonthlyFee = cfg.Ini.Section("taler-directory").Key("monthly_fee").MustString("KUDOS:0") + t.MonthlyFee = cfg.Ini.Section("directory").Key("monthly_fee").MustString("KUDOS:0") t.DB = cfg.Db - if cfg.Ini.Section("taler-directory").Key("purge_mappings_on_startup_dangerous").MustBool(false) { + if cfg.Ini.Section("directory").Key("purge_mappings_on_startup_dangerous").MustBool(false) { t.Logger.Logf(LogWarning, "DANGER Purging mappings!") num, err := DeleteAllEntriesFromDatabase(t.DB) if err != nil { @@ -1049,7 +1049,7 @@ func (t *Taldir) Initialize(cfg TaldirConfig) { t.Logger.Logf(LogDebug, "Deleted %d entries.\n", num) } // Clean up validations - validationExpStr := cfg.Ini.Section("taler-directory").Key("validation_expiration").MustString("24h") + validationExpStr := cfg.Ini.Section("directory").Key("validation_expiration").MustString("24h") validationExp, err := time.ParseDuration(validationExpStr) if err != nil { t.Logger.InternalLogger.Fatal(err) @@ -1065,31 +1065,31 @@ func (t *Taldir) Initialize(cfg TaldirConfig) { time.Sleep(validationExp) } }() - imprintTplFile := t.getFileName(cfg.Ini.Section("taler-directory").Key("imprint_page").MustString("web/templates/imprint.html")) + imprintTplFile := t.getFileName(cfg.Ini.Section("directory").Key("imprint_page").MustString("web/templates/imprint.html")) t.ImprintTpl, err = template.ParseFiles(imprintTplFile, navTplFile, footerTplFile) if err != nil { t.Logger.InternalLogger.Fatal(err) os.Exit(1) } - validationLandingTplFile := t.getFileName(cfg.Ini.Section("taler-directory").Key("validation_landing").MustString("web/templates/validation_landing.html")) + validationLandingTplFile := t.getFileName(cfg.Ini.Section("directory").Key("validation_landing").MustString("web/templates/validation_landing.html")) t.ValidationTpl, err = template.ParseFiles(validationLandingTplFile, navTplFile, footerTplFile) if err != nil { t.Logger.InternalLogger.Fatal(err) os.Exit(1) } - landingTplFile := t.getFileName(cfg.Ini.Section("taler-directory").Key("landing_page").MustString("web/templates/landing.html")) + landingTplFile := t.getFileName(cfg.Ini.Section("directory").Key("landing_page").MustString("web/templates/landing.html")) t.LandingPageTpl, err = template.ParseFiles(landingTplFile, navTplFile, footerTplFile) if err != nil { t.Logger.InternalLogger.Fatal(err) os.Exit(1) } - lookupResultTplFile := t.getFileName(cfg.Ini.Section("taler-directory").Key("lookup_result_page").MustString("web/templates/lookup_result.html")) + lookupResultTplFile := t.getFileName(cfg.Ini.Section("directory").Key("lookup_result_page").MustString("web/templates/lookup_result.html")) t.LookupResultPageTpl, err = template.ParseFiles(lookupResultTplFile, navTplFile, footerTplFile) if err != nil { t.Logger.InternalLogger.Fatal(err) os.Exit(1) } - aboutTplFile := t.getFileName(cfg.Ini.Section("taler-directory").Key("about_page").MustString("web/templates/about.html")) + aboutTplFile := t.getFileName(cfg.Ini.Section("directory").Key("about_page").MustString("web/templates/about.html")) t.AboutPageTpl, err = template.ParseFiles(aboutTplFile, navTplFile, footerTplFile) if err != nil { t.Logger.InternalLogger.Fatal(err) @@ -1097,9 +1097,9 @@ func (t *Taldir) Initialize(cfg TaldirConfig) { } t.Salt = os.Getenv("TALDIR_SALT") if t.Salt == "" { - t.Salt = cfg.Ini.Section("taler-directory").Key("salt").MustString("ChangeMe") + t.Salt = cfg.Ini.Section("directory").Key("salt").MustString("ChangeMe") } - t.Host = cfg.Ini.Section("taler-directory").Key("base_url").MustString("http://localhost") + t.Host = cfg.Ini.Section("directory").Key("base_url").MustString("http://localhost") t.Merchant = cfg.Merchant registrationCost, _ := talerutil.ParseAmount(t.MonthlyFee) merchConfig, err := t.Merchant.GetConfig() diff --git a/taldir.conf.example b/taldir.conf.example @@ -1,4 +1,4 @@ -[taler-directory] +[directory] footer = web/templates/footer.html base_url = http://localhost:11000 challenge_bytes = 16 @@ -14,21 +14,21 @@ landing_page = web/templates/landing.html lookup_result_page = web/templates/lookup_result.html salt = ChangeMe -[taler-directory-pq] +[directory-pq] connection_string = postgres:///taler-directory?host=/var/run/postgresql -[taler-directory-validator-email] +[directory-validator-email] type = command enabled = true command = test valid_alias_regex='^\S+@\S+\.\S+$' -[taler-directory-validator-phone] +[directory-validator-phone] type = command enabled = true command = test -[taler-directory-validator-oidctest] +[directory-validator-oidctest] type = oidc enabled = false authorization_endpoint=http://127.0.0.1:9400/oauth2/authorize @@ -40,7 +40,7 @@ scope=openid email valid_alias_regex='^\S+@\S+\.\S+$' alias_claim=sub -[taler-directory-validator-mastodon] +[directory-validator-mastodon] type = oidc enabled = true authorization_endpoint=https://mastodon.social/oauth/authorize