nuxsmin / sysPass

Systems Password Manager
https://syspass.org
GNU General Public License v3.0
975 stars 208 forks source link

Advanced XML import #706

Closed joerg closed 7 years ago

joerg commented 7 years ago

Hi,

I am trying to import our KeePass data and now I am facing the issue that the direct XML import from KeePass is not ideal because the Customer/Category gets lost and CSV import is missing tags. Now I wanted to restructure the data in KeePass anyway so I was wondering: Is it possible to create a syspass XML manually? I am mostly missing the encryption part and guess that the tags and such are encrypted in the and XML parts, right? So, is there a way to manually create the syspass XML using any linux tools (preferably not php)?

nuxsmin commented 7 years ago

Hi,

I'm wondering which fields do you need to get imported from Keepass, because I could tweak the Keepass import to get it.

Creating a sysPass XML file is easy, since you only need to replicate the same structure as when exported, but the encryption library used to encrypt the accounts passwords is written in PHP (https://github.com/defuse/php-encryption), so would need to code a PHP based function/tool.

Regards.

joerg commented 7 years ago

Well, since I want to restructure anyway CSV import would be the best option for me but there importing tags is missing. And I just saw that tags are stored in a separate table in the database and not exported with the XML export. So maybe I should open up a new issue for Import and Export of Tags?

nuxsmin commented 7 years ago

Tags aren't imported from a CSV file (it could be a useful feature for next release), but they are included in the XML file instead.

Regards

joerg commented 7 years ago

Are you sure tags are in the XML? I have this one here:

...
  <Tags>
    <Tag id="3">
      <name>Tag 1</name>
    </Tag>
    <Tag id="1">
      <name>Tag 2</name>
    </Tag>
    <Tag id="2">
      <name>Tag 3</name>
    </Tag>
  </Tags>
  <Accounts>
    <Account id="1">
      <name>Test</name>
      <customerId>1</customerId>
      <categoryId>1</categoryId>
      <login>bla</login>
      <url>bla</url>
      <notes/>
      <pass>omitted</pass>
      <key>omitted</key>
    </Account>
  </Accounts>
...

So unless the tags are part of the pass or key they are not in the XML.

nuxsmin commented 7 years ago

You're right, tags are only included but not linked to the accounts. I'll fix it shortly :)

vmario89 commented 6 years ago

i ran into the same problem. i imported some dozens of accounts now and i tagged them with love. i spent much time. now the tags are not assigned to the accounts :-(

nuxsmin commented 6 years ago

@vmario89 did you mean that you created an XML file including tags?

vmario89 commented 6 years ago

@nuxsmin no i directly used the export-XML from KeePass 2. I've overseen that the upper mentioned XML was sysPass format. Actually parsing KeePass tags would be nice too. They are hidden in the entries too.

grafik grafik

joerg commented 6 years ago

@vmario89 I ended up adding the Tags manually to the MySQL Database. There is a table which has account entry ids and tag ids in its columns. From there on it was rather simple to create a long long list of primitive SQL insert statements from my exported CSV that I had from keepass. For sure not nice and clean, but its a one time thing so who cares. ;-)

vmario89 commented 6 years ago

dear @joerg, i got the same plan with some dirty SQL stuff. Should be easy. But would be more cool to avoid it :D

nuxsmin commented 6 years ago

@vmario89 totally agree, DBs aren't for humans, so let the machine do it ;)

I didn't notice about keepass tags, so this feature could be implemented.

Thanks for the feedback!

vmario89 commented 6 years ago

KeePass is more powerful than i thought. I just found it out today :D KeePass can do much more. KeePass supports stuff like