-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add keystone audit middleware API logging
This commit adds Keystone audit middleware API logging to the Glance charm in versions Yoga and newer to allow users to configure their environment for CADF compliance. This feature can be enabled/disabled and is set to 'disabled' by default to avoid bloat in log files. The logging output writes to /var/log/glance/glance-api.log. This commit builds on previous discussions: juju/charm-helpers#808. Closes-Bug: 1856555 Change-Id: Ied08b56cf3c4fa30827d43a50ca7b552db0fa82b (cherry picked from commit 66a167e)
- Loading branch information
Showing
7 changed files
with
242 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# Use this pipeline for no auth or image caching - DEFAULT | ||
[pipeline:glance-api] | ||
pipeline = cors healthcheck http_proxy_to_wsgi versionnegotiation osprofiler unauthenticated-context rootapp | ||
|
||
# Use this pipeline for image caching and no auth | ||
[pipeline:glance-api-caching] | ||
pipeline = cors healthcheck http_proxy_to_wsgi versionnegotiation osprofiler unauthenticated-context cache rootapp | ||
|
||
# Use this pipeline for caching w/ management interface but no auth | ||
[pipeline:glance-api-cachemanagement] | ||
pipeline = cors healthcheck http_proxy_to_wsgi versionnegotiation osprofiler unauthenticated-context cache cachemanage rootapp | ||
|
||
# Use this pipeline for keystone auth | ||
[pipeline:glance-api-keystone] | ||
{% if audit_middleware and service_name -%} | ||
pipeline = cors healthcheck http_proxy_to_wsgi versionnegotiation osprofiler authtoken audit context rootapp | ||
{% else %} | ||
pipeline = cors healthcheck http_proxy_to_wsgi versionnegotiation osprofiler authtoken context rootapp | ||
{% endif %} | ||
|
||
# Use this pipeline for keystone auth with image caching | ||
[pipeline:glance-api-keystone+caching] | ||
{% if audit_middleware and service_name -%} | ||
pipeline = cors healthcheck http_proxy_to_wsgi versionnegotiation osprofiler authtoken audit context cache rootapp | ||
{% else %} | ||
pipeline = cors healthcheck http_proxy_to_wsgi versionnegotiation osprofiler authtoken context cache rootapp | ||
{% endif %} | ||
|
||
# Use this pipeline for keystone auth with caching and cache management | ||
[pipeline:glance-api-keystone+cachemanagement] | ||
{% if audit_middleware and service_name -%} | ||
pipeline = cors healthcheck http_proxy_to_wsgi versionnegotiation osprofiler authtoken audit context cache cachemanage rootapp | ||
{% else %} | ||
pipeline = cors healthcheck http_proxy_to_wsgi versionnegotiation osprofiler authtoken context cache cachemanage rootapp | ||
{% endif %} | ||
|
||
[composite:rootapp] | ||
paste.composite_factory = glance.api:root_app_factory | ||
/: apiversions | ||
/v2: apiv2app | ||
|
||
[app:apiversions] | ||
paste.app_factory = glance.api.versions:create_resource | ||
|
||
[app:apiv2app] | ||
paste.app_factory = glance.api.v2.router:API.factory | ||
|
||
[filter:healthcheck] | ||
paste.filter_factory = oslo_middleware:Healthcheck.factory | ||
backends = disable_by_file | ||
disable_by_file_path = /etc/glance/healthcheck_disable | ||
|
||
[filter:versionnegotiation] | ||
paste.filter_factory = glance.api.middleware.version_negotiation:VersionNegotiationFilter.factory | ||
|
||
[filter:cache] | ||
paste.filter_factory = glance.api.middleware.cache:CacheFilter.factory | ||
|
||
[filter:cachemanage] | ||
paste.filter_factory = glance.api.middleware.cache_manage:CacheManageFilter.factory | ||
|
||
[filter:context] | ||
paste.filter_factory = glance.api.middleware.context:ContextMiddleware.factory | ||
|
||
[filter:unauthenticated-context] | ||
paste.filter_factory = glance.api.middleware.context:UnauthenticatedContextMiddleware.factory | ||
|
||
[filter:authtoken] | ||
paste.filter_factory = keystonemiddleware.auth_token:filter_factory | ||
delay_auth_decision = true | ||
|
||
[filter:gzip] | ||
paste.filter_factory = glance.api.middleware.gzip:GzipMiddleware.factory | ||
|
||
[filter:osprofiler] | ||
paste.filter_factory = osprofiler.web:WsgiMiddleware.factory | ||
|
||
[filter:cors] | ||
paste.filter_factory = oslo_middleware.cors:filter_factory | ||
oslo_config_project = glance | ||
oslo_config_program = glance-api | ||
|
||
[filter:http_proxy_to_wsgi] | ||
paste.filter_factory = oslo_middleware:HTTPProxyToWSGI.factory | ||
|
||
{% include "section-filter-audit" %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[DEFAULT] | ||
# default target endpoint type | ||
# should match the endpoint type defined in service catalog | ||
target_endpoint_type = None | ||
|
||
# possible end path of api requests | ||
[path_keywords] | ||
detail = None | ||
file = None | ||
images = image | ||
members = member | ||
tags = tag | ||
|
||
# map endpoint type defined in service catalog to CADF typeURI | ||
[service_endpoints] | ||
image = service/storage/image |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
[DEFAULT] | ||
verbose = {{ verbose }} | ||
use_syslog = {{ use_syslog }} | ||
debug = {{ debug }} | ||
workers = {{ workers }} | ||
bind_host = {{ bind_host }} | ||
|
||
{% if ext -%} | ||
bind_port = {{ ext }} | ||
{% elif bind_port -%} | ||
bind_port = {{ bind_port }} | ||
{% else -%} | ||
bind_port = 9292 | ||
{% endif -%} | ||
|
||
{% if transport_url %} | ||
transport_url = {{ transport_url }} | ||
{% endif %} | ||
|
||
log_file = /var/log/glance/api.log | ||
backlog = 4096 | ||
|
||
{% if expose_image_locations -%} | ||
show_multiple_locations = {{ expose_image_locations }} | ||
show_image_direct_url = {{ expose_image_locations }} | ||
{% endif -%} | ||
|
||
{% if api_config_flags -%} | ||
{% for key, value in api_config_flags.items() -%} | ||
{{ key }} = {{ value }} | ||
{% endfor -%} | ||
{% endif -%} | ||
|
||
delayed_delete = False | ||
scrub_time = 43200 | ||
scrubber_datadir = /var/lib/glance/scrubber | ||
image_cache_dir = /var/lib/glance/image-cache/ | ||
db_enforce_mysql_charset = False | ||
|
||
{% if image_size_cap -%} | ||
image_size_cap = {{ image_size_cap }} | ||
{% endif -%} | ||
|
||
{% if enabled_backends %} | ||
enabled_backends = {{ enabled_backends }} | ||
{% endif %} | ||
|
||
[glance_store] | ||
{% if default_store_backend %} | ||
default_backend = {{ default_store_backend }} | ||
{% endif %} | ||
|
||
[image_format] | ||
disk_formats = {{ disk_formats }} | ||
{% if container_formats -%} | ||
container_formats = {{ container_formats }} | ||
{% endif -%} | ||
|
||
{% include "section-keystone-authtoken-v3only" %} | ||
|
||
{% if auth_host -%} | ||
[paste_deploy] | ||
flavor = keystone | ||
config_file = /etc/glance/api-paste.ini | ||
{% endif %} | ||
|
||
[barbican] | ||
auth_endpoint = {{ service_protocol }}://{{ service_host }}:{{ service_port }}/v3 | ||
|
||
{% include "parts/section-database" %} | ||
|
||
{% include "section-oslo-messaging-rabbit" %} | ||
|
||
{% include "section-oslo-notifications" %} | ||
|
||
{% include "section-oslo-middleware" %} | ||
|
||
{% include "parts/section-storage" %} | ||
|
||
{% for name, cfg in enabled_backend_configs.items() %} | ||
[{{name}}] | ||
{% for key, val in cfg.items() -%} | ||
{{ key }} = {{ val }} | ||
{% endfor -%} | ||
{% endfor%} | ||
|
||
{% include "parts/section-image-import" %} | ||
|
||
{% include "section-audit-middleware-notifications" %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters