Skip to content

Commit

Permalink
add functionality for pun_pre_hook (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
johrstrom authored Jun 4, 2021
1 parent 883290f commit b6d99d6
Show file tree
Hide file tree
Showing 13 changed files with 114 additions and 4 deletions.
2 changes: 2 additions & 0 deletions defaults/main/ood_portal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ user_map_match: '.*'
# map_fail_uri: /register

pun_stage_cmd: "sudo {{ ood_base_dir }}/nginx_stage/sbin/nginx_stage"
# pun_pre_hook_root_cmd: null
# pun_pre_hook_exports: null

# node_uri: '/node'
# rnode_uri: '/rnode'
Expand Down
15 changes: 15 additions & 0 deletions molecule/default/fixtures/config/ood_portal.yml.custom.httpd
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,21 @@ pun_socket_root: "/var/run/ondemand-nginx"
# Default: 5 (only try 5 times)
pun_max_retries: 5

# The PUN pre hook command to execute as root
#
# Example:
# pun_pre_hook_root_cmd: '/opt/hpc-site/ood_pun_prehook'
# Default: null (do not run any PUN pre hook as root)
pun_pre_hook_root_cmd: '/opt/site/site_pre_hook'

# Comma separated list of environment variables to pass from the apache context
# into the PUN pre hook. Defaults to null so nothing is exported.
#
# Example:
# pun_pre_hook_exports: 'OIDC_ACCESS_TOKEN,OIDC_CLAIM_EMAIL'
# Default: null (pass nothing)
pun_pre_hook_exports: 'OIDC_ACCESS_TOKEN,OIDC_CLAIM_EMAIL'

#
# Support for OpenID Connect
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,21 @@ pun_socket_root: "/var/run/ondemand-nginx"
# Default: 5 (only try 5 times)
pun_max_retries: 5

# The PUN pre hook command to execute as root
#
# Example:
# pun_pre_hook_root_cmd: '/opt/hpc-site/ood_pun_prehook'
# Default: null (do not run any PUN pre hook as root)
pun_pre_hook_root_cmd: '/opt/site/site_pre_hook'

# Comma separated list of environment variables to pass from the apache context
# into the PUN pre hook. Defaults to null so nothing is exported.
#
# Example:
# pun_pre_hook_exports: 'OIDC_ACCESS_TOKEN,OIDC_CLAIM_EMAIL'
# Default: null (pass nothing)
pun_pre_hook_exports: 'OIDC_ACCESS_TOKEN,OIDC_CLAIM_EMAIL'

#
# Support for OpenID Connect
#
Expand Down
15 changes: 15 additions & 0 deletions molecule/default/fixtures/config/ood_portal.yml.default.httpd
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,21 @@ pun_socket_root: "/var/run/ondemand-nginx"
# Default: 5 (only try 5 times)
pun_max_retries: 5

# The PUN pre hook command to execute as root
#
# Example:
# pun_pre_hook_root_cmd: '/opt/hpc-site/ood_pun_prehook'
# Default: null (do not run any PUN pre hook as root)
# pun_pre_hook_root_cmd: null

# Comma separated list of environment variables to pass from the apache context
# into the PUN pre hook. Defaults to null so nothing is exported.
#
# Example:
# pun_pre_hook_exports: 'OIDC_ACCESS_TOKEN,OIDC_CLAIM_EMAIL'
# Default: null (pass nothing)
# pun_pre_hook_exports: null

#
# Support for OpenID Connect
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,21 @@ pun_socket_root: "/var/run/ondemand-nginx"
# Default: 5 (only try 5 times)
pun_max_retries: 5

# The PUN pre hook command to execute as root
#
# Example:
# pun_pre_hook_root_cmd: '/opt/hpc-site/ood_pun_prehook'
# Default: null (do not run any PUN pre hook as root)
# pun_pre_hook_root_cmd: null

# Comma separated list of environment variables to pass from the apache context
# into the PUN pre hook. Defaults to null so nothing is exported.
#
# Example:
# pun_pre_hook_exports: 'OIDC_ACCESS_TOKEN,OIDC_CLAIM_EMAIL'
# Default: null (pass nothing)
# pun_pre_hook_exports: null

#
# Support for OpenID Connect
#
Expand Down
2 changes: 2 additions & 0 deletions molecule/default/vars/portal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ httpd_access_log: 'custom_defined_access.log'
httpd_logformat: '"%O %h \"%{Referer}i\" \"%r\" %v \"%{User-Agent}i\" %{SSL_PROTOCOL}x %T %>s"'
security_csp_frame_ancestors: http://my.proxy.server.edu
security_strict_transport: true
pun_pre_hook_exports: 'OIDC_ACCESS_TOKEN,OIDC_CLAIM_EMAIL'
pun_pre_hook_root_cmd: '/opt/site/site_pre_hook'

ood_auth_openidc:
OIDCSessionMaxDuration: 28888
Expand Down
15 changes: 15 additions & 0 deletions molecule/src-build/fixtures/config/ood_portal.yml.apache2
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,21 @@ pun_socket_root: "/var/run/ondemand-nginx"
# Default: 5 (only try 5 times)
pun_max_retries: 5

# The PUN pre hook command to execute as root
#
# Example:
# pun_pre_hook_root_cmd: '/opt/hpc-site/ood_pun_prehook'
# Default: null (do not run any PUN pre hook as root)
# pun_pre_hook_root_cmd: null

# Comma separated list of environment variables to pass from the apache context
# into the PUN pre hook. Defaults to null so nothing is exported.
#
# Example:
# pun_pre_hook_exports: 'OIDC_ACCESS_TOKEN,OIDC_CLAIM_EMAIL'
# Default: null (pass nothing)
# pun_pre_hook_exports: null

#
# Support for OpenID Connect
#
Expand Down
5 changes: 4 additions & 1 deletion molecule/templates/fixtures/ood-portal.conf.custom.httpd
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@
#
SetEnv OOD_PUN_STAGE_CMD "sudo /opt/ood/nginx_stage/sbin/nginx_stage"


# Run a root level pre hook before starting nginx
SetEnv OOD_PUN_PRE_HOOK_ROOT_CMD "/opt/site/site_pre_hook"
# Environment variables to export to the PUN pre hook.
SetEnv OOD_PUN_PRE_HOOK_EXPORTS "OIDC_ACCESS_TOKEN,OIDC_CLAIM_EMAIL"

#
# Below is used for sub-uri's this Open OnDemand portal supports
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@
#
SetEnv OOD_PUN_STAGE_CMD "sudo /opt/ood/nginx_stage/sbin/nginx_stage"


# Run a root level pre hook before starting nginx
SetEnv OOD_PUN_PRE_HOOK_ROOT_CMD "/opt/site/site_pre_hook"
# Environment variables to export to the PUN pre hook.
SetEnv OOD_PUN_PRE_HOOK_EXPORTS "OIDC_ACCESS_TOKEN,OIDC_CLAIM_EMAIL"

#
# Below is used for sub-uri's this Open OnDemand portal supports
Expand Down
1 change: 0 additions & 1 deletion molecule/templates/fixtures/ood-portal.conf.default.httpd
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
SetEnv OOD_PUN_STAGE_CMD "sudo /opt/ood/nginx_stage/sbin/nginx_stage"



#
# Below is used for sub-uri's this Open OnDemand portal supports
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
SetEnv OOD_PUN_STAGE_CMD "sudo /opt/ood/nginx_stage/sbin/nginx_stage"



#
# Below is used for sub-uri's this Open OnDemand portal supports
#
Expand Down
8 changes: 8 additions & 0 deletions templates/ood-portal.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,14 @@ Listen {{ addr }}
#
SetEnv OOD_PUN_STAGE_CMD "{{ pun_stage_cmd }}"

{% if pun_pre_hook_root_cmd is defined %}
# Run a root level pre hook before starting nginx
SetEnv OOD_PUN_PRE_HOOK_ROOT_CMD "{{ pun_pre_hook_root_cmd }}"
{% if pun_pre_hook_exports is defined %}
# Environment variables to export to the PUN pre hook.
SetEnv OOD_PUN_PRE_HOOK_EXPORTS "{{ pun_pre_hook_exports }}"
{% endif %}
{%- endif -%}

{% if httpd_extra is defined %}
#
Expand Down
19 changes: 19 additions & 0 deletions templates/ood_portal.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,25 @@ pun_socket_root: "{{ pun_socket_root }}"
# Default: 5 (only try 5 times)
pun_max_retries: {{ pun_max_retries }}

# The PUN pre hook command to execute as root
#
# Example:
# pun_pre_hook_root_cmd: '/opt/hpc-site/ood_pun_prehook'
# Default: null (do not run any PUN pre hook as root)
{% if rnode_uri is defined %}pun_pre_hook_root_cmd: '{{ pun_pre_hook_root_cmd }}'
{% else %}# pun_pre_hook_root_cmd: null
{% endif %}

# Comma separated list of environment variables to pass from the apache context
# into the PUN pre hook. Defaults to null so nothing is exported.
#
# Example:
# pun_pre_hook_exports: 'OIDC_ACCESS_TOKEN,OIDC_CLAIM_EMAIL'
# Default: null (pass nothing)
{% if pun_pre_hook_exports is defined %}pun_pre_hook_exports: '{{ pun_pre_hook_exports }}'
{% else %}# pun_pre_hook_exports: null
{% endif %}

#
# Support for OpenID Connect
#
Expand Down

0 comments on commit b6d99d6

Please sign in to comment.