Openfire. Migrating from HSQLDB to MySQL.

The other day, I had to migtate Openfire from HSQLDB to MySQL using MySQL Migration tool and below just a couple tips that could save a bit of your time if you up to the same task:

  1. I used Windowds XP.
  2. MySQL Migration tool has been EOLed but it is still available from mysql.com.
  3. Java 1.5 is required to run MySQL Migration tool.
  4. Set -Xmx to 512m or bigger, as shown below, if your openfire.script is big. Mine was 135MB and that was essential.
  5. cd "c:\Program Files\MySQL\MySQL Tools for 5.0\
    .\MySQLMigrationTool.exe -Xmx 512m
  6. Not doing so you will get the following error:
  7. Connecting to source database and retrieve schemata names.
    Initializing JDBC driver …
    Driver class Generic Jdbc
    Opening connection …
    Connection jdbc:hsqldb:c:\temp\embedded-db\openfire
    The list of schema names could not be retrieved (error: 0).
    ReverseEngineeringGeneric.getSchemata :Out of Memory
    Details:

  8. Using MySQL Migration tool is trivial but you should provide a proper connection string. If you don’t none of your tables will be migrated and what you’ll see in the end is a report similar to this one:
  9. 1. Schema Migration
    ——————-

    Number of migrated schemata: 1

    Schema Name: PUBLIC
    – Tables: 0
    – Views: 0
    – Routines: 0
    – Routine Groups: 0
    – Synonyms: 0
    – Structured Types: 0
    – Sequences: 0

  10. I stopped Openfire copied the content (there are actually just two files inside – openfire.log and openfire.script) of /opt/openfire/embedded-db to c:\temp\embedded-db on my Windows PC
  11. Copied hsqldb.jar from the server to lib/ directory of MySQL Migration tool where it keeps various jars.
  12. used the following connection string and the class name respectively (also shown on the screenshot):
  13. jdbc:hsqldb:file:c:\temp\embedded-db\openfire
    org.hsqldb.jdbc.Driver

MySQLMigrationTool

The rest is just a series of clicks on the “Next” button.
Please note that if you choose to migrate the data directly into your MySQL DB all the tables will be created with their names in UPPER case. If it’s not what you prefer instead of checking “Create Objects Online” and “Trabfer Data Online” simply select “Create Script File for Create Statements” and “Create Script File for Insert Statements” and the tool will create to files Creates.sql and Inserts.sql which you could later update to meet your preferences.
To solve that issue I came up with a dumb and bold script that fixes that which I put on my GitHub repository

Posted on August 14, 2013 at 10:24 am by sergeyt · Permalink · Leave a comment
In: Linux

VM cold migration. Invalid configuration for device.

Last weekend I was doing a cold migration of one of our VMs and when the migration was one step before it would be done the following error popped up:

Invalid configuration for device 15.

Must admit, that wasn’t one of the helpful messages I expected to see. Anyway, quick googling led me to the following article at kb.vmware.com with more information and a workaround that finally helped me to finish the task.

Hope that would save someone’s time in the future.

Posted on August 12, 2013 at 9:33 am by sergeyt · Permalink · One Comment
In: ESXi

How to setup Solaris 10 ldap client and glue it with ssh

Recently I wrote a post about configuring OpenLDAP server with TLS support using RHEL available here. There I also mentioned how to setup Linux to authenticate against a LDAP server. But I didn’t said a word about Solaris. That’s unfair and I’m going to fix that by providing a quick guide on how to setup LDAP client in Solaris 10.

  1. First of all add LDAP server’s certificate into your locale certificate database. Otherwise, you won’t be able to setup a TLS session:
  2. /usr/sfw/bin/certutil -N -d /var/ldap/
    /usr/sfw/bin/certutil -A -n "LDAP server certificate" -i /path_to_where_you_copied_ldap_certificate_file -a -t CT -d /var/ldap
    
  3. Just verify that everything was done right:
  4. /usr/sfw/bin/certutil -L -d /var/ldap/
    
  5. Setup Solaris ldap client:
  6. ldapclient manual \
    -a credentialLevel=proxy \
    -a authenticationMethod=tls:simple \
    -a domainName=example.com \
    -a defaultSearchBase=DC=example,DC=com \
    -a proxyDN="cn=svc_ldp_proxy,dc=example,dc=com" \
    -a proxyPAssword=PASSWORD \
    -a serviceSearchDescriptor="passwd:ou=people,?sub" \
    -a serviceSearchDescriptor="group:ou=group,?sub?gidnumber" \
    -a serviceSearchDescriptor="netgroup:ou=netgroup,?sub" \
    -a serviceSearchDescriptor="shadow:ou=people,?sub?uid=*" \
    -a followReferrals=false LDAP_SERVER_IP:LDAP_SERVER_PORT

    Please note that your serviceSearchDescriptor attribute might be different and that depends on your LDAP structure. This attribute just instruct ldap client how it should build its query to search, in my particular case, for passwd, group and net group records.

  7. All the rest is just almost like in the Linux world:
  8. nssswitch.conf

    passwd:     compat
    passwd_compat: ldap
    group:      files ldap
    hosts:      files dns
    ipnodes:    files dns
    networks:   files
    protocols:  files
    rpc:        files
    ethers:     files
    netmasks:   files
    bootparams: files
    publickey:  files
    netgroup:   ldap
    automount:  files
    aliases:    files
    services:   files
    printers:   user files
    auth_attr:  files
    prof_attr:  files
    project:    files
    tnrhtp:     files
    tnrhdb:     files
    

    cat /etc/pam.conf | grep sshd-kbdint

    sshd-kbdint     auth requisite          pam_authtok_get.so.1 debug
    sshd-kbdint     auth required           pam_unix_cred.so.1 debug
    sshd-kbdint     auth binding            pam_unix_auth.so.1 server_policy debug
    sshd-kbdint     auth required           pam_ldap.so.1 debug
    
  9. Just take another look at your configuration:
  10. ldapclient list
    
  11. Use some very basic tools,i.e. id or getent, to make sure your could query and receive correct response from LDAP server.
  12. Finally, try to ssh into your server with a LDAP aware account.

If anything goes wrong your could do the following: