Public bug reported:

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/

** Affects: tomcat9 (Ubuntu)
     Importance: Low
         Status: Triaged


** Tags: bitesize dep8

** Summary changed:

- Add DEP8 tests
+ Add DEP8 tests (suggestion included)

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1866340

Title:
  Add DEP8 tests (suggestion included)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/tomcat9/+bug/1866340/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to