I managed to get the genpass.sh script working without error and got the hash for xpassword. I could not get it to work with exchange. I'm posting my solution for gettng genpass.sh running in hopes someone can tell me what I'm missing for using the hash (i tried firewall settings, port 993 instead of 143, securelogin in exchange, etc, no such luck).
Ok, so back to getting genpass.sh working...
Step 1. (Get and Set Env variables)
You need to set some Splunk environment variables (at least for this script, doesn't have to be permanent)
Run a command prompt as admin and get to c:\Program Files\Splunk\bin
The command below will create a bat file that you will run to populate those environment variables
In your Splunk bin directory, run this:
splunk envvars > setSplunkEnv.bat
Run the setSplunkEnv.bat to put splunk env variables into your dos session. If you go SET, you will see them listed (or just edit the .bat)
Step 2. (Edit genpass.sh)
I recommend getting notepad++ for this part. The genpass.sh has carriage returns that notepad and wordpad don't understand and will make a mess of.
Open the genpass.sh in Notepad++ from this path: C:\Program Files\Splunk\etc\apps\IMAPmailbox\bin\genpass.sh
You need to modify this line:
echo -n $pass | openssl bf -e -a -pass file:$SPLUNK_HOME/etc/auth/splunk.secret
To become this:
echo -n $pass | openssl bf -e -a -pass file:"$SPLUNK_HOME/etc/auth/splunk.secret"
The SPLUNK_HOME is an env variable set in Step 1 but as the path to Splunk contains a space (C:\Program files), the script is thrown for a loop and it won't work.
Step 3. (Download Cygwin)
I downloaded Cygwin (64-bit in my case) on the splunk server and ran in the install with normal options. Available here: https://cygwin.com/install.html
My installed ended up here: C:\cygwin64 The important directory later on is C:\cygwin64\bin
In my dos session, I had to modify my Path variable to contain C:\Cygwin64\bin
I used this command Set Path=%path%;C:\Cygwin64\bin
Step 4 (Run genpass.sh)
At this point, you should be good to run genpass.sh
I CD'd into C:\Program Files\Splunk\etc\apps\IMAPmailbox\bin
With cygwin64 now in my Path, I am able to call commands from it.
So in bin folder from above, I run genpass.sh with this
sh genpass.sh
The script ran great with no errors. Even the stty commands in the script ran as cygwin had it.
I only got normal output and didn't get any unexpected "junk"
Everytime I re-run it though I get a different hash. I don't know why that is and if it matters.
I have not been able to get the xpassword option working in the imap.conf file.
I'd love to hear feedback from anyone who manages to get it working.
... View more