Add DEP8 tests (suggestion included)

Bug #1866340 reported by Andreas Hasenack
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tomcat9 (Ubuntu)
Triaged
Low
Unassigned

Bug Description

While fixing a mod_proxy_ajp issue in apache, I had to come up with a test for it. Turns out that test could be easily transformed into a DEP8 test. The MP was https://code.launchpad.net/~ahasenack/ubuntu/+source/apache2/+git/apache2/+merge/380324, but in case it disappears, I'll paste the manual procedure below.

sudo apt install tomcat9 apache2 tomcat9-examples
sudo a2enmod proxy_ajp
# edit /etc/apache2/sites-enabled/000-default.conf and add this line:
ProxyPass "/examples" "ajp://localhost:8009/examples"
sudo systemctl restart apache2

# edit /etc/tomcat9/server.xml, locate the "Define an AJP 1.3 Connector on port 8009" section and define the connector like this:
    <Connector protocol="AJP/1.3"
               address="0.0.0.0"
               secret="supersecret"
               port="8009" />

# if we didn't add a secret to the connector configuration, tomcat9 would fail to start it, because a secret is mandatory by default since 9.0.13.

# restart tomcat9
sudo systemctl restart tomcat9

# Let's confirm tomcat9 is working
curl http://localhost:8080

# And the examples page which is what we will proxy through apache later:
curl http://localhost:8080/examples/

# we want to access that via apache, but it won't work now because we didn't configure the same secret on apache's side. You will get back a nasty 403:
curl http://localhost/examples/
<!doctype html><html lang="en"><head><title>HTTP Status 403 ......

# now let's add the secret keyword to apache's /etc/apache2/sites-enabled/000-default.conf:

        ProxyPass "/examples" "ajp://localhost:8009/examples" secret=supersecret

# apache2 will fail to restart, as it doesn't understand the "secret" parameter
sudo systemctl restart apache2

# update to the apache packages from the ppa
sudo add-apt-repository ppa:ahasenack/apache2-mod-ajp-secret -y -u
sudo apt install apache2 -y

# Try the examples page via apache again, and this time we get the examples through apache
curl http://localhost/examples/

Tags: bitesize dep8
summary: - Add DEP8 tests
+ Add DEP8 tests (suggestion included)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.