Skip to content

Commit

Permalink
Tidy up controller ssl.
Browse files Browse the repository at this point in the history
  • Loading branch information
cbickel committed Aug 15, 2018
1 parent 4d9c936 commit 53b4bed
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
22 changes: 10 additions & 12 deletions ansible/group_vars/all
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ limits:
firesPerMinute: "{{ limit_fires_per_minute | default(60) }}"
sequenceMaxLength: "{{ limit_sequence_max_length | default(50) }}"

# Moved here to avoid recursions. Please do not use outside of controller-dict.
__controller_ssl_keyPrefix: "controller-"

# port means outer port
controller:
dir:
Expand Down Expand Up @@ -83,24 +86,19 @@ controller:
loglevel: "{{ controller_loglevel | default(whisk_loglevel) | default('INFO') }}"
entitlement:
spi: "{{ controller_entitlement_spi | default('') }}"
protocol: "{{ controllerProtocolForSetup }}"
protocol: "{{ controller_protocol | default('https') }}"
ssl:
cn: openwhisk-controllers
cert: "{{ controller_ca_cert | default('controller-openwhisk-server-cert.pem') }}"
key: "{{ controller_key | default('controller-openwhisk-server-key.pem') }}"
clientAuth: "{{ controller_client_auth | default('true') }}"
keyPrefix: "{{ __controller_ssl_keyPrefix }}"
storeFlavor: PKCS12
clientAuth: "{{ controller_client_auth | default('true') }}"
cert: "controller-openwhisk-server-cert.pem"
key: "controller-openwhisk-server-key.pem"
keystore:
password: "{{ controllerKeystorePassword }}"
path: "/conf/{{ controllerKeystoreName }}"
password: "openwhisk"
name: "{{ __controller_ssl_keyPrefix }}openwhisk-keystore.p12"
extraEnv: "{{ controller_extraEnv | default({}) }}"

# move controller protocol outside to not evaluate controller variables during execution of setup.yml
controllerProtocolForSetup: "{{ controller_protocol | default('https') }}"
controllerKeystoreName: "{{ controllerKeyPrefix }}openwhisk-keystore.p12"
controllerKeyPrefix: "controller-"
controllerKeystorePassword: openwhisk

jmx:
basePortController: 15000
rmiBasePortController: 16000
Expand Down
4 changes: 2 additions & 2 deletions ansible/roles/controller/tasks/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
- name: copy nginx certificate keystore
when: controller.protocol == 'https'
copy:
src: files/{{ controllerKeystoreName }}
src: files/{{ controller.ssl.keystore.name }}
mode: 0666
dest: "{{ controller.confdir }}/{{ controller_name }}"
become: "{{ controller.dir.become }}"
Expand Down Expand Up @@ -206,7 +206,7 @@
"METRICS_LOG": "{{ metrics.log.enabled }}"
"CONFIG_whisk_controller_protocol": "{{ controller.protocol }}"
"CONFIG_whisk_controller_https_keystorePath":
"{{ controller.ssl.keystore.path }}"
"/conf/{{ controller.ssl.keystore.name }}"
"CONFIG_whisk_controller_https_keystorePassword":
"{{ controller.ssl.keystore.password }}"
"CONFIG_whisk_controller_https_keystoreFlavor":
Expand Down
8 changes: 5 additions & 3 deletions ansible/setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,20 @@
local_action: shell "{{ playbook_dir }}/files/genssl.sh" "openwhisk-kafka" "server_with_JKS_keystore" "{{ playbook_dir }}/roles/kafka/files" openwhisk "kafka-" "generateKey"
when: kafka_protocol_for_setup == 'SSL'

# Generate Controller certificates
- name: ensure controller files directory exists
file:
path: "{{ playbook_dir }}/roles/controller/files/"
state: directory
mode: 0777
become: "{{ logs.dir.become }}"
when: controllerProtocolForSetup == 'https'
when: controller.protocol == 'https'

- name: generate controller certificates
when: controllerProtocolForSetup == 'https'
local_action: shell "{{ playbook_dir }}/files/genssl.sh" "openwhisk-controllers" "server" "{{ playbook_dir }}/roles/controller/files" {{ controllerKeystorePassword }} {{ controllerKeyPrefix }} "generateKey"
when: controller.protocol == 'https'
local_action: shell "{{ playbook_dir }}/files/genssl.sh" "{{ controller.ssl.cn }}" "server" "{{ playbook_dir }}/roles/controller/files" {{ controller.ssl.keystore.password }} {{ controller.ssl.keyPrefix }} "generateKey"

# Generate Invoker certificates
- name: ensure invoker files directory exists
file:
path: "{{ playbook_dir }}/roles/invoker/files/"
Expand Down
2 changes: 1 addition & 1 deletion tests/src/test/resources/application.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ whisk {
protocol = {{ controller.protocol }}
https {
keystore-flavor = "{{ controller.ssl.storeFlavor }}"
keystore-path = "{{ openwhisk_home }}/ansible/roles/controller/files/{{ controllerKeystoreName }}"
keystore-path = "{{ openwhisk_home }}/ansible/roles/controller/files/{{ controller.ssl.keystore.name }}"
keystore-password = "{{ controller.ssl.keystore.password }}"
client-auth = "{{ controller.ssl.clientAuth }}"
}
Expand Down

0 comments on commit 53b4bed

Please sign in to comment.