bank-manual.rst (11644B)
1 .. 2 This file is part of GNU TALER. 3 Copyright (C) 2014-2025 Taler Systems SA 4 5 TALER is free software; you can redistribute it and/or modify it under the 6 terms of the GNU Affero General Public License as published by the Free Software 7 Foundation; either version 2.1, or (at your option) any later version. 8 9 TALER is distributed in the hope that it will be useful, but WITHOUT ANY 10 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 11 A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. 12 13 You should have received a copy of the GNU Affero General Public License along with 14 TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> 15 16 @author Florian Dold 17 @author Marcello Stanisci 18 @author Christian Grothoff 19 20 .. target audience: operator, developer 21 22 .. _libeufin-bank: 23 24 Bank Setup Manual 25 ################# 26 27 libeufin-bank implements a simple core banking system with 28 account and REST APIs, including REST APIs for a Web interface 29 and REST APIs to interact with GNU Taler components. 30 31 In this manual, we explain how to setup a bank. 32 33 .. contents:: Table of Contents 34 :local: 35 36 37 Installing LibEuFin Bank 38 ======================== 39 40 The following section was tested on an *OpenJDK 17* environment. 41 42 Installing the libeufin-bank binary packages on Debian 43 ------------------------------------------------------ 44 45 .. include:: ../frags/installing-debian.rst 46 47 .. include:: ../frags/apt-install-libeufin-bank.rst 48 49 50 Installing the libeufin-bank binary packages on Ubuntu 51 ------------------------------------------------------ 52 53 .. include:: ../frags/installing-ubuntu.rst 54 55 .. include:: ../frags/apt-install-libeufin-bank.rst 56 57 58 Building from source 59 -------------------- 60 61 Bank belongs to the LibEuFin project, and can be downloaded via Git: 62 63 .. code-block:: console 64 65 $ git clone git://git.taler.net/libeufin 66 67 In order to build and run LibEuFin, you must have GNU Make and the JDK 17 68 installed and configured in your system. Note that the correct versions of 69 Kotlin and Gradle will be installed automatically by the GNU Make script. 70 71 Navigate into the *libeufin* local repository, and from top-level run: 72 73 .. code-block:: console 74 75 $ ./bootstrap 76 $ ./configure --prefix=$PREFIX 77 $ make install 78 79 If the previous steps succeeded, the ``libeufin-bank`` command should 80 be found in the $PATH. 81 82 83 Minimal Configuration for LibEuFin Bank 84 ======================================= 85 86 The following snippet shows the mandatory configuration values: 87 88 .. code-block:: ini 89 90 [libeufin-bank] 91 CURRENCY = KUDOS 92 93 # THe public URL that the bank will be served under 94 BASE_URL = https://bank.taler.net 95 96 # Supported payment target type 97 WIRE_TYPE = iban or x-taler-bank 98 # If WIRE_TYPE = iban 99 IBAN_PAYTO_BIC = SANDBOXX 100 101 .. note:: 102 Refer to the manpage ``libeufin-man.conf(5)`` 103 for the full array of configuration values. 104 105 Configuring password storage 106 ---------------------------- 107 108 libeufin-bank uses secure password hashing algorithms to store user passwords. For the moment, only ``bcrypt`` is supported. The default configuration is: 109 110 .. code-block:: ini 111 112 [libeufin-bank] 113 PWD_HASH_ALGORITHM = bcrypt 114 PWD_HASH_CONFIG = { "cost": 8 } 115 116 As password authentication is used frequently, password hashing should only take a few milliseconds. If your server's CPU is too weak, you should reduce the ``cost`` and you may want to increase it otherwise. You can measure the password hashing speed using the following command: 117 118 .. code-block:: console 119 120 $ libeufin-bank bench-pwh -c "$CONFIG_FILE" 121 122 .. _libeufin-mfa: 123 124 Configuring multi-factor authentication 125 --------------------------------------- 126 127 libeufin-bank supports two-factor authentication. libeufin-bank uses helper scripts to send challenge codes to addresses for multi-factor authentication. We provide two default helper scripts: ``libeufin-tan-email.sh`` to send e-mails and ``libeufin-tan-sms.sh`` to send SMS. To enable two-factor authentication you need to configure at least one TAN channel. 128 129 SMS TAN channel 130 +++++++++++++++ 131 132 The default ``libeufin-tan-sms.sh`` script is based on the `Telesign <https://www.telesign.com>`_ SMS provider. It requires an additional ``TELESIGN_AUTH_TOKEN`` environment variable for `Telesign Basic authentication <https://developer.telesign.com/enterprise/docs/authentication#basic-authentication>`_. 133 134 To test your setup run: 135 136 .. code-block:: console 137 138 $ TELESIGN_AUTH_TOKEN=$TELESIGN_TOKEN 139 $ echo "Test 1234" | libeufin-tan-sms.sh $PHONE 140 141 If you received an SMS containing "Test 1234" you can enable this channel in the config: 142 143 .. code-block:: ini 144 145 [libeufin-bank] 146 TAN_SMS = libeufin-tan-sms.sh 147 TAN_SMS_ENV = "TELESIGN_AUTH_TOKEN=$TELESIGN_TOKEN" 148 149 Mail TAN channel 150 ++++++++++++++++ 151 152 The default ``libeufin-tan-email.sh`` script is based on the ``mail`` Linux command. It requires a working local mail transfer agent. 153 154 To test your setup run: 155 156 .. code-block:: console 157 158 $ echo "Test 1234" | libeufin-tan-email.sh $EMAIL 159 160 If you received an email containing "Test 1234" you can enable this channel in the config: 161 162 .. code-block:: ini 163 164 [libeufin-bank] 165 TAN_EMAIL = libeufin-tan-email.sh 166 167 Custom TAN channel scripts 168 ++++++++++++++++++++++++++ 169 170 It is possible to replace these scripts with use custom scripts to send 171 the e-mail or SMS TAN. Such alternative scripts must accept the phone number / e-mail address as the ``$1`` parameter and the message content to be transmitted in their standard input. They should return 0 to indicate successful transmission of the challenge and non-zero on failure. 172 173 To change the scripts used for multi-factor authentication, change the following 174 options in the configuration file: 175 176 .. code-block:: ini 177 178 [libeufin-bank] 179 TAN_SMS = custom-tan-sms.sh 180 TAN_SMS_ENV = 181 TAN_EMAIL = custom-tan-email.sh 182 TAN_EMAIL_ENV = 183 184 Launching libeufin-bank 185 ======================= 186 187 Assuming that the configuration file exists at ``$CONFIG_FILE``, the following 188 command initializes (or upgrades) the database schema: 189 190 .. code-block:: console 191 192 $ libeufin-bank-dbinit -c "$CONFIG_FILE" 193 194 Once this is done, you can start the libeufin-bank HTTP server: 195 196 .. code-block:: console 197 198 $ libeufin-bank serve -c "$CONFIG_FILE" 199 200 201 Using the bank Web interface 202 ============================ 203 204 To be able to use the Web interface, you must set a password for the "admin" 205 account. You can set (or reset) the account password to ``$PASSWORD`` using 206 the following command: 207 208 .. code-block:: console 209 210 $ libeufin-bank passwd -c "$CONFIG_FILE" admin "$PASSWORD" 211 212 You can also use the same command to reset the passwords of other accounts by 213 replacing "admin" with the respective login. 214 215 216 Setting up accounts 217 ------------------- 218 219 Using the above "$PASSWORD", log into the Web interface as "admin". To setup 220 regular accounts, search for the button "Create account" near the list of all 221 existing bank accounts in the Web interface of libeufin-bank. 222 223 You will be asked to specify: 224 225 Username 226 A unique account name the user will use to access the bank account. 227 228 Name 229 Legal name of the user or business owning the account. 230 231 Email 232 E-mail address of the account owner. Can be used to send a TAN message for 2-factor authentication (if enabled). 233 234 Phone 235 Mobile phone number of the account owner. Can be used to send a TAN message for 2-factor authentication (if enabled). 236 237 Max debt 238 Maximum amount the account is allowed to go into debt. Non-zero settings **must** be used for the "admin" account where this setting effectively creates a limit on the amount of money managed by the bank. 239 240 Is this a Taler Exchange? 241 Should be disabled except if you are setting up an account for a GNU Taler exchange. If enabled, transactions that are not compatible with a GNU Taler exchange will be automatically refused by the bank. 242 243 XXX Cashout channel 244 Used in a regional currency setup to specify the external account number of a bank account in fiat currency that belongs the merchant. Allows the merchant to exchange its regional currency money for wire transfers in fiat currency into this account. Optional. Not available unless the bank is configured for regional currencies. 245 246 Is this account public? 247 Public accounts can be viewed without access control, their balance and transaction history becomes public. 248 249 After submitting the form, a randomly created password for the new account 250 will be shown in a notification. The administrator can also change passwords 251 for any account in the system using the "change password" link in the account 252 list. To change other details about an account, select the "Username" in the 253 account list. 254 255 256 Account introspection 257 --------------------- 258 259 Users can see (and possibly change) the settings of their bank account and 260 also their IBAN by clicking on the "Welcome, $USERNAME" text after logging 261 into their bank account using their username and password. 262 263 The IBAN field has a convenient "copy to clipboard" button next to it. 264 265 266 Making transfers between accounts 267 --------------------------------- 268 269 First, you need to know the IBAN of the account to credit, and log in as the 270 user of the account to be debited. Then select "Using a form", enter the IBAN 271 under "Recipient" and specify a wire transfer subject and the total amount to 272 be wired. After pressing "Send", you may have to pass a 2-FA check. 273 274 275 Integration with the Taler Exchange 276 =================================== 277 278 .. note:: 279 280 This step is fully automated if you use the :doc:`automated setup manual<regional-automated-manual>`. 281 282 You must have an exchange account with username ``exchange`` for conversion to work. 283 Assuming that the configuration file exists at ``$CONFIG_FILE``, the following 284 command would create one: 285 286 .. code-block:: console 287 288 $ libeufin-bank create-account '{"username":"exchange","password":"$EXCHANGE_PASSWORD","name":"Cashout Exchange","is_taler_exchange":true}' -c "$CONFIG_FILE" 289 290 .. note:: 291 292 You can also set up the exchange account as "admin" using the Web interface of libeufin-bank. 293 294 Having done so, take note of two key pieces of information, namely the ``$EXCHANGE_PASSWORD`` and the "payto://"-URI of the exchange bank account. This information must then be used to configure the exchange as described in 295 :ref:`exchange bank account configuration <exchange-account-signing>`. When using the libeufin-bank in the context 296 of a regional currency with conversion, you must 297 additionally specify a "conversion-url" when setting 298 up the exchange account. See the section on :ref:`conversion setup <regional-conversion-setup>` in the regional currency setup chapter for details. 299 300 301 Withdrawing e-cash to a Taler wallet 302 ==================================== 303 304 .. note:: 305 306 This step is fully automated if you use the :doc:`automated setup manual<regional-automated-manual>`. 307 308 Users can withdraw digital cash from their bank account starting from their 309 online banking as implemented by the libeufin-bank. However, in this scenario, 310 the Taler wallet may not already know about an exchange that works with the 311 respective currency. Thus, the protocol includes the possibility of the bank 312 *recommending* an exchange service to the wallet, thus providing a sane 313 default for the wallet to suggest to the user. To do so, the base URL of the 314 exchange API must be specified in the libeufin-bank configuration: 315 316 .. code-block:: ini 317 318 [libeufin-bank] 319 DEFAULT_EXCHANGE=${PROTO}://exchange.${DOMAIN_NAME} 320 321 After changing this value, the libeufin-bank service needs to be restarted 322 to make the change effective. 323 324 .. note:: 325 326 The user may change the default exchange from within the wallet, assuming they know of an alternative exchanges for the currency.