httpd_configmap_generator 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +1 -0
- data/.travis.yml +14 -0
- data/Dockerfile +16 -0
- data/Gemfile +4 -0
- data/LICENSE +201 -0
- data/README-active-directory.md +38 -0
- data/README-ipa.md +41 -0
- data/README-saml.md +70 -0
- data/README.md +386 -0
- data/Rakefile +8 -0
- data/bin/httpd_configmap_generator +101 -0
- data/httpd_configmap_generator.gemspec +34 -0
- data/lib/httpd_configmap_generator.rb +29 -0
- data/lib/httpd_configmap_generator/active_directory.rb +114 -0
- data/lib/httpd_configmap_generator/base.rb +83 -0
- data/lib/httpd_configmap_generator/base/command.rb +29 -0
- data/lib/httpd_configmap_generator/base/config.rb +13 -0
- data/lib/httpd_configmap_generator/base/config_map.rb +183 -0
- data/lib/httpd_configmap_generator/base/file.rb +66 -0
- data/lib/httpd_configmap_generator/base/kerberos.rb +13 -0
- data/lib/httpd_configmap_generator/base/network.rb +37 -0
- data/lib/httpd_configmap_generator/base/pam.rb +9 -0
- data/lib/httpd_configmap_generator/base/principal.rb +33 -0
- data/lib/httpd_configmap_generator/base/sssd.rb +51 -0
- data/lib/httpd_configmap_generator/export.rb +31 -0
- data/lib/httpd_configmap_generator/ipa.rb +122 -0
- data/lib/httpd_configmap_generator/options.rb +13 -0
- data/lib/httpd_configmap_generator/saml.rb +104 -0
- data/lib/httpd_configmap_generator/update.rb +39 -0
- data/lib/httpd_configmap_generator/version.rb +3 -0
- data/templates/etc/pam.d/httpd-auth +2 -0
- data/templates/httpd-configmap-generator-template.yaml +113 -0
- metadata +203 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f02888b03610f25e11d9d82ef0b3d4e7f32d23dc
|
4
|
+
data.tar.gz: 715398b32432b9e0880df06bd5212f59614769bd
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ecfd0afeede3a311f59c536cf5f72ff70b65e3f29f204034f03d733279bbfe0824abadf676d46d5a794b8a04e8bd24373037dfb46e8714a7f5c6ee30de2b940c
|
7
|
+
data.tar.gz: 73704e1d3a209c3b7d325b4cf683913d8c0b4db293d5c2e73f1fe78124306cafb31ff5ab31a954f342f95a97356731277ed560a3dd7fbfa68426ed68ae734f76
|
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--require spec_helper
|
data/.travis.yml
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
language: ruby
|
2
|
+
rvm:
|
3
|
+
- '2.3.5'
|
4
|
+
- '2.4.2'
|
5
|
+
sudo: false
|
6
|
+
cache: bundler
|
7
|
+
after_script: bundle exec codeclimate-test-reporter
|
8
|
+
notifications:
|
9
|
+
webhooks:
|
10
|
+
urls:
|
11
|
+
- https://webhooks.gitter.im/e/0357efbc3cba43430d2b
|
12
|
+
on_success: change
|
13
|
+
on_failure: always
|
14
|
+
on_start: never
|
data/Dockerfile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
FROM manageiq/httpd:latest
|
2
|
+
MAINTAINER ManageIQ https://github.com/ManageIQ
|
3
|
+
|
4
|
+
LABEL name="httpd-configmap-generator" \
|
5
|
+
summary="httpd image for configuring external authentication" \
|
6
|
+
description="An httpd image which can configure external authentication and generate the auth-config map" \
|
7
|
+
io.k8s.display-name="Httpd with Authentication Configuration" \
|
8
|
+
io.k8s.description="An httpd image which can configure external authentication and generate the auth-config map"
|
9
|
+
|
10
|
+
ENV HTTPD_AUTH_TYPE=internal \
|
11
|
+
HTTPD_AUTH_KERBEROS_REALMS=undefined \
|
12
|
+
TERM=xterm
|
13
|
+
|
14
|
+
RUN yum -y install openldap-clients pamtester
|
15
|
+
|
16
|
+
RUN gem install --no-ri --no-rdoc --no-document httpd_configmap_generator
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,201 @@
|
|
1
|
+
Apache License
|
2
|
+
Version 2.0, January 2004
|
3
|
+
http://www.apache.org/licenses/
|
4
|
+
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6
|
+
|
7
|
+
1. Definitions.
|
8
|
+
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
11
|
+
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
13
|
+
the copyright owner that is granting the License.
|
14
|
+
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
16
|
+
other entities that control, are controlled by, or are under common
|
17
|
+
control with that entity. For the purposes of this definition,
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
19
|
+
direction or management of such entity, whether by contract or
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
+
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
24
|
+
exercising permissions granted by this License.
|
25
|
+
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
27
|
+
including but not limited to software source code, documentation
|
28
|
+
source, and configuration files.
|
29
|
+
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
31
|
+
transformation or translation of a Source form, including but
|
32
|
+
not limited to compiled object code, generated documentation,
|
33
|
+
and conversions to other media types.
|
34
|
+
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
36
|
+
Object form, made available under the License, as indicated by a
|
37
|
+
copyright notice that is included in or attached to the work
|
38
|
+
(an example is provided in the Appendix below).
|
39
|
+
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
46
|
+
the Work and Derivative Works thereof.
|
47
|
+
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
49
|
+
the original version of the Work and any modifications or additions
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
61
|
+
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
64
|
+
subsequently incorporated within the Work.
|
65
|
+
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
72
|
+
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78
|
+
where such license applies only to those patent claims licensable
|
79
|
+
by such Contributor that are necessarily infringed by their
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
82
|
+
institute patent litigation against any entity (including a
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
85
|
+
or contributory patent infringement, then any patent licenses
|
86
|
+
granted to You under this License for that Work shall terminate
|
87
|
+
as of the date such litigation is filed.
|
88
|
+
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
91
|
+
modifications, and in Source or Object form, provided that You
|
92
|
+
meet the following conditions:
|
93
|
+
|
94
|
+
(a) You must give any other recipients of the Work or
|
95
|
+
Derivative Works a copy of this License; and
|
96
|
+
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
98
|
+
stating that You changed the files; and
|
99
|
+
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
102
|
+
attribution notices from the Source form of the Work,
|
103
|
+
excluding those notices that do not pertain to any part of
|
104
|
+
the Derivative Works; and
|
105
|
+
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
108
|
+
include a readable copy of the attribution notices contained
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
111
|
+
of the following places: within a NOTICE text file distributed
|
112
|
+
as part of the Derivative Works; within the Source form or
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
114
|
+
within a display generated by the Derivative Works, if and
|
115
|
+
wherever such third-party notices normally appear. The contents
|
116
|
+
of the NOTICE file are for informational purposes only and
|
117
|
+
do not modify the License. You may add Your own attribution
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
120
|
+
that such additional attribution notices cannot be construed
|
121
|
+
as modifying the License.
|
122
|
+
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
124
|
+
may provide additional or different license terms and conditions
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
128
|
+
the conditions stated in this License.
|
129
|
+
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
133
|
+
this License, without any additional terms or conditions.
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
135
|
+
the terms of any separate license agreement you may have executed
|
136
|
+
with Licensor regarding such Contributions.
|
137
|
+
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
140
|
+
except as required for reasonable and customary use in describing the
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
142
|
+
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
152
|
+
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
158
|
+
incidental, or consequential damages of any character arising as a
|
159
|
+
result of this License or out of the use or inability to use the
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
162
|
+
other commercial damages or losses), even if such Contributor
|
163
|
+
has been advised of the possibility of such damages.
|
164
|
+
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
168
|
+
or other liability obligations and/or rights consistent with this
|
169
|
+
License. However, in accepting such obligations, You may act only
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
174
|
+
of your accepting any such warranty or additional liability.
|
175
|
+
|
176
|
+
END OF TERMS AND CONDITIONS
|
177
|
+
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
179
|
+
|
180
|
+
To apply the Apache License to your work, attach the following
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "{}"
|
182
|
+
replaced with your own identifying information. (Don't include
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
184
|
+
comment syntax for the file format. We also recommend that a
|
185
|
+
file or class name and description of purpose be included on the
|
186
|
+
same "printed page" as the copyright notice for easier
|
187
|
+
identification within third-party archives.
|
188
|
+
|
189
|
+
Copyright {yyyy} {name of copyright owner}
|
190
|
+
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
192
|
+
you may not use this file except in compliance with the License.
|
193
|
+
You may obtain a copy of the License at
|
194
|
+
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
196
|
+
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200
|
+
See the License for the specific language governing permissions and
|
201
|
+
limitations under the License.
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# Httpd Configmap Generator - Active Directory
|
2
|
+
|
3
|
+
This documents how to run the httpd\_configmap\_generator tool to configure external authentication
|
4
|
+
by joining an Active Directory domain.
|
5
|
+
|
6
|
+
|
7
|
+
## Usage for the `active-directory` auth-type:
|
8
|
+
|
9
|
+
```
|
10
|
+
$ httpd_configmap_generator active-directory --help
|
11
|
+
httpd_configmap_generator 0.1.0 - External Authentication Configuration script
|
12
|
+
|
13
|
+
Usage: httpd_configmap_generator auth_type | update | export [--help | options]
|
14
|
+
|
15
|
+
httpd_configmap_generator options are:
|
16
|
+
-V, --version Version of the httpd_configmap_generator command
|
17
|
+
-h, --host=<s> Application Domain (default: )
|
18
|
+
-o, --output=<s> Configuration map file to create (default: )
|
19
|
+
-a, --ad-domain=<s> Active Directory Domain (default: )
|
20
|
+
-u, --ad-server=<s> Active Directory User (default: )
|
21
|
+
-p, --ad-password=<s> Active Directory Password (default: )
|
22
|
+
-f, --force Force configuration if configured already
|
23
|
+
-d, --debug Enable debugging
|
24
|
+
-r, --ad-realm=<s> Active Directory Realm (default: )
|
25
|
+
-e, --help Show this message
|
26
|
+
```
|
27
|
+
|
28
|
+
### Example:
|
29
|
+
|
30
|
+
```
|
31
|
+
$ httpd_configmap_generator active-directory \
|
32
|
+
--host=application.example.com \
|
33
|
+
--ad-domain=example.com \
|
34
|
+
--ad-realm=EXAMPLE.COM \
|
35
|
+
--ad-user=Administrator \
|
36
|
+
--ad-password=smartvm \
|
37
|
+
-o /tmp/external-active-directory.yaml
|
38
|
+
```
|
data/README-ipa.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# Httpd Configmap Generator - IPA
|
2
|
+
|
3
|
+
This documents how to run the httpd\_configmap\_generator tool to configure external authentication
|
4
|
+
for an IPA server.
|
5
|
+
|
6
|
+
|
7
|
+
## Usage for the `ipa` auth-type:
|
8
|
+
|
9
|
+
```
|
10
|
+
$ httpd_configmap_generator ipa --help
|
11
|
+
httpd_configmap_generator 0.1.0 - External Authentication Configuration script
|
12
|
+
|
13
|
+
Usage: httpd_configmap_generator auth_type | update | export [--help | options]
|
14
|
+
|
15
|
+
httpd_configmap_generator options are:
|
16
|
+
-V, --version Version of the httpd_configmap_generator command
|
17
|
+
-h, --host=<s> Application Domain (default: )
|
18
|
+
-o, --output=<s> Configuration map file to create (default: )
|
19
|
+
-i, --ipa-server=<s> IPA Server Fqdn (default: )
|
20
|
+
-p, --ipa-password=<s> IPA Server Password (default: )
|
21
|
+
-f, --force Force configuration if configured already
|
22
|
+
-d, --debug Enable debugging
|
23
|
+
-a, --ipa-principal=<s> IPA Server Principal (default: admin)
|
24
|
+
-m, --ipa-domain=<s> Domain of IPA Server (default: )
|
25
|
+
-r, --ipa-realm=<s> Realm of IPA Server (default: )
|
26
|
+
-e, --help Show this message
|
27
|
+
```
|
28
|
+
|
29
|
+
### Example:
|
30
|
+
|
31
|
+
```
|
32
|
+
$ httpd_configmap_generator ipa \
|
33
|
+
--force \
|
34
|
+
--host=application.example.com \
|
35
|
+
--ipa-server=ipaserver7.example.com \
|
36
|
+
--ipa-domain=example.com \
|
37
|
+
--ipa-realm=EXAMPLE.COM \
|
38
|
+
--ipa-principal=admin \
|
39
|
+
--ipa-password=smartvm \
|
40
|
+
-o /tmp/external-ipa.yaml
|
41
|
+
```
|
data/README-saml.md
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
# Httpd Configmap Generator - SAML
|
2
|
+
|
3
|
+
This documents how to run the httpd\_configmap\_generator tool to configure the container against a SAML identity provider.
|
4
|
+
|
5
|
+
## Usage for the `saml` auth-type:
|
6
|
+
|
7
|
+
```
|
8
|
+
$ httpd_configmap_generator saml --help
|
9
|
+
httpd_configmap_generator 0.1.0 - External Authentication Configuration script
|
10
|
+
|
11
|
+
Usage: httpd_configmap_generator auth_type | update | export [--help | options]
|
12
|
+
|
13
|
+
httpd_configmap_generator options are:
|
14
|
+
-V, --version Version of the httpd_configmap_generator command
|
15
|
+
-h, --host=<s> Application Domain (default: )
|
16
|
+
-o, --output=<s> Configuration map file to create (default: )
|
17
|
+
-f, --force Force configuration if configured already
|
18
|
+
-d, --debug Enable debugging
|
19
|
+
-k, --keycloak-add-metadata Download and add the Keycloak metadata file
|
20
|
+
-e, --keycloak-server=<s> Keycloak Server Fqdn or IP (default: )
|
21
|
+
-y, --keycloak-realm=<s> Keycloak Realm for this client (default: )
|
22
|
+
-l, --help Show this message
|
23
|
+
```
|
24
|
+
|
25
|
+
### Examples:
|
26
|
+
|
27
|
+
Creates the mellon metadata files and certificate for the container:
|
28
|
+
|
29
|
+
```
|
30
|
+
$ httpd_configmap_generator saml \
|
31
|
+
--force \
|
32
|
+
--host=application.example.com \
|
33
|
+
--debug \
|
34
|
+
-o /tmp/external-saml.yaml
|
35
|
+
```
|
36
|
+
|
37
|
+
With the above, the IdP metadata file still needs to be fetched from the SAML Identity Provider and added to the configmap.
|
38
|
+
|
39
|
+
For keycloak, this can be done with the following command:
|
40
|
+
|
41
|
+
```
|
42
|
+
$ httpd_configmap_generator update \
|
43
|
+
--input=/tmp/external-saml.yaml \
|
44
|
+
--add-file=http://keycloak-server.example.com:8080/auth/realms/testrealm/protocol/saml/descriptor,/etc/httpd/saml2/idp-metadata.xml,644:root:root \
|
45
|
+
--output=/tmp/external-saml-keycloak.yaml
|
46
|
+
```
|
47
|
+
|
48
|
+
_Note_: If the Realm is already created on the Keycloak server, the following example initializes the mellon metadata files and certificates as well as downloads the IdP metadata file from Keycloak in a single command:
|
49
|
+
|
50
|
+
```
|
51
|
+
$ httpd_configmap_generator saml \
|
52
|
+
--force \
|
53
|
+
--host=application.example.com \
|
54
|
+
--keycloak-add-metadata \
|
55
|
+
--keycloak-server=keycloak-server.example.com \
|
56
|
+
--keycloak-realm=testrealm \
|
57
|
+
--debug \
|
58
|
+
-o /tmp/external-saml.yaml
|
59
|
+
```
|
60
|
+
|
61
|
+
In the above example, the auth configmap file would include the following files:
|
62
|
+
|
63
|
+
* /etc/httpd/saml2/
|
64
|
+
- miqsp-metadata.xml
|
65
|
+
- miqsp-cert.cert
|
66
|
+
- miqsp-key.key
|
67
|
+
- idp-metadata.xml
|
68
|
+
|
69
|
+
For Keycloak, the `miqsp-metadata.xml` file can be imported to create the Client ID for
|
70
|
+
the `application.example.com` application domain.
|
data/README.md
ADDED
@@ -0,0 +1,386 @@
|
|
1
|
+
# Httpd Configmap Generator
|
2
|
+
|
3
|
+
[](http://badge.fury.io/rb/httpd_configmap_generator)
|
4
|
+
[](https://travis-ci.org/ManageIQ/httpd_configmap_generator)
|
5
|
+
[](https://codeclimate.com/github/ManageIQ/httpd_configmap_generator)
|
6
|
+
[](https://codeclimate.com/github/ManageIQ/httpd_configmap_generator/coverage)
|
7
|
+
[](https://gemnasium.com/ManageIQ/httpd_configmap_generator)
|
8
|
+
[](https://hakiri.io/github/ManageIQ/httpd_configmap_generator/master)
|
9
|
+
|
10
|
+
[](https://gitter.im/ManageIQ/authentication?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
11
|
+
|
12
|
+
This GEM provides a CLI to automate the generation of auth-config maps
|
13
|
+
which can be used with the httpd auth pod for enabling external authentication.
|
14
|
+
|
15
|
+
Install as follows:
|
16
|
+
|
17
|
+
```
|
18
|
+
gem install httpd_configmap_generator
|
19
|
+
```
|
20
|
+
|
21
|
+
## Running the tool
|
22
|
+
|
23
|
+
Generating an auth-config map can be done by running the httpd\_configmap\_generator tool
|
24
|
+
|
25
|
+
```
|
26
|
+
$ httpd_configmap_generator
|
27
|
+
|
28
|
+
Usage: httpd_configmap_generator auth_type | update | export [--help | options]
|
29
|
+
Supported auth_type: active-directory, ipa, saml
|
30
|
+
```
|
31
|
+
|
32
|
+
Showing the usage for each authentication type or sub-command as follows:
|
33
|
+
|
34
|
+
```
|
35
|
+
$ httpd_configmap_generator ipa --help
|
36
|
+
```
|
37
|
+
|
38
|
+
## Supported Authentication Types
|
39
|
+
|
40
|
+
|auth-type | Identity Provider/Environment | for usage: |
|
41
|
+
|------------------|------------------------------------------------|------------|
|
42
|
+
| active-directory | Active Directory domain realm join | [README-active-directory](README-active-directory.md) |
|
43
|
+
| ipa | IPA, IPA 2-factor authentication, IPA/AD Trust | [README-ipa](README-ipa.md) |
|
44
|
+
| saml | Keycloak, etc. | [README-saml](README-saml.md) |
|
45
|
+
|
46
|
+
___
|
47
|
+
|
48
|
+
## Updating an auth configuration map:
|
49
|
+
|
50
|
+
With the `update` subcommand, it is possible to add file(s) to the configuration
|
51
|
+
map as per the following usage:
|
52
|
+
|
53
|
+
|
54
|
+
```
|
55
|
+
$ httpd_configmap_generator update --help
|
56
|
+
httpd_configmap_generator 0.1.0 - External Authentication Configuration script
|
57
|
+
|
58
|
+
Usage: httpd_configmap_generator auth_type | update | export [--help | options]
|
59
|
+
|
60
|
+
httpd_configmap_generator options are:
|
61
|
+
-V, --version Version of the httpd_configmap_generator command
|
62
|
+
-i, --input=<s> Input config map file (default: )
|
63
|
+
-o, --output=<s> Output config map file (default: )
|
64
|
+
-f, --force Force configuration if configured already
|
65
|
+
-d, --debug Enable debugging
|
66
|
+
-a, --add-file=<s> Add file to config map (default: )
|
67
|
+
-h, --help Show this message
|
68
|
+
```
|
69
|
+
|
70
|
+
The `--add-file` option can be specified multiple times, one per file to add
|
71
|
+
to a configuration map.
|
72
|
+
|
73
|
+
Supported file specification for the `--add-file` option are:
|
74
|
+
|
75
|
+
```
|
76
|
+
--add-file=file-path
|
77
|
+
--add-file=source-file-path,target-file-path
|
78
|
+
--add-file=source-file-path,target-file-path,file-permission
|
79
|
+
--add-file=file-url,target-file-path,file-permission
|
80
|
+
```
|
81
|
+
|
82
|
+
Where:
|
83
|
+
|
84
|
+
* file-url is an http URL
|
85
|
+
* file-permission can be specified as: `mode:owner:group`
|
86
|
+
|
87
|
+
Examples:
|
88
|
+
|
89
|
+
### Adding files by specifying paths:
|
90
|
+
|
91
|
+
The file ownership and permissions will be based on the files specified.
|
92
|
+
|
93
|
+
```
|
94
|
+
$ httpd_configmap_generator update \
|
95
|
+
--input=/tmp/original-auth-configmap.yaml \
|
96
|
+
--add-file=/etc/openldap/cacerts/primary-directory-cert.pem \
|
97
|
+
--add-file=/etc/openldap/cacerts/seconday-directory-cert.pem \
|
98
|
+
--output=/tmp/updated-auth-configmap.yaml
|
99
|
+
```
|
100
|
+
|
101
|
+
### Adding target files from different source directories:
|
102
|
+
|
103
|
+
|
104
|
+
```
|
105
|
+
$ httpd_configmap_generator update \
|
106
|
+
--input=/tmp/original-auth-configmap.yaml \
|
107
|
+
--add-file=/tmp/uploaded-cert1,/etc/openldap/cacerts/primary-directory-cert.pem \
|
108
|
+
--add-file=/tmp/uploaded-cert2,/etc/openldap/cacerts/seconday-directory-cert.pem \
|
109
|
+
--output=/tmp/updated-auth-configmap.yaml
|
110
|
+
```
|
111
|
+
|
112
|
+
The file ownership and permissions will be based on the source files specified,
|
113
|
+
in this case the ownership and permissiong of the `/tmp/uploaded-cert1`
|
114
|
+
and `/tmp/uploaded-cert2` files will be used.
|
115
|
+
|
116
|
+
### Adding a target file with user specified ownership and mode:
|
117
|
+
|
118
|
+
```
|
119
|
+
$ httpd_configmap_generator update \
|
120
|
+
--input=/tmp/original-auth-configmap.yaml \
|
121
|
+
--add-file=/tmp/secondary-keytab,/etc/http2.keytab,600:apache:root \
|
122
|
+
--output=/tmp/updated-auth-configmap.yaml
|
123
|
+
```
|
124
|
+
|
125
|
+
### Adding files by URL:
|
126
|
+
|
127
|
+
```
|
128
|
+
$ httpd_configmap_generator update \
|
129
|
+
--input=/tmp/original-auth-configmap.yaml \
|
130
|
+
--add-file=http://aab-keycloak:8080/auth/realms/miq/protocol/saml/description,/etc/httpd/saml2/idp-metadata.xml,644:root:root \
|
131
|
+
--output=/tmp/updated-auth-configmap.yaml
|
132
|
+
```
|
133
|
+
|
134
|
+
When downloading a file by URL, a target file path and file ownership/mode must be specified.
|
135
|
+
|
136
|
+
___
|
137
|
+
|
138
|
+
## Exporting a file from an auth configuration map
|
139
|
+
|
140
|
+
With the `export` subcommand, it is possible to export a file from the configuration
|
141
|
+
map as per the following usage:
|
142
|
+
|
143
|
+
|
144
|
+
```
|
145
|
+
$ httpd_configmap_generator export --help
|
146
|
+
httpd_configmap_generator 0.1.0 - External Authentication Configuration script
|
147
|
+
|
148
|
+
Usage: httpd_configmap_generator auth_type | update | export [--help | options]
|
149
|
+
|
150
|
+
httpd_configmap_generator options are:
|
151
|
+
-V, --version Version of the httpd_configmap_generator command
|
152
|
+
-i, --input=<s> Input config map file (default: )
|
153
|
+
-l, --file=<s> Config map file to export (default: )
|
154
|
+
-o, --output=<s> The output file being exported (default: )
|
155
|
+
-f, --force Force configuration if configured already
|
156
|
+
-d, --debug Enable debugging
|
157
|
+
-h, --help Show this message
|
158
|
+
```
|
159
|
+
|
160
|
+
Example:
|
161
|
+
|
162
|
+
Extract the sssd.conf file out of the auth configuration map:
|
163
|
+
|
164
|
+
```
|
165
|
+
$ httpd_configmap_generator export \
|
166
|
+
--input=/tmp/external-ipa.yaml \
|
167
|
+
--file=/etc/sssd/sssd.conf \
|
168
|
+
--output=/tmp/sssd.conf
|
169
|
+
```
|
170
|
+
|
171
|
+
# Building the Httpd Configmap Generator in a Container
|
172
|
+
|
173
|
+
Container for configuring external authentication for the httpd auth pod.
|
174
|
+
It is based on the auth httpd container and generates the httpd auth-config map
|
175
|
+
needed to enable external authentication.
|
176
|
+
|
177
|
+
## Installing
|
178
|
+
|
179
|
+
```
|
180
|
+
$ git clone https://github.com/ManageIQ/httpd_configmap_generator.git
|
181
|
+
```
|
182
|
+
|
183
|
+
___
|
184
|
+
|
185
|
+
## Running with Docker
|
186
|
+
|
187
|
+
### Building container image
|
188
|
+
|
189
|
+
```
|
190
|
+
$ cd httpd_configmap_generator
|
191
|
+
$ docker build . -t manageiq/httpd_configmap_generator:latest
|
192
|
+
```
|
193
|
+
|
194
|
+
### Running the httpd\_configmap\_generator container
|
195
|
+
|
196
|
+
|
197
|
+
```
|
198
|
+
$ docker run --privileged manageiq/httpd_configmap_generator:latest &
|
199
|
+
```
|
200
|
+
|
201
|
+
Getting the httpd_configmap_generator container id:
|
202
|
+
|
203
|
+
```
|
204
|
+
$ CONFIGMAP_GENERATOR_ID="`docker ps -l -q`"
|
205
|
+
```
|
206
|
+
|
207
|
+
### Generating a configmap for external authentication against IPA
|
208
|
+
|
209
|
+
While the httpd_configmap_generator tool can be run in the container by first getting into a bash shell:
|
210
|
+
|
211
|
+
```
|
212
|
+
$ docker exec -it $CONFIGMAP_GENERATOR_ID /bin/bash -i
|
213
|
+
```
|
214
|
+
|
215
|
+
The tool can also be executed directly as follows:
|
216
|
+
|
217
|
+
Example for generating a configuration map for IPA:
|
218
|
+
|
219
|
+
```
|
220
|
+
$ docker exec $CONFIGMAP_GENERATOR_ID httpd_configmap_generator ipa \
|
221
|
+
--host=miq-appliance.example.com \
|
222
|
+
--ipa-server=ipaserver.example.com \
|
223
|
+
--ipa-domain=example.com \
|
224
|
+
--ipa-realm=EXAMPLE.COM \
|
225
|
+
--ipa-principal=admin \
|
226
|
+
--ipa-password=smartvm1 \
|
227
|
+
-o /tmp/external-ipa.yaml
|
228
|
+
```
|
229
|
+
|
230
|
+
`--host` above must be the DNS of the application exposing the httpd auth pod,
|
231
|
+
|
232
|
+
i.e. ${APPLICATION_DOMAIN}
|
233
|
+
|
234
|
+
|
235
|
+
Copying the new auth configmap back locally:
|
236
|
+
|
237
|
+
```
|
238
|
+
$ docker cp $CONFIGMAP_GENERATOR_ID:/tmp/external-ipa.yaml ./external-ipa.yaml
|
239
|
+
```
|
240
|
+
|
241
|
+
The new configmap can then be applied to the auth httpd pod and then redeployed to take effect:
|
242
|
+
|
243
|
+
```
|
244
|
+
$ oc replace configmaps httpd-auth-configs --filename ./external-ipa.yaml
|
245
|
+
```
|
246
|
+
|
247
|
+
#### Stopping the httpd\_configmap\_generator container
|
248
|
+
|
249
|
+
When completed with httpd\_configmap\_generator, the container can simply be stopped and/or removed:
|
250
|
+
|
251
|
+
```
|
252
|
+
$ docker stop $CONFIGMAP_GENERATOR_ID
|
253
|
+
```
|
254
|
+
|
255
|
+
```
|
256
|
+
$ docker rmi --force manageiq/httpd_configmap_generator:latest
|
257
|
+
```
|
258
|
+
|
259
|
+
___
|
260
|
+
|
261
|
+
|
262
|
+
## Running with OpenShift
|
263
|
+
|
264
|
+
### Pre-deployment tasks
|
265
|
+
|
266
|
+
#### If running without OCI systemd hooks (Minishift)
|
267
|
+
|
268
|
+
The httpd-configmap-generator service account must be added to the miq-sysadmin SCC before the Httpd Auth Config pod can run.
|
269
|
+
|
270
|
+
##### As Admin
|
271
|
+
|
272
|
+
```
|
273
|
+
$ oc adm policy add-scc-to-user miq-sysadmin system:serviceaccount:<your-namespace>:httpd-configmap-generator
|
274
|
+
```
|
275
|
+
|
276
|
+
Verify that the httpd-configmap-generator service account is now included in the miq-sysadmin SCC:
|
277
|
+
|
278
|
+
```
|
279
|
+
$ oc describe scc miq-sysadmin | grep Users
|
280
|
+
Users: system:serviceaccount:<your-namespace>:httpd-configmap-generator
|
281
|
+
```
|
282
|
+
|
283
|
+
#### If running with OCI systemd hooks
|
284
|
+
|
285
|
+
##### As Admin
|
286
|
+
|
287
|
+
```
|
288
|
+
$ oc adm policy add-scc-to-user anyuid system:serviceaccount:<your-namespace>:httpd-configmap-generator
|
289
|
+
```
|
290
|
+
|
291
|
+
Verify that the httpd-configmap-generator service account is now included in the miq-sysadmin SCC:
|
292
|
+
|
293
|
+
```
|
294
|
+
$ oc describe scc anyuid | grep Users
|
295
|
+
Users: system:serviceaccount:<your-namespace>:httpd-configmap-generator
|
296
|
+
```
|
297
|
+
|
298
|
+
|
299
|
+
### Deploy the Httpd Configmap Generator Application
|
300
|
+
|
301
|
+
As basic user
|
302
|
+
|
303
|
+
```
|
304
|
+
$ oc create -f templates/httpd-configmap-generator-template.yaml
|
305
|
+
|
306
|
+
$ oc get templates
|
307
|
+
NAME DESCRIPTION PARAMETERS OBJECTS
|
308
|
+
httpd-configmap-generator Httpd Configmap Generator 6 (all set) 3
|
309
|
+
```
|
310
|
+
|
311
|
+
Deploy the Httpd Configmap Generator
|
312
|
+
|
313
|
+
```
|
314
|
+
$ oc new-app --template=httpd-configmap-generator
|
315
|
+
```
|
316
|
+
|
317
|
+
Check the readiness of the Httpd Configmap Generator
|
318
|
+
|
319
|
+
```
|
320
|
+
$ oc get pods
|
321
|
+
NAME READY STATUS RESTARTS AGE
|
322
|
+
httpd-configmap-generator-1-txc34 1/1 Running 0 1h
|
323
|
+
```
|
324
|
+
|
325
|
+
#### Getting the POD Name
|
326
|
+
|
327
|
+
For working with the httpd\_configmap\_generator script in the httpd-configmap-generator pod, it is necessary to
|
328
|
+
get the pod name reference below:
|
329
|
+
|
330
|
+
|
331
|
+
```
|
332
|
+
$ CONFIGMAP_GENERATOR_POD=`oc get pods | grep "httpd-configmap-generator" | cut -f1 -d" "`
|
333
|
+
```
|
334
|
+
|
335
|
+
|
336
|
+
### Generating a configmap for external authentication against IPA
|
337
|
+
|
338
|
+
```
|
339
|
+
$ oc rsh $CONFIGMAP_GENERATOR_POD httpd_configmap_generator ipa ...
|
340
|
+
```
|
341
|
+
|
342
|
+
Example configuration:
|
343
|
+
|
344
|
+
```
|
345
|
+
$ oc rsh $CONFIGMAP_GENERATOR_POD httpd_configmap_generator ipa \
|
346
|
+
--host=miq-appliance.example.com \
|
347
|
+
--ipa-server=ipaserver.example.com \
|
348
|
+
--ipa-domain=example.com \
|
349
|
+
--ipa-realm=EXAMPLE.COM \
|
350
|
+
--ipa-principal=admin \
|
351
|
+
--ipa-password=smartvm1 \
|
352
|
+
-o /tmp/external-ipa.yaml
|
353
|
+
```
|
354
|
+
|
355
|
+
`--host` above must be the DNS of the application exposing the httpd auth pod,
|
356
|
+
|
357
|
+
i.e. ${APPLICATION_DOMAIN}
|
358
|
+
|
359
|
+
|
360
|
+
Copying the new auth configmap back locally:
|
361
|
+
|
362
|
+
```
|
363
|
+
$ oc cp $CONFIGMAP_GENERATOR_POD:/tmp/external-ipa.yaml ./external-ipa.yaml
|
364
|
+
```
|
365
|
+
|
366
|
+
The new configmap can then be applied to the auth httpd pod and then redeployed to take effect:
|
367
|
+
|
368
|
+
```
|
369
|
+
$ oc replace configmaps httpd-auth-configs --filename ./external-ipa.yaml
|
370
|
+
```
|
371
|
+
|
372
|
+
To generate a new auth configuration map it is recommended to redeploy the httpd\_configmap\_generator
|
373
|
+
pod first to get a clean environment before running the httpd\_configmap\_generator tool.
|
374
|
+
|
375
|
+
When done generating an auth-configmap, the httpd\_configmap\_generator pod can simply be scaled down:
|
376
|
+
|
377
|
+
```
|
378
|
+
$ oc scale dc httpd-configmap-generator --replicas=0
|
379
|
+
```
|
380
|
+
|
381
|
+
or deleted if no longer needed:
|
382
|
+
|
383
|
+
```
|
384
|
+
$ oc delete all -l app=httpd-configmap-generator
|
385
|
+
$ oc delete pods -l app=httpd-configmap-generator
|
386
|
+
```
|