Prepared for automatic setup

This commit is contained in:
Martin Berger 2023-03-17 18:46:39 +01:00
parent 9c1b0045e5
commit 7266c147f8
5 changed files with 39 additions and 24 deletions

View file

@ -8,17 +8,25 @@ Fueli FinTS is a server implementing the financial transaction services (FinTS)
3. FIXMEs to deactivate PIN/mTAN/strong authentication where necessary for testing purposes. **CAUTION: Do not use this fork in production without fixing these issues!!!**
4. Added example configuration files and db script to set up a rudimentary database.
5. Some minor refactoring and cleanups
6. Adapted for Bitcoin Lightning Network integration with [LNbits](https://github.com/lnbits/lnbits#lnbits)
**Please find a complete list of all changes to the original implementation by this fork with this [Github Compare](https://github.com/petafuel/FueliFinTS/compare/main...drmartinberger:lnbits-via-mt940) view.**
# Setup Steps
1. Configure `fuelifints.properties`
2. Initialize keystore (to be set in `fuelifints.properties`)
3. Setup `FinTS_Produktregistrierungen_Lizenzdatei.csv` (to be set in `fuelifints.properties`, contains product client ids that are allowed to communicate with server) or set a `productinfo.csv.check=false`
4. Define aeskey.properties with a valid 128-bit key (to be set in `fuelifints.properties`)
5. Setup file <blz>.banking2.properties (to set config params for persistence layer, blz is configured in `fuelifints.properties` and your database)
6. Init database:
1. Configure `config/fuelifints.properties`
2. Initialize keystore (to be set in `config/fuelifints.properties`)
3. Setup `FinTS_Produktregistrierungen_Lizenzdatei.csv` (to be set in `config/fuelifints.properties`, contains product client ids that are allowed to communicate with server) or set a `productinfo.csv.check=false`
4. Setup `aeskey.properties` with a valid 128-bit key (file to be set in `config/fuelifints.properties`)
5. Setup file `config/12345678.banking2.properties` (to set config params for persistence layer, `bankcode = 12345678` is configured in `config/fuelifints.properties` and your database)
6. Derive encrypted PIN (for FinTS access) for your intended `<your-pin>, e.g. 123456789` and inject it into `dbsetup.sql`:
```bash
$ encryptedPIN=`mvn compile exec:java -Dexec.mainClass="net.petafuel.fuelifints.cryptography.aesencryption.AESUtil" -Dexec.args="<your-pin>" -q`
$ sed -i -e "s/REPLACE_ENCRYPTED_PIN/$encryptedPIN/g" dbsetup.sql
```
7. Init database:
1. Install mysql
2. Initialize database from mysql command line:
1. Add database user e.g. `fintsuser` with `<password>` (both must be used in `connectionpool.properties` adapted from `connectionpool.properties.example`):

View file

@ -5,11 +5,11 @@ server_ip = 127.0.0.1
# SSL Keystore:
keystore_location = src/main/resources/keystore/your_keystore
keysotre_password = yourkeystorepassword
keystore_password = yourkeystorepassword
# Default Bank Settings:
bankcode = 12345678
bankname = FueliFinTS Testbank
bankname = LNBank
# RDH Keystore:
rdh_keystore_location = rdh.ks
@ -53,5 +53,5 @@ hbci.security.protocols=PIN_2;RDH_9;RDH_10;RAH_9;RAH_10
dialog.timeout.millis=60000
productinfo.csv.filepath=FinTS_Produktregistrierungen_Lizenzdatei.csv
productinfo.csv.check=true
productinfo.csv.check=false
productinfo.csv.startRow=10

View file

@ -1,34 +1,36 @@
-- Rough reverse-engineered database structure for FueliFinTS
-- 1. Set your intended benutzerkennung for <benutzerkennung>
-- 2. Set your intended encrypted PIN for <encryptedPIN>
-- 3. Set your intended kundenid for <kundenid>
-- 4. Set <blz> and <bankname> as in config/fuelifints.properties
-- 5. Set your intended <kontoid>, <kontonummer> and <kontoinhaber>
-- 1. To set your intended benutzerkennung(=FinTS user), change value 'fintsUser'
-- 2. To set your intended encrypted PIN(=encrypted FinTS PIN), change value '$encryptedPIN' with outcome of
-- mvn compile exec:java -Dexec.mainClass="net.petafuel.fuelifints.cryptography.aesencryption.AESUtil" -Dexec.args="<your-intended-pin>" -q
-- (!!!ATTENTION!!!: before encrypting PIN, aes_key (128) needs to be set in aeskey.properties in hex format, e.g. aes_key=770A8A65DA156D24EE2A093277530142)
-- 3. To set your intended kundenid, change value 'kundenid1'
-- 4. To set your intended BLZ and Bankname, change values '12345678' and 'LNBank' (as in config/fuelifints.properties)
-- 5. To set your intended kontoid, kontonummer and kontoinhaber, change values 'kontoid1', '666666' and 'kontoinhaber1'
-- 6. Set other values where feasible
CREATE TABLE benutzerkennungen (pin varchar(255), lastnn varchar(255), benutzerkennung varchar(255));
INSERT INTO benutzerkennungen (pin, lastnn, benutzerkennung) VALUES ('<encryptedPIN>', 'lastnn', '<benutzerkennung>');
INSERT INTO benutzerkennungen (pin, lastnn, benutzerkennung) VALUES ('REPLACE_ENCRYPTED_PIN', 'lastnn', 'fintsUser');
CREATE TABLE kunden_benutzerkennungen (kundenid varchar(255), benutzerkennung varchar(255));
INSERT INTO kunden_benutzerkennungen (kundenid, benutzerkennung) VALUES ('<kundenid>', '<benutzerkennung>');
INSERT INTO kunden_benutzerkennungen (kundenid, benutzerkennung) VALUES ('kundenid1', 'fintsUser');
CREATE TABLE bpd (version varchar(255), blz varchar(255), bankname varchar(255), anzgesch varchar(255), lang varchar(255), hbciversion varchar(255), maxsize varchar(255));
INSERT INTO bpd (version, blz, bankname, anzgesch, lang, hbciversion, maxsize) VALUES ('1', '<blz>', '<bankname>', '1', 'GER', '300', '0'); -- blz and bankname should match fuelifints.properties
INSERT INTO bpd (version, blz, bankname, anzgesch, lang, hbciversion, maxsize) VALUES ('1', '12345678', 'LNBank', '1', 'GER', '300', '0'); -- blz and bankname should match fuelifints.properties
CREATE TABLE geschaeftsvorfaelle(bezeichnung varchar(255), segmentversion varchar(255), maxanzahl INT, param1 INT, param5 varchar(255), param3 varchar(255), param4 varchar(255), bpdversion varchar(255), hbciversion varchar(255));
INSERT INTO geschaeftsvorfaelle (bezeichnung, segmentversion, maxanzahl, param1, param5, param3, param4, bpdversion, hbciversion) VALUES ('Geschaeftsvorfall Bezeichnung', 'Segmentversion 1', 1, 1, '1', '1', '1', '1', '300');
CREATE TABLE messages_read(messageid varchar(255), loginid varchar(255), benutzerkennung varchar(255));
CREATE TABLE messages(messageid varchar(255), subject varchar(255), text varchar(255));
CREATE TABLE tempclientstuff3(benutzerkennung varchar(255), kundenid varchar(255), produkt varchar(255), produktversion varchar(255), kundensystemid varchar(255), dialogid varchar(255), tanid varchar(255), kontrollref varchar(255));
CREATE TABLE konten(kontoid VARCHAR(255), kontonummer VARCHAR(255), kontoinhaber VARCHAR(35), kontostand VARCHAR(35), tagesumsatz VARCHAR(35), tageslimit VARCHAR(35), kontoart VARCHAR(2), virtkontostand VARCHAR(35), kreditlinie_aktiv BOOLEAN, kreditlinie VARCHAR(35), ueberziehen BOOLEAN, konto_pre VARCHAR(255), blz_pre VARCHAR(255), iban_pre VARCHAR(255), empfaenger_pre VARCHAR(255));
INSERT INTO konten(kontoid, kontonummer, kontoinhaber, kontostand, tagesumsatz,tageslimit,kontoart,virtkontostand,kreditlinie_aktiv,kreditlinie,ueberziehen,konto_pre,blz_pre,iban_pre,empfaenger_pre) VALUES ('<kontoid>','<kontonummer>', '<kontoinhaber>','66.66','66.66','66.66', '90','66.66',true,'66.66',true,'','','','');
INSERT INTO konten(kontoid, kontonummer, kontoinhaber, kontostand, tagesumsatz,tageslimit,kontoart,virtkontostand,kreditlinie_aktiv,kreditlinie,ueberziehen,konto_pre,blz_pre,iban_pre,empfaenger_pre) VALUES ('kontoid1','666666', 'kontoinhaber1','0.00','0.00','0.00', '90','0.00',true,'0.00',true,'','','','');
CREATE TABLE konten_bewegungen(kontoid VARCHAR(255), kontostand VARCHAR(35), buchungsdatum DATE, bewegungsid BIGINT(20));
-- comment out INSERT INTO konten_bewegungen, if you do not want to have account transactions
INSERT INTO konten_bewegungen(kontoid, kontostand, buchungsdatum, bewegungsid) VALUES ('<kontoid>', '66.66', '2022-11-11', 1);
--INSERT INTO konten_bewegungen(kontoid, kontostand, buchungsdatum, bewegungsid) VALUES ('kontoid1', '66.66', '2022-11-11', 1);
CREATE TABLE kunden_konten(kontoid VARCHAR(255), kundenid VARCHAR(255));
INSERT INTO kunden_konten(kontoid, kundenid) VALUES ('<kontoid>', '<kundenid>');
INSERT INTO kunden_konten(kontoid, kundenid) VALUES ('kontoid1', 'kundenid1');
CREATE TABLE login_konten_permission(kontoid VARCHAR(255), benutzerkennung varchar(255), ueberweisung VARCHAR(1), sdd VARCHAR(1), ade VARCHAR(1), azv VARCHAR(1), lastschrift VARCHAR(1), abbuchung VARCHAR(1), dtaus VARCHAR(1));
INSERT INTO login_konten_permission(kontoid, benutzerkennung, ueberweisung, sdd, ade, azv, lastschrift, abbuchung, dtaus) VALUES ('<kontoid>', '<benutzerkennung>', '1', '1', 'E', '1', '1', '1', '1');
INSERT INTO login_konten_permission(kontoid, benutzerkennung, ueberweisung, sdd, ade, azv, lastschrift, abbuchung, dtaus) VALUES ('kontoid1', 'fintsUser', '1', '1', 'E', '1', '1', '1', '1');
CREATE TABLE logins(loginid VARCHAR(255), handy VARCHAR(255), ref_benutzerkennung VARCHAR(255));
INSERT INTO logins(loginid, handy, ref_benutzerkennung) VALUES (0, '0815666', '<benutzerkennung>');
INSERT INTO logins(loginid, handy, ref_benutzerkennung) VALUES (0, '0815666', 'fintsUser');
CREATE TABLE tanliste_mobil(mtanid INT AUTO_INCREMENT PRIMARY KEY, mtan VARCHAR(255), used VARCHAR(255), loginid VARCHAR(255),benutzerkennung VARCHAR(255), request VARCHAR(255));
INSERT INTO tanliste_mobil(mtanid, mtan, used, loginid, benutzerkennung, request) VALUES (0, '123456', '0', 0, '<benutzerkennung>', 'request');
INSERT INTO tanliste_mobil(mtanid, mtan, used, loginid, benutzerkennung, request) VALUES (0, '123456', '0', 0, 'fintsUser', 'request');
CREATE TABLE login_permission(tageslimit VARCHAR(35), tagesumsatz VARCHAR(35), lastschrift VARCHAR(1), ueberweisung VARCHAR(1), benutzerkennung varchar(255));
CREATE TABLE mt940(mt940id VARCHAR(255), mt940 BLOB, kontoid VARCHAR(255), buchungstag date);
CREATE TABLE vorabumsaetze(kontoid VARCHAR(255), buchungsdatum date, primanota VARCHAR(35), verwendungszweck VARCHAR(140), betrag VARCHAR(35), kontostand VARCHAR(35), wert VARCHAR(35), refimportid VARCHAR(35), gegenkontoname VARCHAR(35), gegenkontonr VARCHAR(35), gegenkontoblz VARCHAR(35), bewegungsid VARCHAR(35));

View file

@ -66,7 +66,7 @@ public class BlockingSSLRequestListenerThread extends Thread {
properties.load(bis);
bis.close();
systemProps.put("javax.net.ssl.keyStore", properties.getProperty("keystore_location"));
systemProps.put("javax.net.ssl.keyStorePassword", properties.getProperty("keysotre_password"));
systemProps.put("javax.net.ssl.keyStorePassword", properties.getProperty("keystore_password"));
useCipherSuites = properties.getProperty("use_cipher_suites").split(";");
useProtocols = properties.getProperty("use_protocols").split(";");
} catch (Exception e) {

View file

@ -14,6 +14,11 @@ import java.util.Properties;
public class AESUtil {
private static final Logger LOG = LogManager.getLogger(AESUtil.class);
public static void main (String[] args) {
System.out.println(aesEncrypt(args[0].getBytes()));
System.exit(0);
}
/**
* Expects a payload to encrypt and returns the encryption result as Base64
* @param toEncrypt