nilsteampassnet / TeamPass

Collaborative Passwords Manager
https://www.teampass.net
1.68k stars 550 forks source link

import keepass xml #3018

Open ghost opened 2 years ago

ghost commented 2 years ago

Page on which it happened

index.php?page=import

Steps to reproduce

1.Select keepass

  1. Browse - Select Keepass 2 XML file
  2. Perform

Expected behaviour

Import keepass xml data

Actual behaviour

error message: Can't read the files!

Server configuration

Operating system: Linux TeamPass 5.4.78-2-pve #1 SMP PVE 5.4.78-2 (Thu, 03 Dec 2020 14:26:17 +0100) x86_64

Web server: Apache/2.4.38 (Debian)

Database: 5.5.5-10.3.31-MariaDB-0+deb10u1

PHP version: 7.4.27

Teampass version: 3.0.0.10

Teampass configuration file:

'max_latest_items' => '10',
'enable_favourites' => '1',
'show_last_items' => '1',
'enable_pf_feature' => '0',
'log_connections' => '1',
'log_accessed' => '1',
'time_format' => 'H:i:s',
'date_format' => 'd/m/Y',
'duplicate_folder' => '1',
'item_duplicate_in_same_folder' => '1',
'duplicate_item' => '1',
'number_of_used_pw' => '3',
'manager_edit' => '1',
'cpassman_dir' => '/var/www/html/teampass.slemoal.fr',
'cpassman_url' => 'https://<anonym_url>/
'favicon' => 'https://<anonym_url>/favicon.ico',
'path_to_upload_folder' => '/var/www/html/teampass.slemoal.fr/upload',
'path_to_files_folder' => '/var/www/html/teampass.slemoal.fr/files',
'url_to_files_folder' => 'http://10.10.10.228/teampass.slemoal.fr/files',
'activate_expiration' => '0',
'pw_life_duration' => '0',
'maintenance_mode' => '0',
'enable_sts' => '0',
'encryptClientServer' => '1',
'cpassman_version' => '3.0.0.10',
'ldap_mode' => '0',
'ldap_type' => '0',
'ldap_suffix' => '0',
'ldap_domain_dn' => '0',
'ldap_domain_controler' => '0',
'ldap_user_attribute' => '0',
'ldap_ssl' => '0',
'ldap_tls' => '0',
'ldap_elusers' => '0',
'ldap_search_base' => '0',
'ldap_port' => '389',
'richtext' => '0',
'allow_print' => '1',
'roles_allowed_to_print' => '0',
'show_description' => '1',
'anyone_can_modify' => '0',
'anyone_can_modify_bydefault' => '0',
'nb_bad_authentication' => '0',
'utf8_enabled' => '1',
'restricted_to' => '0',
'restricted_to_roles' => '0',
'enable_send_email_on_user_login' => '0',
'enable_user_can_create_folders' => '0',
'insert_manual_entry_item_history' => '0',
'enable_kb' => '0',
'enable_email_notification_on_item_shown' => '0',
'enable_email_notification_on_user_pw_change' => '1',
'custom_logo' => '',
'custom_login_text' => 'SLM',
'default_language' => 'english',
'send_stats' => '0',
'send_statistics_items' => 'stat_country;stat_users;stat_items;stat_items_shared;stat_folders;stat_folders_shared;stat_admins;stat_managers;stat_ro;stat_mysqlversion;stat_phpversion;stat_teampassversion;stat_languages;stat_kb;stat_suggestion;stat_customfields;stat_api;stat_2fa;stat_agses;stat_duo;stat_ldap;stat_syslog;stat_stricthttps;stat_fav;stat_pf;',
'send_stats_time' => '1640558863',
'get_tp_info' => '1',
'send_mail_on_user_login' => '0',
'nb_items_by_query' => 'auto',
'enable_delete_after_consultation' => '0',
'enable_personal_saltkey_cookie' => '0',
'personal_saltkey_cookie_duration' => '31',
'email_smtp_server' => '<removed>'
'email_smtp_auth' => '1',
'email_auth_username' => '<removed>'
'email_auth_pwd' => '<removed>'
'email_port' => '465',
'email_security' => 'ssl',
'email_server_url' => '',
'email_from' => '<removed>'
'email_from' => '<removed>'
'pwd_maximum_length' => '40',
'google_authentication' => '0',
'delay_item_edition' => '0',
'allow_import' => '1',
'proxy_ip' => '',
'proxy_port' => '',
'upload_maxfilesize' => '2000mb',
'upload_docext' => 'doc,docx,dotx,xls,xlsx,xltx,rtf,csv,txt,pdf,ppt,pptx,pot,dotx,xltx',
'upload_imagesext' => 'jpg,jpeg,gif,png',
'upload_pkgext' => '7z,rar,tar,zip',
'upload_otherext' => 'sql,xml',
'upload_imageresize_options' => '1',
'upload_imageresize_width' => '800',
'upload_imageresize_height' => '600',
'upload_imageresize_quality' => '90',
'use_md5_password_as_salt' => '0',
'ga_website_name' => 'TeamPass for ChangeMe',
'api' => '0',
'subfolder_rights_as_parent' => '1',
'show_only_accessible_folders' => '0',
'enable_suggestion' => '1',
'otv_expiration_period' => '7',
'default_session_expiration_time' => '60',
'duo' => '0',
'enable_server_password_change' => '1',
'ldap_object_class' => '0',
'bck_script_path' => '/var/www/html/teampass.slemoal.fr/backups',
'bck_script_filename' => 'bck_teampass',
'syslog_enable' => '0',
'syslog_host' => 'localhost',
'syslog_port' => '514',
'manager_move_item' => '1',
'create_item_without_password' => '1',
'otv_is_enabled' => '0',
'agses_authentication_enabled' => '0',
'item_extra_fields' => '0',
'saltkey_ante_2127' => 'none',
'migration_to_2127' => 'done',
'files_with_defuse' => 'done',
'timezone' => 'Europe/Paris',
'enable_attachment_encryption' => '1',
'personal_saltkey_security_level' => '50',
'ldap_new_user_is_administrated_by' => '0',
'disable_show_forgot_pwd_link' => '0',
'offline_key_level' => '0',
'enable_http_request_login' => '0',
'ldap_and_local_authentication' => '0',
'secure_display_image' => '1',
'upload_zero_byte_file' => '1',
'upload_all_extensions_file' => '0',
'bck_script_passkey' => '<removed>'
'admin_2fa_required' => '1',
'password_overview_delay' => '0',
'copy_to_clipboard_small_icons' => '1',
'duo_akey' => '',
'duo_ikey' => '',
'duo_skey' => '',
'duo_host' => '',
'teampass_version' => '',
'roles_allowed_to_print_select' => '["1"]',
'clipboard_life_duration' => '30',
'mfa_for_roles' => '',
'tree_counters' => '1',
'onthefly-backup-key' => 'Seb7459.',
'settings_offline_mode' => '0',
'settings_tree_counters' => '0',
'enable_massive_move_delete' => '0',

