Apple Open Directory Migration Utility

The information here will allow you to send emails to all of your Open Directory users and reset their passwords

Go here to download the utility:

https://github.com/bciv/OpenDirectoryMigrationUtility

Overview

If you are attempting to migrate Open Directory from one server to another and don’t want to keep the same name of your server this might be of use to you.

The caveat is that this technique requires users to experience a password reset.

The good news is that this utility also automatically sends out email notifications so users know that they have had their password changed.

It uses Perl to iterate through your Open Directory on your Apple Open Directory Server.

Pre-requisites

Mavericks comes by default with Net::LDAP and use Net::LDAP::Extension::SetPassword but does not come with use Net::SMTP::SSL

Net::SMTP::SSL is a Perl Module used to send emails using SSL. The script is set to use Google as the SMTP server so you will need to adjust it to work with your mail servers if you aren’t using Google.

To install Net::SMTP::SSL under OS X 10.9.5 Mavericks, follow these steps:

Open the Terminal app and type these commands followed by the key:

$ sudo perl -MCPAN -e “shell”

When prompted whether you want automatic configuration, answer ‘yes’.

If prompted how you want to install the system may ask about a lib or sudo… type ‘sudo’ and hit .

At the CPAN> prompt type the following and then hit :

install Net::SMTP::SSL

When it finishes, type exit and hit .

Configuring

Before you run the scripts it is a good idea to configure them to work with your environment.

copy the sample.oditerator.config file, set the variables to work for your environment,

and then rename it to: oditerator.config

These are the variables that need to be configured:

$base=”dc=MyComputerName,dc=local”; $diradmin_username=’diradmin’; $diradmin_password=’supersecretpassword12345!!!!’; $from_email=’development@example.com‘; $from_email_password=’supersecretemailpassword2015!!!!’;
$smtp_server=’smtp.gmail.com’; $smtp_port=’465′; $system=”Development Server”; $url=”http://localhost”; $helpdeskurl=”http://help.MyComputer.local“; $helpdeskemail=”test1\@example.com”; $helpdeskcontact=”Test Help Contact”; $extra=’2015!’;

Running

Once your scripts are configured, run:

perl oditerator.pl

Apple Wiki has broken history after migration on some pages

After a wiki migration under Mavericks, I had some wiki pages that were blank.

The history appeared to be intact but, setting the page to any version resulted in displaying the same blank screen.

To fix this problem:

Click the pencil to edit the page

Copy all of the text from the page with command + a, then command + c

Open an editor such as Text Wrangler, or Komodo Edit

Paste the wiki text using command + v

Copy all of the text back out fromthe editor with command + a, then command + c

Create a new wiki page

Past all of the text into the new wiki page using command + v

Click the save button

Note: When you paste into Text Wrangler, Komodo Edit (or any editor that does not deal with fonts and other embedded textual features) whatever encoding that caused the history issue is gone and you can use the page with history as you had previously been able to do.

Apple Wiki won’t work after Server.app 10.9.5 upgrade

At some point my Apple wiki wanted to upgrade which included an upgrade of Postgres from 9.2 to 9.3.  I think a premature reboot cause the upgrade process to break it.

This is what fixed it:

First open Terminal App and sudo su <return> to become root…

cd /Library/Server/Wiki/Database.xpg

You may see several folders here.  Mine contained the following folders:

Cluster.pg
Cluster.pg_new_for_upgrade
Cluster.pg.original_for_upgrade
backup

If you don’t see these, this procedure probably won’t work for you.  I advise you to backup this folder either way just be be on the safe side.

Cluster.pg is where the postgres configuration file under the /Library/Server/Wiki/Config folder points to for the collab database.

First make sure wiki and collabd are not running

serveradmin stop wiki

serveradmin stop collabd

Remove the collab database your wiki is pointing to

rm -R Cluster.pg Cluster.pg
mv Cluster.pg.original_for_upgrade Cluster.pg
mv Cluster.pg.new_for_upgrade Cluster.pg.new_for_upgrade_
chmod -R 700 Database.xpg
chmod -R 750 FileData
chown -R _teamsserver:_teamsserver *
serveradmin start wiki
serveradmin start collabd
Wait a while.
Point your browser to your wiki.

How to back up and restore MySQL database

To backup a mysql database to a file use the following syntax:
mysqldump -u[username] -p[password] nameofdatabase > nameofdatabase.sql
To restore from the backup use the following method:
mysql -u root -p
password: <type password> <enter>
> create database <nameofdatabase>; <enter>
> grant all on nameofdatabase.* to nameofuser@localhost identified by ‘nameofuserpassword’;
> flush privileges;
> exit;
mysql -u root -p nameofdatabase < nameofdatabase.sql
password: <type password> <enter>