Skip to content

JIRA Standalone – Major Vulnerability

by karlkatzke on March 3rd, 2008

JIRA Standalone runs, by default, as the user that starts the process on Linux. Running tomcat as root is generally a Bad Idea. Therefore, if you run JIRA as a service by adding a script under /etc/init.d and calling /etc/init.d/jira start … it’ll be running as root.

I opened a ticket with JIRA support several weeks ago pointing this out, and the only result has been adding one line of documentation that tells you how to add a user. This is not the best solution. Their solution would create a privileged user with a shell — you want to avoid this. Also, they don’t say anything about running JIRA as a service under init.d.

After the fold, there’s my init.d script for OpenSUSE 10.3. Gotta love JIRA, it’s more flexible than any other project management tool out there, but Atlassian apparently is not a company with a great deal of understanding of Linux.

This script will run JIRA as the tomcat user. After placing it in /etc/init.d/, run

chkconfig jira on

to start JIRA when you start the system.

#!/bin/bash

# Copyright (c) 2006 SUSE Linux Products GmbH
#
# /srv/jira/ -- Starts tomcat/catalina
#
### BEGIN INIT INFO
# Provides: jira
# Required-Start: $remote_fs $syslog $network
# Required-Stop:  $remote_fs $syslog
# Default-Start:  3 5
# Default-Stop:   0 1 2 6
# Short-Description: JIRA Task Management Standalone
# Description:       Start JIRA web services
### END INIT INFO

. /etc/rc.status

rc_reset

case "$1" in
        start)
                echo -n "Starting JIRA "
                su - tomcat /srv/jira/bin/startup.sh

                rc_status -v
                ;;
        stop)
                echo -n "Shutting down JIRA "
                su - tomcat /srv/jira/bin/shutdown.sh

                rc_status -v
                ;;
        restart)
                $0 stop
                $0 start
                ;;
        *)
                echo "Usage: $0 {start|stop}"
                exit 1
esac
rc_exit

From → linux, sysadmin

3 Comments
  1. Tim Kientzle permalink

    But then you can’t run Jira on port 80, can you?

  2. Tim – There’s two ways to handle this. One is to use the jsvc extension, which would run one thread as Root to open the port, and one thread as TOMCAT_USER (an unprivileged user) to actually handle the requests. I can’t figure out in the tangle of configuration files; they do seem to be using jsvc but passing the –user option in the catalina start shell script does not seem to work.

    How *we* handle it is by putting squid in front of it with a port redirect…. but we have a load balancing setup that allows us to do that. You could use Apache for this, you could use your box’s firewall to forward all requests from port 80 to port 8080, etc. so on so forth. It depends on your environment and how detailed you’re willing to get with configuration.

    The point still remains — don’t run JIRA standalone as root. You really, really don’t want Tomcat running with root permissions.

  3. If you dig around, you should be able to find some documentation to make it so that your several instances of Jira on a single host can be accessed via your normal webserver.

    ie. I installed 2 instances of Jira onto a single host, and bound them to 8080 and 8081.

    I then installed apache, and some suitable modules. Then configured apache so that http://host.domain.com/jira-one/ would serve the contents of jira instance one from 8080, then then http://host.domain.com/jira-two/ would serve the contents of jira instance two from 8081.

    So all the user has to remember is http://site…/jira-one/ or http://site…/jira-two/

    Had hoped to use vhosts to do it, but I will give that another go soon enough, but for the moment. I am happy with the current arrangement.

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS