Wiki Markup |
h2. JEMH Installation
# - Add
- the
- JEMH
- JAR
Get - the
- JAR
- specific
- for
- your
- version
- of
- Jira
- from
- the
- top
- of
- the
- page
- and
- copy
- to
- the
- Jira
_- WEB-INF/lib
_ - folder
# - Add
- the
- ldaputils
- jar
- (if
- you
- use
- ldap)
Get - the
- latest
- ldaputils
- jar
- (currently
- 1.0.13)
- from
- the
[LDAP - LDAP Util
- library
|CLDAP:LDAP Util library] - page,
- take
- the
_- example-ldaputil.properties
_ - file
- from
- the
- JAR
- and
- rename
- it
_- ldaputil.properties
_- ,
- editing
- it
- as
- appropriate
# - Setup
- Logging
- (optional)
Modify - /
- copy-and-modify
- the
_- WEB-INF/classes/log4j.properties
_ - ,
- this
- will
- enable
- logging
- of
- all
- EMH
- messages
- to
- a
- separate
- file.
- Default
- is
- DEBUG,
- other
- values
- are
- 'INFO',
- 'WARN'
- and
- 'ERROR'.
{ } |
---|
#
# Create a separate appender
#
log4j.appender.EMHFileLog=org.apache.log4j.RollingFileAppender
log4j.appender.EMHFileLog.File=atlassian-jira-emh.log
log4j.appender.EMHFileLog.MaxFileSize=20480KB
log4j.appender.EMHFileLog.MaxBackupIndex=5
log4j.appender.EMHFileLog.layout=org.apache.log4j.PatternLayout
log4j.appender.EMHFileLog.layout.ConversionPattern=%d %t %p [%c{4}] %m%n
log4j.appender.EMHFileLog.Threshold=DEBUG
#
# add entries for the three EMH packages
#
log4j.logger.com.dolby.atlassian.jira.service.util.handler=DEBUG, EMHFileLog
log4j.additivity.com.dolby.atlassian.jira.service.util.handler=false
log4j.logger.com.dolby.atlassian.jira.service.util.handler.emh=DEBUG, EMHFileLog
log4j.additivity.com.dolby.atlassian.jira.service.util.handler.emh=false
log4j.logger.com.dolby.atlassian.jira.service.util.handler.emh.processor=DEBUG, EMHFileLog
log4j.additivity.com.dolby.atlassian.jira.service.util.handler.emh.processor=false
log4j.logger.com.dolby.atlassian.jira.service.util.handler.emh.service=DEBUG, EMHFileLog
log4j.additivity.com.dolby.atlassian.jira.service.util.handler.emh.service=false
|
{noformat}
(i) Enabling detailed logging of lower level mail operations in Jira is covered in [Logging email protocol details|http://confluence.atlassian.com/display/JIRA/Logging+email+protocol+details].
{tip:title=What no log file?}
Whether working on Windows or Linux, a lack of recently updated _
Enabling detailed logging of lower level mail operations in Jira is covered in Logging email protocol details. Tip |
---|
| Whether working on Windows or Linux, a lack of recently updated atlassian-jira.log _ and _atlassian-jira-emh.log _ usually means *file permissions * are at fault....
{tip}
# Make Jira aware of the new handler
{info:title=POP / Imap?}
This example shows how to setup with POP, Imap is equally possible, just not documented, to use Imap, reconfigure Dovecot, and instead of modifying _ |
- Make Jira aware of the new handler
Info |
---|
| This example shows how to setup with POP, Imap is equally possible, just not documented, to use Imap, reconfigure Dovecot, and instead of modifying .../pop/popservice.xml |
_ _ _
{info}
Update _- Update WEB-INF/classes/services/com/atlassian/jira/service/services/pop/popservice.xml
_ - to
- include:
{code:xml} Code Block |
---|
|
<value>
<key>com.dolby.atlassian.jira.service.util.handler.CreateOrCommentHandler</key>
<value>Extendable Mail Handler - CreateOrComment</value>
</value>
|
{code}
# Ensure a valid POP Sever is configured
This is under _Global - Ensure a valid POP Sever is configured
This is under Global Settings/Mail - Servers
_- .
- If
- the
- virtual
- mailbox
- approach
- is
- used,
- only
- one
- mailbox
- needs
- to
- be
- setup,
- in
- the
- example
_- shared@jira.myco.net
_:
!JIRA Extendable Mail Handler^pop-server-setup.png|thumbnail!
# Configure the handler
Modifiy the two properties files. when done, they should be copied to - :
Image Added - Configure the handler
Modifiy the two properties files. when done, they should be copied to WEB-INF/classes:
(i) If you use If you use ldap, - the
- minimum
- config
- required
- is
- to
- identify
- a
- valid
- user
- which
- is
- used
- to
- validate
- ldap
- connections.
- If
- not,
- you
- don't
- need
- this
- file.
(i) The EMH config file is just an extension of the properties that a mail handler is given, anything you could put in the Jira UI, you can equally add here. Look at the settings, understand what they do, make changes as appropriate for your needs.
(!) The contents of the configuration file changes as new features are added and refinements are made, check the The EMH config file is just an extension of the properties that a mail handler is given, anything you could put in the Jira UI, you can equally add here. Look at the settings, understand what they do, make changes as appropriate for your needs. The contents of the configuration file changes as new features are added and refinements are made, check the 'example-emh.properties' - available
- inside
- every
- JAR.
Some example properties are:
{ No Format | } |
---|
projectAutoAssign=true, issuetype=3, configFile=emh.properties
{noformat}
* |
Service Properties:*
!JIRA Extendable Mail Handler^emh-service-config.png|thumbnail!
*Service listing after save:*
!JIRA Extendable Mail Handler^emh-service-configured.png|thumbnail!
# Restart Jira
h2. JEMH Handler Configuration File
The following sections describe the fields that can be used to configure JEMH. Organised by where they are used, in future I will try to expand on the documentation and provide more detailed examples.
(i) as of 0.7, all 'default' fields are prefixed with _default_, eg _defaultPriority_ etc. for clarity.
(i) An example configuration file is packaged in every JAR, called Properties: Image Added Service listing after save: Image Added - Restart Jira
JEMH Handler Configuration FileThe following sections describe the fields that can be used to configure JEMH. Organised by where they are used, in future I will try to expand on the documentation and provide more detailed examples. as of 0.7, all 'default' fields are prefixed with default, eg defaultPriority etc. for clarity. An example configuration file is packaged in every JAR, called 'example-emh.properties', contrast this file to your local file for changes.
||Option|| Example value || Description||
| notifyUsers | _true_ | Notifies users if their accounts are created, also used to notify users on issue creation, necessary when users are anonymous and would like notification of issue details. |
| notifyUsersOnIssueCreation | _none_\|_nonjira_\|_jira_\|_all_ | This provides a way for users to be notified of email driven issue creation irrespective of any other system or user configuration options |
| assignNonJiraUsersOriginalEmailAddressToCustomField | afieldname | As the excessively descriptive field describes, will populate the given custom field with String value of the email address in CSV fashion. This value can *also* be populated as a directive... (!) This is a security risk, just knowing the issue key (guessing even) would enable anyone with email access to add themselves into the issue. Default is disabled. To Fix ([JEMH-51|http://studio.plugins.atlassian.com/browse/JEMH-51])|
| defaultReportUsername| _abod_ | identifies a 'default' user for anonymous email submission |
| defaultIssueType | _3_ or _bug_ | default issue type for created issues |
| defaultPriority | _3_ or _critical_ | default priority for created issues |
| defaultIssueLinkType | _relates_ | default link type for linked issues |
| defaultProject | _APROJ_\|_Magic Project_\|_10002_ | an identifier for a project |
| defaultComponent | _Some Component_\|_10012_ | an identifier for a component in the given project |
| whitelistSenders | _(.\*)@(.\*)yourco.net_ | A regexp CSV list. If set, no other domains/accounts will succeed (implying blacklist of other domains), the blacklist can be used to further restrict within the whitelisted domains. If not set, all address will pass. Supports java5 regular expressions|
| blacklistSenders | _postmaster@xyz.com,(.\*)@(.\*)otherco.net_ | A regexp CSV list of addresses that will not be processed by Jira, and will be automatically forwarded (if silently drop not set) to the configured 'forwarder' of the related Mail Service, java5 regexp supported |
| blacklistRecipients | _jira-noreply@yourco.net,noemailprojectkey@yourco.net_ | as above |
| silentlyDropBlacklistMatches | _true_ | If set to false, causes blacklisted mails to not be forwarded, dropping _all_ of them. Possibly useful for high volume environments, blacklisted mails will always be deleted |
| greylistSenders | _Option | Example value | Description |
---|
notifyUsers | true | Notifies users if their accounts are created, also used to notify users on issue creation, necessary when users are anonymous and would like notification of issue details. | notifyUsersOnIssueCreation | none|nonjira|jira|all | This provides a way for users to be notified of email driven issue creation irrespective of any other system or user configuration options | assignNonJiraUsersOriginalEmailAddressToCustomField | afieldname | As the excessively descriptive field describes, will populate the given custom field with String value of the email address in CSV fashion. This value can also be populated as a directive... This is a security risk, just knowing the issue key (guessing even) would enable anyone with email access to add themselves into the issue. Default is disabled. To Fix (JEMH-51) | defaultReportUsername | abod | identifies a 'default' user for anonymous email submission | defaultIssueType | 3 or bug | default issue type for created issues | defaultPriority | 3 or critical | default priority for created issues | defaultIssueLinkType | relates | default link type for linked issues | defaultProject | APROJ|Magic Project|10002 | an identifier for a project | defaultComponent | Some Component|10012 | an identifier for a component in the given project | whitelistSenders | (.*)@(.*)yourco.net | A regexp CSV list. If set, no other domains/accounts will succeed (implying blacklist of other domains), the blacklist can be used to further restrict within the whitelisted domains. If not set, all address will pass. Supports java5 regular expressions | blacklistSenders | postmaster@xyz.com,(.*)@(.*)otherco.net | A regexp CSV list of addresses that will not be processed by Jira, and will be automatically forwarded (if silently drop not set) to the configured 'forwarder' of the related Mail Service, java5 regexp supported | blacklistRecipients | jira-noreply@yourco.net,noemailprojectkey@yourco.net | as above | silentlyDropBlacklistMatches | true | If set to false, causes blacklisted mails to not be forwarded, dropping all of them. Possibly useful for high volume environments, blacklisted mails will always be deleted | greylistSenders | postmaster@yourco.net,.*@yourco.com |
_ | |
| greylistSendersSubjectRegexps | _Delivery to the following recipients | greylistSendersSubjectRegexps | Delivery to the following recipients failed,. |
\ \\_ | |
| greylistRelatedUserBodyRegexp | _\[ \ | greylistRelatedUserBodyRegexp | [ ]*to: |
\ \\\$_ | Enables |
| silentlyDropGreylistSubjectMatches | _true_ | If set to false, causes blacklisted mails to not be forwarded, dropping _all_ of them, if true. |
| emailFieldProcessorPriorityLowerLimit| _0_ | If set will set the lower priority limit that processors are enabled, allowing users to configure just a subset of available field processors to be executed in priority order (procPri>=lowerLimit and procPri<=upperLimit). Eg, _MailFormNgProcessor_=1000, _CSVProcessor_=10000, 'default' _Atlassian_ Processor=2147483647 |
| emailFieldProcessorPriorityUpperLimit| _2147483647_ | As above, but the upper limit|
h3. CommentHandler
||Option|| Example value || Description||
|stripQuotes| false | strips > comment lines from included emails when Jira emails are replied to. Overrides system default settings to forward an entire email (from outside Jira) including comments, into a Jira ticket.|
h3. AbstractFieldProcessor
||Option|| Example value || Description||
|debugPrintEmail |true |will print out emails as they are received for debugging|
|alternateIDLookupClassList| | silentlyDropGreylistSubjectMatches | true | If set to false, causes blacklisted mails to not be forwarded, dropping all of them, if true. | emailFieldProcessorPriorityLowerLimit | 0 | If set will set the lower priority limit that processors are enabled, allowing users to configure just a subset of available field processors to be executed in priority order (procPri>=lowerLimit and procPri<=upperLimit). Eg, MailFormNgProcessor=1000, CSVProcessor=10000, 'default' Atlassian Processor=2147483647 | emailFieldProcessorPriorityUpperLimit | 2147483647 | As above, but the upper limit |
Option | Example value | Description |
---|
stripQuotes | false | strips > comment lines from included emails when Jira emails are replied to. Overrides system default settings to forward an entire email (from outside Jira) including comments, into a Jira ticket. |
AbstractFieldProcessorOption | Example value | Description |
---|
debugPrintEmail | true | will print out emails as they are received for debugging | alternateIDLookupClassList | x.y.AClass,p.q.BClass |
| |
| domainEquivalency | | domainEquivalency | my.co.uk:my.com |
| |
|emailFieldProcessorClassList| | emailFieldProcessorClassList | x.y.AClass,p.q.BClass |
| |
||| |
| forceUserIdCase|true|will force the case of userids for lookups, required for case sensitive DB's|
| lowercaseUserids|true| if true will force lowercase, false or missing indicates upper case|
| catchEmail| | forceUserIdCase | true | will force the case of userids for lookups, required for case sensitive DB's | lowercaseUserids | true | if true will force lowercase, false or missing indicates upper case | catchEmail | xyz@jira.myco.net |
| |
| createUsers | true | enables on the fly creation of users, whether being the 'sender' or a | createUsers | true | enables on the fly creation of users, whether being the 'sender' or a 'watcher', |
|
| createUsersIDFrom| | createUsersIDFrom | name/email/alternate |
| |
| createUsersIDFromEmailDomainWhitelist | .\ | createUsersIDFromEmailDomainWhitelist | .*@myco.net,. |
\ | |
| createUsersIDFromEmailBlacklist| | createUsersIDFromEmailBlacklist | sales@atlassian.com |
| |
| notifyUsers | true| notify users of issue creation |
| deleteEmail | true | if set to false, will prevent Jira from deleting mails from the mailbox after processing |
| autoFlushMailQueue | true | will cause the Mail Queue to be flushed whenever the EMH handler is run (which only occurs when there is mail to process) |
| addWatchersFromCC | true | will make _all_ valid users watchers of the created issue, in addition to anything that may be set as directive |
| createUsersIDFrom | email\|name\|alternate | select mechanism for determining the userID, email is _user@someplace.com_, name is _user_@somplace.com, alternate means use the alternateID provider classes|
| autoJoinGroup | email-users | enables auto-created users to be automatically joined to a given group |
| indicateWhichProcessorProcessedMail | true/false | causes a one liner to be inserted at the top of the jira issue, to assist in debugging, or as an indicator for where the issue came from|
| ccHandling | toWatcher\|toCustomField | will cause users to be derived from email _cc:_ entries as well as from the directive _ccusers_, to be added as watchers to the issue or to be merged into a given custom field (must be capable of accepting user type, eg MultiUserCF type|
| ccHandlingTargetCustomFieldName | Some CF Name | If the _ccHandling_ field indicates a custom field should be used, this field idetifies that field by name, whitespace allowed |
h2. JEMH Poker Installation
!poke.gif!!http://www.atlassian.com/software/jira/images/logo_small.png!
This JEMH Poker is a simple javaapplication that triggers the JEMH to do an immediate mail retrieval. The current 1.0 release of the JEMH Poker contains a simple file monitor, suitable for most Unix or Linux platforms and associated file-based mail systems. Exchange is an unknown quantity, as Microsoft products are not known for their openness - the approach I took in my organization was to use Exchange purely as a vehicle to get mail to where I could do something useful with it (see setting up Postfix smtp server and Dovecot POP server pages here).
h3. Installation of the remote agent
# Extract the tgz in /usr/local
{noformat} | notifyUsers | true | notify users of issue creation | deleteEmail | true | if set to false, will prevent Jira from deleting mails from the mailbox after processing | autoFlushMailQueue | true | will cause the Mail Queue to be flushed whenever the EMH handler is run (which only occurs when there is mail to process) | addWatchersFromCC | true | will make all valid users watchers of the created issue, in addition to anything that may be set as directive | createUsersIDFrom | email|name|alternate | select mechanism for determining the userID, email is user@someplace.com, name is user@somplace.com, alternate means use the alternateID provider classes | autoJoinGroup | email-users | enables auto-created users to be automatically joined to a given group | indicateWhichProcessorProcessedMail | true/false | causes a one liner to be inserted at the top of the jira issue, to assist in debugging, or as an indicator for where the issue came from | ccHandling | toWatcher|toCustomField | will cause users to be derived from email cc: entries as well as from the directive ccusers, to be added as watchers to the issue or to be merged into a given custom field (must be capable of accepting user type, eg MultiUserCF type | ccHandlingTargetCustomFieldName | Some CF Name | If the ccHandling field indicates a custom field should be used, this field idetifies that field by name, whitespace allowed |
JEMH Poker InstallationImage AddedImage Added This JEMH Poker is a simple javaapplication that triggers the JEMH to do an immediate mail retrieval. The current 1.0 release of the JEMH Poker contains a simple file monitor, suitable for most Unix or Linux platforms and associated file-based mail systems. Exchange is an unknown quantity, as Microsoft products are not known for their openness - the approach I took in my organization was to use Exchange purely as a vehicle to get mail to where I could do something useful with it (see setting up Postfix smtp server and Dovecot POP server pages here). Installation of the remote agent- Extract the tgz in /usr/local
No Format |
---|
cd /usr/local
tar xzf filename.tgz
|
{noformat}
# Make the launch shell script executable
{noformat}- Make the launch shell script executable
No Format |
---|
cd jemh-mail-notifier-......
chmod +x |
*.sh
{noformat}
# Link a common name to the current version
{noformat}- Link a common name to the current version
No Format |
---|
ln -s jemh-mail-notifier-...... jemh-mail-notifier
|
{noformat}
# Ensure you have Java in your path, the following should give some version information. If not, install Java - Ensure you have Java in your path, the following should give some version information. If not, install Java 1.5+
- or
- modify
- the
- script
- (you
- should
- know
- what
- to
- do)
{ } -version
{noformat}
# Edit the configuration file _- Edit the configuration file emh-poker.properties
_- ,
- set
- the
- server
- (IP
- address
- or
- DNS
- name)
- and
- the
- port
- (default
- is
- 7777).
# - Run
- the
- script
- as
- the
- appropriate
- user
- for
- your
- environemnt.
- With
- Postfix,
- you
- may
- need
- to
- be
- running
_- as
_ - Postfix.
- Running
- as
- root
- is
- to
- be
- avoided,
- create
- a
- service
- user
- as
- follows:
{ } |
---|
root@server:/usr/local/jemh-mail-notifier-1.1-SNAPSHOT# adduser --disabled-login --no-create-home -ingroup postfix jirapoker
Adding user `jirapoker' ...
Adding new user `jirapoker' (1009) with group `postfix' ...
Not creating home directory `/home/jirapoker'.
Changing the user information for jirapoker
Enter the new value, or press ENTER for the default
Full Name []:
Room Number []:
Work Phone []:
Home Phone []:
Other []:
Is the information correct? [Y/n] Y
|
{noformat}
h3. Create a SysV startup script in
Create a SysV startup script in /etc/init.d
Create it as 'jemh-mail-notifier'
{ No Format | } |
---|
#! /bin/sh
### BEGIN INIT INFO
# Provides: jemh-mail-notifier
# Required-Start:
# Required-Stop:
# Default-Start: 2
# Default-Stop:
# Short-Description: Monitors a mailbox and poke jira when mail arrives
### END INIT INFO
PATH=/sbin:/bin
. /lib/lsb/init-functions
case "$1" in
start)
cd /usr/local/jemh-mail-notifier
./run.sh &
;;
stop)
# No-op
echo Cant stop it from here, use 'ps -ef | grep java' at the prompt
;;
*)
echo "Usage: $0 start" >&2
exit 3
;;
esac
{noformat}
|
To make the service start at bootup:
{ No Format | } |
---|
sudo apt-get install sysvconfig
sysvconfig
{noformat}
|
Now find the jemh-mail-notifer and enable for startup, click finish to save.
h3. Installing the Jira JEMH Poker Service
The main JEMH includes everything necessary, the only thing that's required is a bit of configuration:
# - Login
- to
- Jira
- as
- admin
# - Go
- to
- the
- Services
- screen
# - Add
- a
- service:
|| Name | JEMH Poker Service |
|| Class | Name | JEMH Poker Service |
---|
Class | com.dolby.atlassian.jira.service.util.handler.emh.service.EMHPokerService |
---|
|
|| Delay | 1 _ starts_ |
# Select the default port options or change as you see fit (must fix Poker configuration, above)
After configuring you should see something like:
!poker-service.png!
h3. Poker Sequence Diagram
{gliffy:name=JEMH Poker - remote agent|space=Jira Extendable Mail Handler|page=Installation and Configuration|pageid=2752853|align=left|size=L}
- Select the default port options or change as you see fit (must fix Poker configuration, above)
After configuring you should see something like: Image Added Poker Sequence Diagram Gliffy |
---|
size | L |
---|
name | JEMH Poker - remote agent |
---|
page | Installation and Configuration |
---|
pageid | 2752853 |
---|
align | left |
---|
space | Jira Extendable Mail Handler |
---|
|
|