bank-manual.rst (11624B)
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 Installing LibEuFin Bank 34 ======================== 35 36 The following section was tested on an *OpenJDK 17* environment. 37 38 Installing the libeufin-bank binary packages on Debian 39 ------------------------------------------------------ 40 41 .. include:: ../frags/installing-debian.rst 42 43 .. include:: ../frags/apt-install-libeufin-bank.rst 44 45 46 Installing the libeufin-bank binary packages on Ubuntu 47 ------------------------------------------------------ 48 49 .. include:: ../frags/installing-ubuntu.rst 50 51 .. include:: ../frags/apt-install-libeufin-bank.rst 52 53 54 Building from source 55 -------------------- 56 57 Bank belongs to the LibEuFin project, and can be downloaded via Git: 58 59 .. code-block:: console 60 61 $ git clone git://git.taler.net/libeufin 62 63 In order to build and run LibEuFin, you must have GNU Make and the JDK 17 64 installed and configured in your system. Note that the correct versions of 65 Kotlin and Gradle will be installed automatically by the GNU Make script. 66 67 Navigate into the *libeufin* local repository, and from top-level run: 68 69 .. code-block:: console 70 71 $ ./bootstrap 72 $ ./configure --prefix=$PREFIX 73 $ make install 74 75 If the previous steps succeeded, the ``libeufin-bank`` command should 76 be found in the $PATH. 77 78 79 Minimal Configuration for LibEuFin Bank 80 ======================================= 81 82 The following snippet shows the mandatory configuration values: 83 84 .. code-block:: ini 85 86 [libeufin-bank] 87 CURRENCY = KUDOS 88 89 # THe public URL that the bank will be served under 90 BASE_URL = https://bank.taler.net 91 92 # Supported payment target type 93 WIRE_TYPE = iban or x-taler-bank 94 # If WIRE_TYPE = iban 95 IBAN_PAYTO_BIC = SANDBOXX 96 97 .. note:: 98 Refer to the manpage ``libeufin-man.conf(5)`` 99 for the full array of configuration values. 100 101 Configuring password storage 102 ---------------------------- 103 104 libeufin-bank uses secure password hashing algorithms to store user passwords. For the moment, only ``bcrypt`` is supported. The default configuration is: 105 106 .. code-block:: ini 107 108 [libeufin-bank] 109 PWD_HASH_ALGORITHM = bcrypt 110 PWD_HASH_CONFIG = { "cost": 8 } 111 112 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: 113 114 .. code-block:: console 115 116 $ libeufin-bank bench-pwh -c "$CONFIG_FILE" 117 118 .. _libeufin-mfa: 119 120 Configuring multi-factor authentication 121 --------------------------------------- 122 123 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. 124 125 SMS TAN channel 126 +++++++++++++++ 127 128 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>`_. 129 130 To test your setup run: 131 132 .. code-block:: console 133 134 $ TELESIGN_AUTH_TOKEN=$TELESIGN_TOKEN 135 $ echo "Test 1234" | libeufin-tan-sms.sh $PHONE 136 137 If you received an SMS containing "Test 1234" you can enable this channel in the config: 138 139 .. code-block:: ini 140 141 [libeufin-bank] 142 TAN_SMS = libeufin-tan-sms.sh 143 TAN_SMS_ENV = "TELESIGN_AUTH_TOKEN=$TELESIGN_TOKEN" 144 145 Mail TAN channel 146 ++++++++++++++++ 147 148 The default ``libeufin-tan-email.sh`` script is based on the ``mail`` Linux command. It requires a working local mail transfer agent. 149 150 To test your setup run: 151 152 .. code-block:: console 153 154 $ echo "Test 1234" | libeufin-tan-email.sh $EMAIL 155 156 If you received an email containing "Test 1234" you can enable this channel in the config: 157 158 .. code-block:: ini 159 160 [libeufin-bank] 161 TAN_EMAIL = libeufin-tan-email.sh 162 163 Custom TAN channel scripts 164 ++++++++++++++++++++++++++ 165 166 It is possible to replace these scripts with use custom scripts to send 167 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. 168 169 To change the scripts used for multi-factor authentication, change the following 170 options in the configuration file: 171 172 .. code-block:: ini 173 174 [libeufin-bank] 175 TAN_SMS = custom-tan-sms.sh 176 TAN_SMS_ENV = 177 TAN_EMAIL = custom-tan-email.sh 178 TAN_EMAIL_ENV = 179 180 Launching libeufin-bank 181 ======================= 182 183 Assuming that the configuration file exists at ``$CONFIG_FILE``, the following 184 command initializes (or upgrades) the database schema: 185 186 .. code-block:: console 187 188 $ libeufin-bank-dbinit -c "$CONFIG_FILE" 189 190 Once this is done, you can start the libeufin-bank HTTP server: 191 192 .. code-block:: console 193 194 $ libeufin-bank serve -c "$CONFIG_FILE" 195 196 197 Using the bank Web interface 198 ============================ 199 200 To be able to use the Web interface, you must set a password for the "admin" 201 account. You can set (or reset) the account password to ``$PASSWORD`` using 202 the following command: 203 204 .. code-block:: console 205 206 $ libeufin-bank passwd -c "$CONFIG_FILE" admin "$PASSWORD" 207 208 You can also use the same command to reset the passwords of other accounts by 209 replacing "admin" with the respective login. 210 211 212 Setting up accounts 213 ------------------- 214 215 Using the above "$PASSWORD", log into the Web interface as "admin". To setup 216 regular accounts, search for the button "Create account" near the list of all 217 existing bank accounts in the Web interface of libeufin-bank. 218 219 You will be asked to specify: 220 221 Username 222 A unique account name the user will use to access the bank account. 223 224 Name 225 Legal name of the user or business owning the account. 226 227 Email 228 E-mail address of the account owner. Can be used to send a TAN message for 2-factor authentication (if enabled). 229 230 Phone 231 Mobile phone number of the account owner. Can be used to send a TAN message for 2-factor authentication (if enabled). 232 233 Max debt 234 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. 235 236 Is this a Taler Exchange? 237 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. 238 239 XXX Cashout channel 240 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. 241 242 Is this account public? 243 Public accounts can be viewed without access control, their balance and transaction history becomes public. 244 245 After submitting the form, a randomly created password for the new account 246 will be shown in a notification. The administrator can also change passwords 247 for any account in the system using the "change password" link in the account 248 list. To change other details about an account, select the "Username" in the 249 account list. 250 251 252 Account introspection 253 --------------------- 254 255 Users can see (and possibly change) the settings of their bank account and 256 also their IBAN by clicking on the "Welcome, $USERNAME" text after logging 257 into their bank account using their username and password. 258 259 The IBAN field has a convenient "copy to clipboard" button next to it. 260 261 262 Making transfers between accounts 263 --------------------------------- 264 265 First, you need to know the IBAN of the account to credit, and log in as the 266 user of the account to be debited. Then select "Using a form", enter the IBAN 267 under "Recipient" and specify a wire transfer subject and the total amount to 268 be wired. After pressing "Send", you may have to pass a 2-FA check. 269 270 271 Integration with the Taler Exchange 272 =================================== 273 274 .. note:: 275 276 This step is fully automated if you use the :doc:`automated setup manual<../regional/regional-automated-manual>`. 277 278 You must have an exchange account with username ``exchange`` for conversion to work. 279 Assuming that the configuration file exists at ``$CONFIG_FILE``, the following 280 command would create one: 281 282 .. code-block:: console 283 284 $ libeufin-bank create-account '{"username":"exchange","password":"$EXCHANGE_PASSWORD","name":"Cashout Exchange","is_taler_exchange":true}' -c "$CONFIG_FILE" 285 286 .. note:: 287 288 You can also set up the exchange account as "admin" using the Web interface of libeufin-bank. 289 290 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 291 :ref:`exchange bank account configuration <exchange-account-signing>`. When using the libeufin-bank in the context 292 of a regional currency with conversion, you must 293 additionally specify a "conversion-url" when setting 294 up the exchange account. See the section on :ref:`conversion setup <regional-conversion-setup>` in the regional currency setup chapter for details. 295 296 297 Withdrawing e-cash to a Taler wallet 298 ==================================== 299 300 .. note:: 301 302 This step is fully automated if you use the :doc:`automated setup manual<../regional/regional-automated-manual>`. 303 304 Users can withdraw digital cash from their bank account starting from their 305 online banking as implemented by the libeufin-bank. However, in this scenario, 306 the Taler wallet may not already know about an exchange that works with the 307 respective currency. Thus, the protocol includes the possibility of the bank 308 *recommending* an exchange service to the wallet, thus providing a sane 309 default for the wallet to suggest to the user. To do so, the base URL of the 310 exchange API must be specified in the libeufin-bank configuration: 311 312 .. code-block:: ini 313 314 [libeufin-bank] 315 DEFAULT_EXCHANGE=${PROTO}://exchange.${DOMAIN_NAME} 316 317 After changing this value, the libeufin-bank service needs to be restarted 318 to make the change effective. 319 320 .. note:: 321 322 The user may change the default exchange from within the wallet, assuming they know of an alternative exchanges for the currency.