-
Notifications
You must be signed in to change notification settings - Fork 21
httpd configuration #293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
httpd configuration #293
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| <VirtualHost *:80> | ||
| ServerName {{ ansible_facts['fqdn'] }} | ||
stejskalleos marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ## Load additional static includes | ||
| IncludeOptional "/etc/httpd/conf.d/05-foreman.d/*.conf" | ||
|
|
||
| ## Logging | ||
| ErrorLog "/var/log/httpd/foreman_error.log" | ||
| ServerSignature Off | ||
| CustomLog "/var/log/httpd/foreman_access.log" combined | ||
|
|
||
| ## Request header rules | ||
| ## as per http://httpd.apache.org/docs/2.4/mod/mod_headers.html#requestheader | ||
| RequestHeader set X-FORWARDED-PROTO "http" | ||
ekohl marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| RequestHeader set SSL-CLIENT-S-DN "" | ||
| RequestHeader set SSL-CLIENT-CERT "" | ||
| RequestHeader set SSL-CLIENT-VERIFY "" | ||
| RequestHeader unset REMOTE-USER | ||
| RequestHeader unset REMOTE_USER | ||
| RequestHeader unset REMOTE-USER-EMAIL | ||
| RequestHeader unset REMOTE-USER_EMAIL | ||
| RequestHeader unset REMOTE_USER-EMAIL | ||
| RequestHeader unset REMOTE_USER_EMAIL | ||
| RequestHeader unset REMOTE-USER-FIRSTNAME | ||
| RequestHeader unset REMOTE-USER_FIRSTNAME | ||
| RequestHeader unset REMOTE_USER-FIRSTNAME | ||
| RequestHeader unset REMOTE_USER_FIRSTNAME | ||
| RequestHeader unset REMOTE-USER-LASTNAME | ||
| RequestHeader unset REMOTE-USER_LASTNAME | ||
| RequestHeader unset REMOTE_USER-LASTNAME | ||
| RequestHeader unset REMOTE_USER_LASTNAME | ||
| RequestHeader unset REMOTE-USER-GROUPS | ||
| RequestHeader unset REMOTE-USER_GROUPS | ||
| RequestHeader unset REMOTE_USER-GROUPS | ||
| RequestHeader unset REMOTE_USER_GROUPS | ||
|
|
||
| <Location "/pulp/content"> | ||
| RequestHeader unset X-CLIENT-CERT | ||
| RequestHeader set X-CLIENT-CERT "%{SSL_CLIENT_CERT}s" env=SSL_CLIENT_CERT | ||
| RequestHeader set X-FORWARDED-PROTO expr=%{REQUEST_SCHEME} | ||
| ProxyPass {{ httpd_pulp_content_backend }}/pulp/content disablereuse=on timeout=600 | ||
| ProxyPassReverse {{ httpd_pulp_content_backend }}/pulp/content | ||
| </Location> | ||
|
|
||
| Alias /pub /var/www/html/pub | ||
|
|
||
| <Location /pub> | ||
| Options +FollowSymLinks +Indexes | ||
| Require all granted | ||
| </Location> | ||
|
|
||
| ## Proxy rules | ||
| ProxyRequests Off | ||
| ProxyPreserveHost On | ||
| ProxyAddHeaders On | ||
| ProxyPass /pulp ! | ||
| ProxyPass /pub ! | ||
| ProxyPass /icons ! | ||
| ProxyPass /images ! | ||
| ProxyPass /server-status ! | ||
| ProxyPass / {{ httpd_foreman_backend }}/ retry=0 timeout=900 upgrade=websocket | ||
| ProxyPassReverse / {{ httpd_foreman_backend }}/ | ||
|
|
||
| AddDefaultCharset UTF-8 | ||
| </VirtualHost> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,9 +2,9 @@ | |
|
|
||
| import pytest | ||
|
|
||
|
|
||
| FOREMAN_HOST = 'localhost' | ||
| FOREMAN_PORT = 3000 | ||
|
|
||
| RECURRING_INSTANCES = [ | ||
| "reports-daily", | ||
| "db-sessions-clear", | ||
|
|
@@ -16,10 +16,9 @@ | |
| "ldap-refresh_usergroups", | ||
| ] | ||
|
|
||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: Python convention is to have 2 empty lines here and my linter is unhappy about this. |
||
| @pytest.fixture(scope="module") | ||
| def foreman_status_curl(server): | ||
| return server.run(f"curl --silent --write-out '%{{stderr}}%{{http_code}}' http://{FOREMAN_HOST}:{FOREMAN_PORT}/api/v2/ping") | ||
| return server.run(f"curl --header 'X-FORWARDED-PROTO: https' --silent --write-out '%{{stderr}}%{{http_code}}' http://{FOREMAN_HOST}:{FOREMAN_PORT}/api/v2/ping") | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, we wanted the test not to rely on Apache :) |
||
|
|
||
|
|
||
| @pytest.fixture(scope="module") | ||
|
|
||
stejskalleos marked this conversation as resolved.
Show resolved
Hide resolved
|
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2,6 +2,7 @@ | |||||
| HTTP_PORT = 80 | ||||||
| HTTPS_PORT = 443 | ||||||
| HTTPD_PUB_DIR = '/var/www/html/pub' | ||||||
| CURL_CMD = "curl --silent --output /dev/null" | ||||||
|
|
||||||
| def test_httpd_service(server): | ||||||
| httpd = server.service("httpd") | ||||||
|
|
@@ -16,38 +17,73 @@ def test_https_port(server): | |||||
| httpd = server.addr(HTTP_HOST) | ||||||
| assert httpd.port(HTTPS_PORT).is_reachable | ||||||
|
|
||||||
| def test_http_foreman_ping(server, server_fqdn): | ||||||
| cmd = server.run(f"{CURL_CMD} --write-out '%{{redirect_url}}' http://{server_fqdn}/api/v2/ping") | ||||||
| assert cmd.succeeded | ||||||
| assert cmd.stdout == f'https://{server_fqdn}/api/v2/ping' | ||||||
|
|
||||||
| def test_https_foreman_ping(server, certificates, server_fqdn): | ||||||
| cmd = server.run(f"curl --cacert {certificates['ca_certificate']} --silent --output /dev/null --write-out '%{{http_code}}' https://{server_fqdn}/api/v2/ping") | ||||||
| cmd = server.run(f"{CURL_CMD} --cacert {certificates['ca_certificate']} --write-out '%{{http_code}}' https://{server_fqdn}/api/v2/ping") | ||||||
| assert cmd.succeeded | ||||||
| assert cmd.stdout == '200' | ||||||
|
|
||||||
| def test_https_pulp_status(server, certificates, server_fqdn): | ||||||
| cmd = server.run(f"curl --cacert {certificates['ca_certificate']} --silent --output /dev/null --write-out '%{{http_code}}' https://{server_fqdn}/pulp/api/v3/status/") | ||||||
| def test_http_pulp_api_status(server, server_fqdn): | ||||||
| cmd = server.run(f"{CURL_CMD} --write-out '%{{http_code}}' http://{server_fqdn}/pulp/api/v3/status/") | ||||||
| assert cmd.succeeded | ||||||
| assert cmd.stdout == '404' | ||||||
|
|
||||||
| def test_https_pulp_api_status(server, certificates, server_fqdn): | ||||||
| cmd = server.run(f"{CURL_CMD} --cacert {certificates['ca_certificate']} --write-out '%{{http_code}}' https://{server_fqdn}/pulp/api/v3/status/") | ||||||
| assert cmd.succeeded | ||||||
| assert cmd.stdout == '200' | ||||||
|
|
||||||
| def test_http_pulp_content(server, server_fqdn): | ||||||
| cmd = server.run(f"{CURL_CMD} --write-out '%{{stderr}}%{{http_code}}' http://{server_fqdn}/pulp/content/") | ||||||
| assert cmd.succeeded | ||||||
| assert cmd.stderr == '200' | ||||||
|
|
||||||
| def test_https_pulp_content(server, certificates, server_fqdn): | ||||||
| cmd = server.run(f"curl --cacert {certificates['ca_certificate']} --silent --output /dev/null --write-out '%{{http_code}}' https://{server_fqdn}/pulp/content/") | ||||||
| cmd = server.run(f"curl --silent --cacert {certificates['ca_certificate']} https://{server_fqdn}/pulp/content/") | ||||||
| assert cmd.succeeded | ||||||
| assert cmd.stdout == '200' | ||||||
| assert "Index of /pulp/content/" in cmd.stdout | ||||||
|
|
||||||
| def test_https_pulp_auth(server, certificates, server_fqdn): | ||||||
| cmd = server.run(f"curl --cacert {certificates['ca_certificate']} --silent --write-out '%{{stderr}}%{{http_code}}' --cert {certificates['client_certificate']} --key {certificates['client_key']} https://{server_fqdn}/pulp/api/v3/users/") | ||||||
| cmd = server.run(f"{CURL_CMD} --cacert {certificates['ca_certificate']} --write-out '%{{http_code}}' --cert {certificates['client_certificate']} --key {certificates['client_key']} https://{server_fqdn}/pulp/api/v3/users/") | ||||||
| assert cmd.succeeded | ||||||
| assert cmd.stderr == '200' | ||||||
stejskalleos marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| assert cmd.stdout == '200' | ||||||
|
|
||||||
| def test_pub_directory_exists(server): | ||||||
| pub_dir = server.file(HTTPD_PUB_DIR) | ||||||
| assert pub_dir.exists | ||||||
| assert pub_dir.is_directory | ||||||
| assert pub_dir.mode == 0o755 | ||||||
|
|
||||||
| def test_pub_directory_accessible(server, certificates, server_fqdn): | ||||||
| def test_http_pub_directory_accessible(server, server_fqdn): | ||||||
| cmd = server.run(f"curl --silent --output /dev/null --write-out '%{{http_code}}' http://{server_fqdn}/pub/") | ||||||
stejskalleos marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| assert cmd.succeeded | ||||||
| assert cmd.stdout == '200' | ||||||
|
|
||||||
| def test_https_pub_directory_accessible(server, certificates, server_fqdn): | ||||||
| cmd = server.run(f"curl --cacert {certificates['ca_certificate']} --silent --output /dev/null --write-out '%{{http_code}}' https://{server_fqdn}/pub/") | ||||||
| assert cmd.succeeded | ||||||
| assert cmd.stdout == '200' | ||||||
|
|
||||||
| def test_pub_ca_certificate_downloadable(server, certificates, server_fqdn): | ||||||
| def test_http_pub_ca_certificate_downloadable(server, server_fqdn): | ||||||
| cmd = server.run(f"curl --silent --output /dev/null --write-out '%{{http_code}}' http://{server_fqdn}/pub/katello-server-ca.crt") | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| assert cmd.succeeded | ||||||
| assert cmd.stdout == '200' | ||||||
|
|
||||||
| def test_https_pub_ca_certificate_downloadable(server, certificates, server_fqdn): | ||||||
| cmd = server.run(f"curl --cacert {certificates['ca_certificate']} --silent --output /dev/null --write-out '%{{http_code}}' https://{server_fqdn}/pub/katello-server-ca.crt") | ||||||
| assert cmd.succeeded | ||||||
| assert cmd.stdout == '200' | ||||||
|
|
||||||
| def test_http_foreman_login(server, server_fqdn): | ||||||
| cmd = server.run(f"{CURL_CMD} --write-out '%{{http_code}}' http://{server_fqdn}/users/login") | ||||||
| assert cmd.succeeded | ||||||
| assert cmd.stdout == '301' | ||||||
|
|
||||||
| def test_https_foreman_login(server, certificates, server_fqdn): | ||||||
| cmd = server.run(f"{CURL_CMD} --cacert {certificates['ca_certificate']} --write-out '%{{http_code}}' https://{server_fqdn}/users/login") | ||||||
| assert cmd.succeeded | ||||||
| assert cmd.stdout == '200' | ||||||

Uh oh!
There was an error while loading. Please reload this page.