Updated from an older Teampass or fresh install: Fresh install

Client configuration

Browser: Chrome - 97.0.4692.99

Operating system: Windows - 64bits

Logs

Web server error log

 -  ([Sat Jan 29 22:18:47.426152 2022] [php7:notice] [pid 36690] [client 10.10.10.99:58102] PHP Notice:  Trying to access array offset on value of type null in /var/www/html/teampass.slemoal.fr/sources/import.queries.php on line 516, referer: https://10.10.10.228/index.php?page=import
[Sat Jan 29 22:18:47.426279 2022] [php7:notice] [pid 36690] [client 10.10.10.99:58102] PHP Notice:  simplexml_load_file(): read of 8192 bytes failed with errno=21 Is a directory in /var/www/html/teampass.slemoal.fr/sources/import.queries.php on line 521, referer: https://10.10.10.228/index.php?page=import
[Sat Jan 29 22:18:47.566864 2022] [php7:warn] [pid 36690] [client 10.10.10.99:58102] PHP Warning:  simplexml_load_file(): /var/www/html/teampass.slemoal.fr/files/:1: parser error : Document is empty in /var/www/html/teampass.slemoal.fr/sources/import.queries.php on line 521, referer: https://10.10.10.228/index.php?page=import
[Sat Jan 29 22:18:47.566887 2022] [php7:warn] [pid 36690] [client 10.10.10.99:58102] PHP Warning:  simplexml_load_file():  in /var/www/html/teampass.slemoal.fr/sources/import.queries.php on line 521, referer: https://10.10.10.228/index.php?page=import
[Sat Jan 29 22:18:47.566892 2022] [php7:warn] [pid 36690] [client 10.10.10.99:58102] PHP Warning:  simplexml_load_file(): ^ in /var/www/html/teampass.slemoal.fr/sources/import.queries.php on line 521, referer: https://10.10.10.228/index.php?page=import
[Sat Jan 29 22:18:47.566942 2022] [php7:warn] [pid 36690] [client 10.10.10.99:58102] PHP Warning:  Invalid argument supplied for foreach() in /var/www/html/teampass.slemoal.fr/sources/import.queries.php on line 541, referer: https://10.10.10.228/index.php?page=import
)

Teampass 10 last system errors

Log from the web-browser developer console (CTRL + SHIFT + i)

POST /sources/import.queries.php HTTP/1.1 Host: 10.10.10.228 Connection: keep-alive Content-Length: 176 sec-ch-ua: " Not;A Brand";v="99", "Google Chrome";v="97", "Chromium";v="97" Accept: / Content-Type: application/x-www-form-urlencoded; charset=UTF-8 X-Requested-With: XMLHttpRequest sec-ch-ua-mobile: ?0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36 sec-ch-ua-platform: "Windows" Origin: https://10.10.10.228 Sec-Fetch-Site: same-origin Sec-Fetch-Mode: cors Sec-Fetch-Dest: empty Referer: https://10.10.10.228/index.php?page=import Accept-Encoding: gzip, deflate, br Accept-Language: fr Cookie: KEY_teampass_session=xMfHFnyT82FJJ5UTWFfSYnDNDfHDenzDa9gTH8T8EJ0tt3LGYDpurFnjGFiyJ661C7H93tT3jShNOJNcTo8b5w%3D%3D; teampass_session=hfrnll2bp7mdgbenbb7p0ggror; 34739abba55363c52f801bb460c4a38b68d2fe08decf54c07d=9876cfaac9f4e7324c076ae9651fec238055d2c6c45f7e040b

Insert the log here and especially the answer of the query that failed. R731YTc3NzdDBd45pdrQAzv6NczBYy9u04uD16fawyM+U6nTqqEsh7Z10WhwCSWK

ghost commented 2 years ago

Can you help me? I tried to create a new keepass file with only 2 lines, I even tried importing a CSV file.

Obviously nothing works in import.

I gave all the rights to the /var/www/ folder to the user www-data, it's a test server, I can give you control of the server if you wish:

chown -R www-data:www-data /var/www
find /var/www -type d -print0 | xargs -0 chmod -t,a-rwxs,u+rwx
find /var/www -type f -print0 | xargs -0 chmod -t,a-rwxs,u+rw

My installation method is detailed under this link: https://wiki.slemoal.fr/index.php/Teampass