Monday, February 4, 2019

Redirection with JIRA

Redirection with JIRA

Setting up redirect within JIRA to mandate coming from Apache page (on RedHat 7).

1. Install JIRA

Here's the default installation outcome for JIRA 7.13.1:

Installation Directory: /opt/atlassian/jira
Home Directory: /var/atlassian/application-data/jira
HTTP Port: 8080
RMI Port: 8005

2. Install httpd (sudo yum install httpd)

3. Edit the file at:
/var/www/html/index.html
Here's the content:

<html>
<body>
<p>
<a href="http://10.10.0.1:8080/secure/Dashboard.jspa">Go to Jira</a>
</p>
</body>
</html>

4. Start httpd (systemctl start httpd)

5. Edit this file:
/opt/atlassian/jira/atlassian-jira/WEB-INF/urlrewrite.xml

JIRA uses tuckey's urlrewritefilter plugin to Tomcat. So you can refer to tuckey for additional instructions.


<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 4.0//EN" "http://www.tuckey.org/res/dtds/urlrewrite4.0.dtd">

<!--
    URL Rewrite files to make issue navigator URL backwards compatible and some other things
    @since JIRA 3.3
-->
<urlrewrite>
    <!-- Caching of static resources -->
    <class-rule class="com.atlassian.jira.plugin.webresource.CachingResourceDownloadRewriteRule"/>
    <!-- @since 5.0 [KickAss]-->
    <rule>
        <from>^/issues(\?.*)?$</from>
        <to type="permanent-redirect">issues/$1</to>
    </rule>
<!--
 Here is our sample rule
-->
    <rule>
       <from>^/secure/Dashboard.jspa$</from>
        <condition name="referer" operator="notequal">^http://10.10.0.1/.*$</condition>
        <condition name="referer" operator="notequal">^http://10.10.0.1:8080/.*$</condition>
        <to type="redirect">http://10.10.0.1</to>
    </rule>
</urlrewrite>

6. You have to restart JIRA for the changes to apply.
Remember, your start/stop script are located under /opt/atlassian/jira/bin

7. To verify that your rules are valid, from localhost browse to http://localhost:8080/rewrite-status. This will output the rewrite rule status.

AWS WAF log4j query

How to query AWS WAF log for log4j attacks 1. Setup your Athena table using this instruction https://docs.aws.amazon.com/athena/latest/ug/wa...