├── .github
└── ISSUE_TEMPLATE
│ ├── bug_report.md
│ ├── feature_request.md
│ └── help-request.md
├── LICENSE
├── README.md
├── demo-resources
├── Guac 1 Source.gif
├── Guac 2 DB.gif
├── Guac 3 Passwords.gif
├── Guac 5 Nginx.gif
├── Guac 6_1 LDAP.gif
├── Guac 7 Cust Ext.gif
├── Guac Download and Run.gif
├── Guac_sum 1 DB.gif
├── Guac_sum 2 Passwords.gif
├── Guac_sum 3 Cert.gif
├── Guac_sum 4 Nginx.gif
├── Guac_sum 6 Cust Ext.gif
└── README.md
└── guac-install.sh
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: A bug is when something does not work the way it should
4 | title: "[BUG] "
5 | labels: bug
6 | assignees: Zer0CoolX
7 |
8 | ---
9 |
10 | **Confirmation of Process**
11 | 1. You have read the [How to report issues](https://github.com/Zer0CoolX/guacamole-install-rhel/wiki/How-to-Report-Issues-(Bugs,-Feature-Request-and-Help)) wiki page? Y/N
12 | 2. You have read the wiki and followed its guidelines including requirements, troubleshooting, etc.? Y/N
13 |
14 | **Details**
15 | OS/Version: RHEL 7.6
16 | Guacamole Source: Stable/Git?
17 | Any other options selected from the script prompts:
18 |
19 | **Describe the bug**
20 | A clear and concise description of what the bug is.
21 |
22 | **Error Message(s) and Logs (be sure not to include sensitive/personal information!)**
23 | If an error occurred include the exact message from the display/log.
24 |
25 | **To Reproduce**
26 | Steps to reproduce the behavior (example):
27 | 1. Go to '...'
28 | 2. Click on '....'
29 | 3. Scroll down to '....'
30 | 4. See error
31 |
32 | **Have You Found a Solution to the Issue?**
33 | Either by manually doing something before/after the script has run or by editing the script prior to running.
34 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: "[REQ] "
5 | labels: feature request
6 | assignees: Zer0CoolX
7 |
8 | ---
9 |
10 | **Confirmation of Process**
11 | 1. You have read the [How to report issues](https://github.com/Zer0CoolX/guacamole-install-rhel/wiki/How-to-Report-Issues-(Bugs,-Feature-Request-and-Help)) wiki page? Y/N
12 | 2. You have read the wiki, especially the To Do: [Planned and Desired Features](https://github.com/Zer0CoolX/guacamole-install-rhel/wiki/To-Do:-Planned-and-Desired-Features) page? Y/N
13 | 3. You have read other requests to ensure this feature has not already been requested? Y/N
14 |
15 | **In a sentence or 2, describe briefly what the idea is**
16 | IE: Adding a completion message that says "Complete!"
17 |
18 | **Is your feature request related to a problem?**
19 | Y/N
20 |
21 | **Describe the idea/feature you'd like**
22 | A clear and concise description of what you want to happen.
23 |
24 | **Any links, documentation or resource that would help implement this feature**
25 | The more resources you provide the better I can address if adding the feature is possible and how I can best do so.
26 |
27 | **Additional context**
28 | Add any other context or screenshots about the feature request here.
29 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/help-request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Help request
3 | about: Ask for help with running/using the script
4 | title: "[HELP] "
5 | labels: help
6 | assignees: Zer0CoolX
7 |
8 | ---
9 |
10 | **Confirmation of Process**
11 | 1. You have read the [How to report issues](https://github.com/Zer0CoolX/guacamole-install-rhel/wiki/How-to-Report-Issues-(Bugs,-Feature-Request-and-Help)) wiki page? Y/N
12 | 2. You read the [wiki](https://github.com/Zer0CoolX/guacamole-install-rhel/wiki), checking all pages for information that may help you? Y/N
13 | 3. You read other requests to ensure this question has not already been asked and/or resolved? Y/N
14 |
15 | **Details**
16 | OS/Version: RHEL 7.6
17 | Guacamole Source: Stable/Git?
18 | Any other options selected from the script prompts:
19 |
20 | **Error Message(s) and Logs (be sure not to include sensitive/personal information!)**
21 | If an error occurred include the exact message from the display/log.
22 |
23 | **Describe the Issue**
24 | A clear and concise description of what the problem is.
25 |
26 | **Additional context**
27 | Add any other context that could help understand your setup and issue.
28 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # NOTICE - Given Red Hat's decision to discontinue CentOS as we know it, especially cutting the life of CentOS 8 short, along with other personal reasons I am no longer going to maintain this script. One day, should a suitable RHEL binary compatible replacement emerge, I may resume work on this script but it is also possible I will not. Thanks
2 |
3 | # Apache Guacamole Install Script for RHEL 7 and CentOS 7
4 | The Guacamole install script `guac-install.sh` is intended to allow for a guided, simple way to install and configure a complete Apache Guacamole server on a fresh CentOS 7 or RHEL 7 installation. This Apache Guacamole installation script presents an interactive menu providing options to install Guacamole, Nginx, MariaDB and other software for a complete Guacamole setup. The menu provides the means to set configuration parameters in an organized way, allows for review and making changes prior to running the installation for Guacamole.
5 |
6 | The [wiki](https://github.com/Zer0CoolX/guacamole-install-rhel/wiki) will cover all aspects of the Apache Guacamole installation script for RHEL and CentOS in further detail. Before using the script read all the documentation and review the Guacamole install script (especially the variables). Test the Guacamole script in a test environment/server and ensure it functions exactly as desired before attempting to utilize it on a production system.
7 |
8 | Some of the main features and benefits of using this installation script for Apache Guacamole are:
9 | - Simplifies the process of installing Apache Guacamole and other software required for a complete implementation.
10 | - Use of Nginx as a reverse proxy allows for changing the URI, having SSL/HTTPS securely setup and forcing HTTPS among other benefits.
11 | - Nginx configuration options capable of scoring A+ and 90-100% on the categories of the Qualys SSL test. Will varying based on other options selected.
12 | - Nginx Content-Security-Policy (CSP) option to enable CSP. Scores A+, 100/100 on Mozilla Observatory test.
13 | - Ability to create a valid SSL certificate from LetsEncrypt AND keep it updated automatically. Also allows setting the key-size used by LetsEncrypt.
14 | - MariaDB is setup and configured as the database for user settings and metadata. MariaDB is the default primary authentication method.
15 | - MariaDB is also automatically hardened (by running mysql_secure_installation and automatically answering the prompts)
16 | - Ability to install and configure Guacamole extensions for primary and secondary authentication. (Currently limited to LDAP(s) and/or TOTP)
17 | - Ability to install a custom Guacamole extension, like my [Guacamole Customize Login Page extension](https://github.com/Zer0CoolX/guacamole-install-rhel/wiki/Customizing-the-Apache-Guacamole-Login-Screen) to change the appearance of the login page.
18 | - Optionally, LDAP/LDAPS as primary authentication via Guacamole LDAP extension and configuration prompts.
19 | - Optionally, TOTP as a 2FA method via Guacamole TOTP extension and configuration prompts.
20 | - All SELinux contexts properly set instead of disabling SEL.
21 | - Firewalld configured for Guacamole.
22 | - Script generates a log file of what it did for review.
23 | - Error handling covering the installation process. On error the line number, line that failed and exit code are displayed, logged and the script stops
24 | - And more...
25 |
26 | Further details see the [Script Features](https://github.com/Zer0CoolX/guacamole-install-rhel/wiki/Guacamole-Install-Script-Features) page.
27 |
28 | ## Requirements to Run the Guacamole Install Script Successfully
29 | - Install RHEL 7.x or CentOS 7.x and up using either minimal install or Server with GUI.
30 | - `wget` installed to download the Guacamole install script `guac-install.sh` from this repo.
31 | - The server must have internet access to download the script and files required by Apache Guacamole that are acquired and installed by this script.
32 | - Sudo or root access on the RHEL or CentOS server, script requires being run as sudo/root.
33 | - If using RHEL, an activated subscription for access to its repos.
34 | - **No prior Guacamole installation or configuration including for its major dependent packages like Nginx, Tomcat, mariaDB, etc. IE: if the script fails, you cannot simply re-run it! Also, this script cannot be used to update a previous Guacamole install!!**
35 | - SELinux must be enabled and in "Enforcing mode" or the script will not run.
36 |
37 | Full requirements listed on the [Requirements](https://github.com/Zer0CoolX/guacamole-install-rhel/wiki/Requirements) page
38 |
39 | ## "Required" Reading
40 | I recommend reading this entire README page AND the entire [Wiki](https://github.com/Zer0CoolX/guacamole-install-rhel/wiki) prior to attempting to use the Apache Guacamole installation script. It is essential to understand what the script does as you will be prompted to enter parameters during setup when running the script. It is important to be prepared to answer these prompts with accurate and desired parameters.
41 |
42 | Of special importance to starting with this Guacamole install script are:
43 | - [Warnings](https://github.com/Zer0CoolX/guacamole-install-rhel/wiki/Warnings)
44 | - [Logs & Error Handling](https://github.com/Zer0CoolX/guacamole-install-rhel/wiki/Logs-&-Error-Handling)
45 | - [Testing Procedure](https://github.com/Zer0CoolX/guacamole-install-rhel/wiki/Testing-Procedure)
46 | - [Troubleshooting](https://github.com/Zer0CoolX/guacamole-install-rhel/wiki/Troubleshooting)
47 | - [How to Report an Issue](https://github.com/Zer0CoolX/guacamole-install-rhel/wiki/How-to-Report-Issues-(Bugs,-Feature-Request-and-Help))
48 |
49 | ## Download/Run the Apache Guacamole Script for RHEL 7 and CentOS 7
50 | **WARNING: It is highly recommended to test this script in a dev environment prior to using it in a production setting!**
51 |
52 | Download the `guac-install.sh` script from this repo:
53 | ```
54 | wget https://raw.githubusercontent.com/Zer0CoolX/guacamole-install-rhel/master/guac-install.sh
55 | ```
56 | If installing a custom Guacamole extension, download it as well and take note of its file name and path. See [here](https://github.com/Zer0CoolX/guacamole-install-rhel/wiki/Customizing-the-Apache-Guacamole-Login-Screen) for more details
57 |
58 | Make the `guac-install.sh` script executable:
59 | ```
60 | chmod +x guac-install.sh
61 | ```
62 | Run the script as sudo/root:
63 | ```
64 | ./guac-install.sh
65 | ```
66 | Proceed with the prompts provided by the installer, see [Step-by-Step Installation Guide](https://github.com/Zer0CoolX/guacamole-install-rhel/wiki/Step-by-Step-Installation-Guide) for a walk-through of the options.
67 |
68 | ## Customizing the Apache Guacamole login screen
69 | See this wiki post regarding [Customizing the Apache Guacamole Login Screen](https://github.com/Zer0CoolX/guacamole-install-rhel/wiki/Customizing-the-Apache-Guacamole-Login-Screen) for details on another repo of mine to accomplish this.
70 |
71 | ## Apache Guacamole Install Script Information
72 | I have based this Apache Guacamole install script on multiple other projects and my own work with similar goals. There are too many sources to provide credit to.
73 |
74 | The script versioning, for now, will be based on the date of the last commit in the format "yyyy_mm_dd".
75 |
76 | I try and test the script as many ways as I can. Should you find an issue you feel is due to the script please submit an issue according to the directions [here](https://github.com/Zer0CoolX/guacamole-install-rhel/wiki/How-to-Report-Issues-(Bugs,-Feature-Request-and-Help)). I am also open to ideas on improving or fixing issues with the script. I am hoping that in time, after revisions and testing, that this install script for Guacamole will become the go-to for those looking to setup Guacamole on RHEL or CentOS.
77 |
78 | Thanks
79 |
80 | As expressed on the official site for [Apache Guacamole](https://guacamole.apache.org/) (which is free and open source):
81 | > Apache Guacamole is a clientless remote desktop gateway. It supports standard protocols like VNC, RDP, and SSH. We call it clientless because no plugins or client software are required.
82 |
83 | [Nginx](https://nginx.org/en/) is a free and open source HTTP and reverse proxy server.
84 |
85 | [MariaDB](https://mariadb.org/) is an open source database that is forked from MySQL.
86 |
87 | [Let's Encrypt](https://letsencrypt.org/) is a free, automated and open Certificate Authority providing SSL certificates to allow setting up more secure websites using HTTPS.
88 |
--------------------------------------------------------------------------------
/demo-resources/Guac 1 Source.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zer0CoolX/guacamole-install-rhel-7/f0da9e35276cbfde0868ff168e9bb7ee0051a13c/demo-resources/Guac 1 Source.gif
--------------------------------------------------------------------------------
/demo-resources/Guac 2 DB.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zer0CoolX/guacamole-install-rhel-7/f0da9e35276cbfde0868ff168e9bb7ee0051a13c/demo-resources/Guac 2 DB.gif
--------------------------------------------------------------------------------
/demo-resources/Guac 3 Passwords.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zer0CoolX/guacamole-install-rhel-7/f0da9e35276cbfde0868ff168e9bb7ee0051a13c/demo-resources/Guac 3 Passwords.gif
--------------------------------------------------------------------------------
/demo-resources/Guac 5 Nginx.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zer0CoolX/guacamole-install-rhel-7/f0da9e35276cbfde0868ff168e9bb7ee0051a13c/demo-resources/Guac 5 Nginx.gif
--------------------------------------------------------------------------------
/demo-resources/Guac 6_1 LDAP.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zer0CoolX/guacamole-install-rhel-7/f0da9e35276cbfde0868ff168e9bb7ee0051a13c/demo-resources/Guac 6_1 LDAP.gif
--------------------------------------------------------------------------------
/demo-resources/Guac 7 Cust Ext.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zer0CoolX/guacamole-install-rhel-7/f0da9e35276cbfde0868ff168e9bb7ee0051a13c/demo-resources/Guac 7 Cust Ext.gif
--------------------------------------------------------------------------------
/demo-resources/Guac Download and Run.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zer0CoolX/guacamole-install-rhel-7/f0da9e35276cbfde0868ff168e9bb7ee0051a13c/demo-resources/Guac Download and Run.gif
--------------------------------------------------------------------------------
/demo-resources/Guac_sum 1 DB.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zer0CoolX/guacamole-install-rhel-7/f0da9e35276cbfde0868ff168e9bb7ee0051a13c/demo-resources/Guac_sum 1 DB.gif
--------------------------------------------------------------------------------
/demo-resources/Guac_sum 2 Passwords.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zer0CoolX/guacamole-install-rhel-7/f0da9e35276cbfde0868ff168e9bb7ee0051a13c/demo-resources/Guac_sum 2 Passwords.gif
--------------------------------------------------------------------------------
/demo-resources/Guac_sum 3 Cert.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zer0CoolX/guacamole-install-rhel-7/f0da9e35276cbfde0868ff168e9bb7ee0051a13c/demo-resources/Guac_sum 3 Cert.gif
--------------------------------------------------------------------------------
/demo-resources/Guac_sum 4 Nginx.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zer0CoolX/guacamole-install-rhel-7/f0da9e35276cbfde0868ff168e9bb7ee0051a13c/demo-resources/Guac_sum 4 Nginx.gif
--------------------------------------------------------------------------------
/demo-resources/Guac_sum 6 Cust Ext.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zer0CoolX/guacamole-install-rhel-7/f0da9e35276cbfde0868ff168e9bb7ee0051a13c/demo-resources/Guac_sum 6 Cust Ext.gif
--------------------------------------------------------------------------------
/demo-resources/README.md:
--------------------------------------------------------------------------------
1 | Folder for resources used to demonstrate the Apache Guacamole install script in action such as gifs, screenshots, etc.
2 |
3 | None of the files in this directory are required to use or run the Apache Guacamole install script.
4 |
--------------------------------------------------------------------------------
/guac-install.sh:
--------------------------------------------------------------------------------
1 | #!/bin/env bash
2 | ###### NOTES #######################################################
3 | # Project Page: https://github.com/Zer0CoolX/guacamole-install-rhel-7
4 | # Licence (GPL-3.0): https://github.com/Zer0CoolX/guacamole-install-rhel-7/blob/master/LICENSE
5 | # Report Issues: https://github.com/Zer0CoolX/guacamole-install-rhel-7/wiki/How-to-Report-Issues-(Bugs,-Feature-Request-and-Help)
6 | # Wiki: https://github.com/Zer0CoolX/guacamole-install-rhel-7/wiki
7 | #
8 | # WARNING: For use on RHEL/CentOS 7.x and up only.
9 | # -Use at your own risk!
10 | # -Use only for new installations of Guacamole!
11 | # -Read all documentation (wiki) prior to using this script!
12 | # -Test prior to deploying on a production system!
13 | #
14 | ###### PRE-RUN CHECKS ##############################################
15 | if ! [ $(id -u) = 0 ]; then echo "This script must be run as sudo or root, try again..."; exit 1; fi
16 | if ! [ $(getenforce) = "Enforcing" ]; then echo "This script requires SELinux to be active and in \"Enforcing mode\""; exit 1; fi
17 | if ! [ $(uname -m) = "x86_64" ]; then echo "This script will only run on 64 bit versions of RHEL/CentOS"; exit 1; fi
18 | # Check that firewalld is installed
19 | if ! rpm -q --quiet "firewalld"; then echo "This script requires firewalld to be installed on the system"; exit 1; fi
20 |
21 | # Allow trap to work in functions
22 | set -E
23 |
24 | ######################################################################
25 | ###### VARIABLES ###################################################
26 | ######################################################################
27 |
28 | ###### UNIVERSAL VARIABLES #########################################
29 | # USER CONFIGURABLE #
30 | # Generic
31 | SCRIPT_BUILD="2020_07_16" # Scripts Date for last modified as "yyyy_mm_dd"
32 | ADM_POC="Local Admin, admin@admin.com" # Point of contact for the Guac server admin
33 |
34 | # Versions
35 | GUAC_STBL_VER="1.2.0" # Latest stable version of Guac from https://guacamole.apache.org/releases/
36 | MYSQL_CON_VER="8.0.21" # Working stable release of MySQL Connecter J
37 | MAVEN_VER="3.6.3" # Latest stable version of Apache Maven
38 |
39 | # Ports
40 | GUAC_PORT="4822"
41 | MYSQL_PORT="3306"
42 |
43 | # Key Sizes
44 | JKSTORE_KEY_SIZE_DEF="4096" # Default Java Keystore key-size
45 | LE_KEY_SIZE_DEF="4096" # Default Let's Encrypt key-size
46 | SSL_KEY_SIZE_DEF="4096" # Default Self-signed SSL key-size
47 |
48 | # Default Credentials
49 | MYSQL_PASSWD_DEF="guacamole" # Default MySQL/MariaDB root password
50 | DB_NAME_DEF="guac_db" # Defualt database name
51 | DB_USER_DEF="guac_adm" # Defualt database user name
52 | DB_PASSWD_DEF="guacamole" # Defualt database password
53 | JKS_GUAC_PASSWD_DEF="guacamole" # Default Java Keystore password
54 | JKS_CACERT_PASSWD_DEF="guacamole" # Default CACert Java Keystore password, used with LDAPS
55 |
56 | # Misc
57 | GUACD_USER="guacd" # The user name and group of the user running the guacd service
58 | GUAC_URIPATH_DEF="/" # Default URI for Guacamole
59 | DOMAIN_NAME_DEF="localhost" # Default domain name of server
60 | H_ERR=false # Defualt value of if an error has been triggered, should be false
61 | LIBJPEG_EXCLUDE="exclude=libjpeg-turbo-[0-9]*,libjpeg-turbo-*.*.9[0-9]-*"
62 | DEL_TMP_VAR=true # Default behavior to delete the temp var file used by error handler on completion. Set to false to keep the file to review last values
63 | NAME_SERVERS_DEF="1.1.1.1 1.0.0.1 2606:4700:4700::1111 2606:4700:4700::1001" # OCSP resolver DNS name servers defaults !!Only used if the host does not have name servers in resolv.conf!!
64 |
65 | # ONLY CHANGE IF NOT WORKING #
66 | # URLS
67 | MYSQL_CON_URL="https://dev.mysql.com/get/Downloads/Connector-J/" #Direct URL for download
68 | LIBJPEG_REPO="https://libjpeg-turbo.org/pmwiki/uploads/Downloads/libjpeg-turbo.repo"
69 |
70 | # Dirs and File Names
71 | LIB_DIR="/var/lib/guacamole/"
72 | GUAC_CONF="guacamole.properties" # Guacamole configuration/properties file
73 | MYSQL_CON="mysql-connector-java-${MYSQL_CON_VER}"
74 | TMP_VAR_FILE="guac_tmp_vars" # Temp file name used to store varaibles for the error handler
75 |
76 | # Formats
77 | Black=`tput setaf 0` #${Black}
78 | Red=`tput setaf 1` #${Red}
79 | Green=`tput setaf 2` #${Green}
80 | Yellow=`tput setaf 3` #${Yellow}
81 | Blue=`tput setaf 4` #${Blue}
82 | Magenta=`tput setaf 5` #${Magenta}
83 | Cyan=`tput setaf 6` #${Cyan}
84 | White=`tput setaf 7` #${White}
85 | Bold=`tput bold` #${Bold}
86 | UndrLn=`tput sgr 0 1` #${UndrLn}
87 | Rev=`tput smso` #${Rev}
88 | Reset=`tput sgr0` #${Reset}
89 | ###### END UNIVERSAL VARIABLES #####################################
90 |
91 | ###### INITIALIZE COMMON VARIABLES #################################
92 | # ONLY CHANGE IF NOT WORKING #
93 | init_vars () {
94 | # Get the release version of Guacamole from/for Git
95 | GUAC_GIT_VER=`curl -s https://raw.githubusercontent.com/apache/guacamole-server/master/configure.ac | grep 'AC_INIT([guacamole-server]*' | awk -F'[][]' -v n=2 '{ print $(2*n) }'`
96 | PWD=`pwd` # Current directory
97 |
98 | # Set full path/file name of file used to stored temp variables used by the error handler
99 | VAR_FILE="${PWD}/${TMP_VAR_FILE}"
100 | echo "-1" > "${VAR_FILE}" # create file with -1 to set not as background process
101 |
102 | # Determine if OS is RHEL, CentOS or something else
103 | if grep -q "CentOS" /etc/redhat-release; then
104 | OS_NAME="CentOS"
105 | elif grep -q "Red Hat Enterprise" /etc/redhat-release; then
106 | OS_NAME="RHEL"
107 | else
108 | echo "Unable to verify OS from /etc/redhat-release as CentOS or RHEL, this script is intended only for those distro's, exiting."
109 | exit 1
110 | fi
111 | OS_NAME_L="$(echo $OS_NAME | tr '[:upper:]' '[:lower:]')" # Set lower case rhel or centos for use in some URLs
112 |
113 | # Outputs the major.minor.release number of the OS, Ex: 7.6.1810 and splits the 3 parts.
114 | MAJOR_VER=`cat /etc/redhat-release | grep -oP "[0-9]+" | sed -n 1p` # Return the leftmost digit representing major version
115 | MINOR_VER=`cat /etc/redhat-release | grep -oP "[0-9]+" | sed -n 2p` # Returns the middle digit representing minor version
116 | # Placeholder in case this info is ever needed. RHEL does not have release number, only major.minor
117 | # RELEASE_VER=`cat /etc/redhat-release | grep -oP "[0-9]+" | sed -n 3p` # Returns the rightmost digits representing release number
118 |
119 | #Set arch used in some paths
120 | MACHINE_ARCH=`uname -m`
121 | ARCH="64"
122 |
123 | # Set nginx url for RHEL or CentOS
124 | NGINX_URL="https://nginx.org/packages/$OS_NAME_L/$MAJOR_VER/$MACHINE_ARCH/"
125 | }
126 |
127 | ###### SOURCE VARIABLES ############################################
128 | src_vars () {
129 | # Check if selected source is Git or stable release, set variables based on selection
130 | if [ $GUAC_SOURCE == "Git" ]; then
131 | GUAC_VER=${GUAC_GIT_VER}
132 | GUAC_URL="git://github.com/apache/"
133 | GUAC_SERVER="guacamole-server.git"
134 | GUAC_CLIENT="guacamole-client.git"
135 | MAVEN_MAJOR_VER=${MAVEN_VER:0:1}
136 | MAVEN_URL="https://www-us.apache.org/dist/maven/maven-${MAVEN_MAJOR_VER}/${MAVEN_VER}/binaries/"
137 | MAVEN_FN="apache-maven-${MAVEN_VER}"
138 | MAVEN_BIN="${MAVEN_FN}-bin.tar.gz"
139 | else # Stable release
140 | GUAC_VER=${GUAC_STBL_VER}
141 | GUAC_URL="https://apache.org/dyn/closer.cgi?action=download&filename=guacamole/${GUAC_VER}/"
142 | GUAC_SERVER="guacamole-server-${GUAC_VER}"
143 | GUAC_CLIENT="guacamole-${GUAC_VER}"
144 | fi
145 |
146 | # JDBC Extension file name
147 | GUAC_JDBC="guacamole-auth-jdbc-${GUAC_VER}"
148 |
149 | # LDAP extension file name
150 | GUAC_LDAP="guacamole-auth-ldap-${GUAC_VER}"
151 |
152 | # TOTP extension file name
153 | GUAC_TOTP="guacamole-auth-totp-${GUAC_VER}"
154 |
155 | # Dirs and file names
156 | INSTALL_DIR="/usr/local/src/guacamole/${GUAC_VER}/" # Guacamole installation dir
157 | FILENAME="${PWD}/guacamole-${GUAC_VER}_"$(date +"%d-%y-%b")"" # Script generated log filename
158 | logfile="${FILENAME}.log" # Script generated log file full name
159 | fwbkpfile="${FILENAME}.firewall.bkp" # Firewall backup file name
160 | }
161 |
162 | ######################################################################
163 | ###### MENUS #######################################################
164 | ######################################################################
165 |
166 | ###### SOURCE MENU #################################################
167 | src_menu () {
168 | clear
169 |
170 | echo -e " ${Reset}${Bold}----====Gucamole Installation Script====----\n ${Reset}Guacamole Remote Desktop Gateway\n"
171 | echo -e " ${Bold}*** Source Menu ***\n"
172 | echo " OS: ${Yellow}${OS_NAME} ${MAJOR_VER}.${MINOR_VER} ${MACHINE_ARCH}${Reset}"
173 | echo -e " ${Bold}Stable Version: ${Yellow}${GUAC_STBL_VER}${Reset} || ${Bold}Git Version: ${Yellow}${GUAC_GIT_VER}${Reset}\n"
174 |
175 | while true; do
176 | echo -n "${Green} Pick the desired source to install from (enter 'stable' or 'git', default is 'stable'): ${Yellow}"
177 | read GUAC_SOURCE
178 | case $GUAC_SOURCE in
179 | [Ss]table|"" ) GUAC_SOURCE="Stable"; break;;
180 | [Gg][Ii][Tt] ) GUAC_SOURCE="Git"; break;;
181 | * ) echo "${Green} Please enter 'stable' or 'git' to select source/version (without quotes)";;
182 | esac
183 | done
184 |
185 | tput sgr0
186 | }
187 |
188 | ###### START EXECUTION #############################################
189 | init_vars
190 | src_menu
191 | src_vars
192 |
193 | ###### MENU HEADERS ################################################
194 | # Called by each menu and summary menu to display the dynamic header
195 | menu_header () {
196 | tput sgr0
197 | clear
198 |
199 | echo -e " ${Reset}${Bold}----====Gucamole Installation Script====----\n ${Reset}Guacamole Remote Desktop Gateway\n"
200 | echo -e " ${Bold}*** ${SUB_MENU_TITLE} ***\n"
201 | echo " OS: ${Yellow}${OS_NAME} ${MAJOR_VER}.${MINOR_VER} ${MACHINE_ARCH}${Reset}"
202 | echo -e " ${Bold}Source/Version: ${Yellow}${GUAC_SOURCE} ${GUAC_VER}${Reset}\n"
203 | }
204 |
205 | ###### DATABASE AND JKS MENU #######################################
206 | db_menu () {
207 | SUB_MENU_TITLE="Database and JKS Menu"
208 |
209 | menu_header
210 |
211 | echo -n "${Green} Enter the Guacamole DB name (default ${DB_NAME_DEF}): ${Yellow}"
212 | read DB_NAME
213 | DB_NAME=${DB_NAME:-${DB_NAME_DEF}}
214 | echo -n "${Green} Enter the Guacamole DB username (default ${DB_USER_DEF}): ${Yellow}"
215 | read DB_USER
216 | DB_USER=${DB_USER:-${DB_USER_DEF}}
217 | echo -n "${Green} Enter the Java KeyStore key-size to use (default ${JKSTORE_KEY_SIZE_DEF}): ${Yellow}"
218 | read JKSTORE_KEY_SIZE
219 | JKSTORE_KEY_SIZE=${JKSTORE_KEY_SIZE:-${JKSTORE_KEY_SIZE_DEF}}
220 | }
221 |
222 | ###### PASSWORDS MENU ##############################################
223 | pw_menu () {
224 | SUB_MENU_TITLE="Passwords Menu"
225 |
226 | menu_header
227 |
228 | echo -n "${Green} Enter the root password for MariaDB: ${Yellow}"
229 | read MYSQL_PASSWD
230 | MYSQL_PASSWD=${MYSQL_PASSWD:-${MYSQL_PASSWD_DEF}}
231 | echo -n "${Green} Enter the Guacamole DB password: ${Yellow}"
232 | read DB_PASSWD
233 | DB_PASSWD=${DB_PASSWD:-${DB_PASSWD_DEF}}
234 | echo -n "${Green} Enter the Guacamole Java KeyStore password, must be 6 or more characters: ${Yellow}"
235 | read JKS_GUAC_PASSWD
236 | JKS_GUAC_PASSWD=${JKS_GUAC_PASSWD:-${JKS_GUAC_PASSWD_DEF}}
237 | }
238 |
239 | ###### SSL CERTIFICATE TYPE MENU ###################################
240 | ssl_cert_type_menu () {
241 | SUB_MENU_TITLE="SSL Certificate Type Menu"
242 |
243 | menu_header
244 |
245 | echo "${Green} What kind of SSL certificate should be used (default 2)?${Yellow}"
246 | PS3="${Green} Enter the number of the desired SSL certificate type: ${Yellow}"
247 | options=("LetsEncrypt" "Self-signed" "None")
248 | select opt in "${options[@]}"
249 | do
250 | case $opt in
251 | "LetsEncrypt") SSL_CERT_TYPE="LetsEncrypt"; le_menu; break;;
252 | "Self-signed"|"") SSL_CERT_TYPE="Self-signed"; ss_menu; break;;
253 | "None")
254 | SSL_CERT_TYPE="None"
255 | OCSP_USE=false
256 | echo -e "\n\n${Red} No SSL certificate selected. This can be configured manually at a later time."
257 | sleep 3
258 | break;;
259 | * ) echo "${Green} ${REPLY} is not a valid option, enter the number representing your desired cert type.";;
260 | esac
261 | done
262 | }
263 |
264 | ###### LETSENCRYPT MENU ############################################
265 | le_menu () {
266 | SUB_MENU_TITLE="LetsEncrypt Menu"
267 |
268 | menu_header
269 |
270 | echo -n "${Green} Enter a valid e-mail for let's encrypt certificate: ${Yellow}"
271 | read EMAIL_NAME
272 | echo -n "${Green} Enter the Let's Encrypt key-size to use (default ${LE_KEY_SIZE_DEF}): ${Yellow}"
273 | read LE_KEY_SIZE
274 | LE_KEY_SIZE=${LE_KEY_SIZE:-${LE_KEY_SIZE_DEF}}
275 |
276 | while true; do
277 | echo -n "${Green} Use OCSP Stapling (default yes): ${Yellow}"
278 | read yn
279 | case $yn in
280 | [Yy]*|"" ) OCSP_USE=true; break;;
281 | [Nn]* ) OCSP_USE=false; break;;
282 | * ) echo "${Green} Please enter yes or no. ${Yellow}";;
283 | esac
284 | done
285 | }
286 |
287 | ###### SELF-SIGNED SSL CERTIFICATE MENU ############################
288 | ss_menu () {
289 | OCSP_USE=false
290 | SUB_MENU_TITLE="Self-signed SSL Certificate Menu"
291 |
292 | menu_header
293 |
294 | echo -n "${Green} Enter the Self-Signed SSL key-size to use (default ${SSL_KEY_SIZE_DEF}): ${Yellow}"
295 | read SSL_KEY_SIZE
296 | SSL_KEY_SIZE=${SSL_KEY_SIZE:-${SSL_KEY_SIZE_DEF}}
297 | }
298 |
299 | ###### NGINX OPTIONS MENU ##########################################
300 | nginx_menu () {
301 | SUB_MENU_TITLE="Nginx Menu"
302 |
303 | menu_header
304 |
305 | # Server LAN IP
306 | GUAC_LAN_IP_DEF=$(hostname -I | sed 's/ .*//')
307 |
308 | echo -n "${Green} Enter the LAN IP of this server (default ${GUAC_LAN_IP_DEF}): ${Yellow}"
309 | read GUAC_LAN_IP
310 | GUAC_LAN_IP=${GUAC_LAN_IP:-${GUAC_LAN_IP_DEF}}
311 | echo -n "${Green} Enter a valid hostname or public domain such as mydomain.com (default ${DOMAIN_NAME_DEF}): ${Yellow}"
312 | read DOMAIN_NAME
313 | DOMAIN_NAME=${DOMAIN_NAME:-${DOMAIN_NAME_DEF}}
314 | echo -n "${Green} Enter the URI path, starting and ending with / for example /guacamole/ (default ${GUAC_URIPATH_DEF}): ${Yellow}"
315 | read GUAC_URIPATH
316 | GUAC_URIPATH=${GUAC_URIPATH:-${GUAC_URIPATH_DEF}}
317 |
318 | # Only prompt if SSL will be used
319 | if [ $SSL_CERT_TYPE != "None" ]; then
320 | while true; do
321 | echo -n "${Green} Use only >= 256-bit SSL ciphers (More secure, less compatible. default: yes)?: ${Yellow}"
322 | read yn
323 | case $yn in
324 | [Yy]*|"" ) NGINX_SEC=true; break;;
325 | [Nn]* ) NGINX_SEC=false; break;;
326 | * ) echo "${Green} Please enter yes or no. ${Yellow}";;
327 | esac
328 | done
329 |
330 | while true; do
331 | echo -n "${Green} Use Content-Security-Policy [CSP] (More secure, less compatible. default: yes)?: ${Yellow}"
332 | read yn
333 | case $yn in
334 | [Yy]*|"" ) USE_CSP=true; break;;
335 | [Nn]* ) USE_CSP=false; break;;
336 | * ) echo "${Green} Please enter yes or no. ${Yellow}";;
337 | esac
338 | done
339 | else
340 | NGINX_SEC=false
341 | USE_CSP=false
342 | fi
343 | }
344 |
345 | ###### PRIMARY AUTHORIZATION EXTENSIONS MENU #######################
346 | prime_auth_ext_menu () {
347 | SUB_MENU_TITLE="Primary Authentication Extensions Menu"
348 |
349 | menu_header
350 |
351 | INSTALL_LDAP=false
352 | SECURE_LDAP=false
353 | INSTALL_RADIUS=false
354 | INSTALL_CAS=false
355 | INSTALL_OPENID=false
356 |
357 | # Allows selection of an authentication method in addition to MariaDB/Database or just MariaDB
358 | # which is used to store connection and user meta data for all other methods
359 | echo "${Green} What Guacamole extension should be used as the primary user authentication method (default 1)?${Yellow}"
360 | PS3="${Green} Enter the number of the desired authentication method: ${Yellow}"
361 | # Removing non-working options from the menu until they are ready
362 | # "RADIUS" "OpenID" "CAS"
363 | options=("MariaDB Database" "LDAP(S)")
364 | COLUMNS=1
365 | select opt in "${options[@]}"
366 | do
367 | case $opt in
368 | "MariaDB Database"|"") PRIME_AUTH_TYPE="MariaDB"; break;;
369 | "LDAP(S)") PRIME_AUTH_TYPE="LDAP"; LDAP_ext_menu; break;;
370 | # "RADIUS") PRIME_AUTH_TYPE="RADIUS"; Radius_ext_menu; break;;
371 | # "OpenID") PRIME_AUTH_TYPE="OpenID"; OpenID_ext_menu; break;;
372 | # "CAS") PRIME_AUTH_TYPE="CAS"; CAS_ext_menu; break;;
373 | * ) echo "${Green} ${REPLY} is not a valid option, enter the number representing the desired primary authentication method.";;
374 | esac
375 | done
376 |
377 | unset COLUMNS
378 | }
379 |
380 | ###### 2FA EXTENSIONS MENU #########################################
381 | secondary_auth_ext_menu () {
382 | SUB_MENU_TITLE="2FA Extensions Menu"
383 |
384 | menu_header
385 |
386 | INSTALL_TOTP=false
387 | INSTALL_DUO=false
388 |
389 | # Allows optional selection of a Two Factor Authentication (2FA) method
390 | echo "${Green} What Guacamole extension should be used as the 2FA authentication method (default 1)?${Yellow}"
391 | PS3="${Green} Enter the number of the desired authentication method: ${Yellow}"
392 | # Removing non-working options from the menu until they are ready
393 | # "DUO"
394 | options=("None" "TOTP")
395 | COLUMNS=1
396 | select opt in "${options[@]}"
397 | do
398 | case $opt in
399 | "None"|"") TFA_TYPE="None"; break;;
400 | "TOTP") TFA_TYPE="TOTP"; TOTP_ext_menu; break;;
401 | # "DUO") TFA_TYPE="DUO"; Duo_ext_menu; break;;
402 | * ) echo "${Green} ${REPLY} is not a valid option, enter the number representing the desired 2FA method.";;
403 | esac
404 | done
405 |
406 | unset COLUMNS
407 | }
408 |
409 | ###### LDAP MENU ###################################################
410 | LDAP_ext_menu () {
411 | INSTALL_LDAP=true
412 | SUB_MENU_TITLE="LDAP Extension Menu"
413 |
414 | menu_header
415 |
416 | # Allow selection of LDAPS
417 | while true; do
418 | echo -n "${Green} Use LDAPS instead of LDAP (Requires having the cert from the server copied locally, default: no): ${Yellow}"
419 | read SECURE_LDAP
420 | case $SECURE_LDAP in
421 | [Yy]* ) SECURE_LDAP=true; break;;
422 | [Nn]*|"" ) SECURE_LDAP=false; break;;
423 | * ) echo "${Green} Please enter yes or no. ${Yellow}";;
424 | esac
425 | done
426 |
427 | # Check if LDAPS was selected
428 | if [ $SECURE_LDAP = true ]; then
429 | echo -ne "\n${Green} Enter the LDAP Port (default 636): ${Yellow}"
430 | read LDAP_PORT
431 | LDAP_PORT=${LDAP_PORT:-636}
432 |
433 | # LDAPS Certificate placeholder values
434 | LDAPS_CERT_FN="mycert.cer"
435 | LDAPS_CERT_FULL="xNULLx"
436 |
437 | while [ ! -f ${LDAPS_CERT_FULL} ]; do
438 | echo -ne "\n${Green} Enter a valid filename of the .cer certificate file (Ex: mycert.cer): ${Yellow}"
439 | read LDAPS_CERT_FN
440 | LDAPS_CERT_FN=${LDAPS_CERT_FN:-${LDAPS_CERT_FN}}
441 | echo -n "${Green} Enter the full path of the dir containing the .cer certificate file (must end with / Ex: /home/me/): ${Yellow}"
442 | read LDAPS_CERT_DIR
443 | LDAPS_CERT_DIR=${LDAPS_CERT_DIR:-/home/}
444 | LDAPS_CERT_FULL=${LDAPS_CERT_DIR}${LDAPS_CERT_FN}
445 | if [ ! -f ${LDAPS_CERT_FULL} ]; then
446 | echo "${Red} The file/path: ${LDAPS_CERT_FULL} does not exist! Ensure the file is in the directory and try again..."
447 | fi
448 | done
449 |
450 | echo -ne "\n${Green} Set the password for the CACert Java Keystore, must be 6 or more characters (default ${JKS_CACERT_PASSWD_DEF}): ${Yellow}"
451 | read JKS_CACERT_PASSWD
452 | JKS_CACERT_PASSWD=${JKS_CACERT_PASSWD:-${JKS_CACERT_PASSWD_DEF}}
453 | else # Use LDAP not LDAPS
454 | echo -ne "\n${Green} Enter the LDAP Port (default 389): ${Yellow}"
455 | read LDAP_PORT
456 | LDAP_PORT=${LDAP_PORT:-389}
457 | fi
458 |
459 | echo -ne "\n${Green} Enter the LDAP Server Hostname (use the FQDN, Ex: ldaphost.domain.com): ${Yellow}"
460 | read LDAP_HOSTNAME
461 | LDAP_HOSTNAME=${LDAP_HOSTNAME:-ldaphost.domain.com}
462 | echo -n "${Green} Enter the LDAP User-Base-DN (Ex: dc=domain,dc=com): ${Yellow}"
463 | read LDAP_BASE_DN
464 | LDAP_BASE_DN=${LDAP_BASE_DN:-dc=domain,dc=com}
465 | echo -n "${Green} Enter the LDAP Search-Bind-DN (Ex: cn=user,ou=Admins,dc=domain,dc=com): ${Yellow}"
466 | read LDAP_BIND_DN
467 | LDAP_BIND_DN=${LDAP_BIND_DN:-cn=user,ou=Admins,dc=domain,dc=com}
468 | echo -n "${Green} Enter the LDAP Search-Bind-Password: ${Yellow}"
469 | read LDAP_BIND_PW
470 | LDAP_BIND_PW=${LDAP_BIND_PW:-password}
471 | echo -n "${Green} Enter the LDAP Username-Attribute (default sAMAccountName): ${Yellow}"
472 | read LDAP_UNAME_ATTR
473 | LDAP_UNAME_ATTR=${LDAP_UNAME_ATTR:-sAMAccountName}
474 |
475 | LDAP_SEARCH_FILTER_DEF="(objectClass=*)"
476 | echo -n "${Green} Enter a custom LDAP user search filter (default \"${LDAP_SEARCH_FILTER_DEF}\"): ${Yellow}"
477 | read LDAP_SEARCH_FILTER
478 | LDAP_SEARCH_FILTER=${LDAP_SEARCH_FILTER:-${LDAP_SEARCH_FILTER_DEF}}
479 | }
480 |
481 | ###### TOTP MENU ###################################################
482 | TOTP_ext_menu () {
483 | INSTALL_TOTP=true
484 | SUB_MENU_TITLE="TOTP Extension Menu"
485 |
486 | menu_header
487 |
488 | echo -n "${Green} Enter the TOTP issuer (default Apache Guacamole): ${Yellow}"
489 | read TOTP_ISSUER
490 | TOTP_ISSUER=${TOTP_ISSUER:-Apache Guacamole}
491 | echo -n "${Green} Enter the number of digits to use for TOTP (default 6): ${Yellow}"
492 | read TOTP_DIGITS
493 | TOTP_DIGITS=${TOTP_DIGITS:-6}
494 | echo -n "${Green} Enter the TOTP period in seconds (default 30): ${Yellow}"
495 | read TOTP_PER
496 | TOTP_PER=${TOTP_PER:-30}
497 | echo -n "${Green} Enter the TOTP mode (default sha1): ${Yellow}"
498 | read TOTP_MODE
499 | TOTP_MODE=${TOTP_MODE:-sha1}
500 | }
501 |
502 | ###### DUO MENU ####################################################
503 | Duo_ext_menu () {
504 | INSTALL_DUO=false
505 | SUB_MENU_TITLE="DUO Extension Menu"
506 |
507 | menu_header
508 |
509 | echo "${Red} Duo extension not currently available via this script."
510 | sleep 3
511 | }
512 |
513 | ###### RADIUS MENU #################################################
514 | Radius_ext_menu () {
515 | INSTALL_RADIUS=false
516 | SUB_MENU_TITLE="RADIUS Extension Menu"
517 |
518 | menu_header
519 |
520 | echo "${Red} RADIUS extension not currently available via this script."
521 | sleep 3
522 | }
523 |
524 | ###### CAS MENU ####################################################
525 | CAS_ext_menu () {
526 | INSTALL_CAS=false
527 | SUB_MENU_TITLE="CAS Extension Menu"
528 |
529 | menu_header
530 |
531 | echo "${Red} CAS extension not currently available via this script."
532 | sleep 3
533 | }
534 |
535 | ###### OPENID MENU #################################################
536 | OpenID_ext_menu () {
537 | INSTALL_OPENID=false
538 | SUB_MENU_TITLE="OpenID Extension Menu"
539 |
540 | menu_header
541 |
542 | echo "${Red} OpenID extension not currently available via this script."
543 | sleep 3
544 | }
545 |
546 | ###### CUSTOM EXTENSION MENU #######################################
547 | cust_ext_menu () {
548 | SUB_MENU_TITLE="Custom Extension Menu"
549 |
550 | menu_header
551 |
552 | while true; do
553 | echo -n "${Green} Would you like to install a custom Guacamole extensions from a local file (default no)? ${Yellow}"
554 | read yn
555 | case $yn in
556 | [Yy]* )
557 | INSTALL_CUST_EXT=true
558 |
559 | # Set placeholder values
560 | CUST_FN="myextension.jar"
561 | CUST_FULL="xNULLx"
562 |
563 | while [ ! -f ${CUST_FULL} ]; do
564 | echo -ne "\n${Green} Enter a valid filename of the .jar extension file (Ex: myextension.jar): ${Yellow}"
565 | read CUST_FN
566 | CUST_FN=${CUST_FN:-${CUST_FN}}
567 | echo -n "${Green} Enter the full path of the dir containing the .jar extension file (must end with / Ex: /home/me/): ${Yellow}"
568 | read CUST_DIR
569 | CUST_DIR=${CUST_DIR:-/home/}
570 | CUST_FULL=${CUST_DIR}${CUST_FN}
571 | if [ ! -f ${CUST_FULL} ]; then # Check that full path/name exists, otherwise prompt again
572 | echo "${Red} The file/path: ${CUST_FULL} does not exist! Ensure the file is in the directory and try again..."
573 | fi
574 | done
575 | break;;
576 | [Nn]*|"" ) INSTALL_CUST_EXT=false; break;;
577 | * ) echo "${Green} Please enter yes or no. ${Yellow}";;
578 | esac
579 | done
580 | }
581 |
582 | ######################################################################
583 | ###### SUMMARY MENUS ###############################################
584 | ######################################################################
585 |
586 | ###### MAIN SUMMARY MENU ###########################################
587 | sum_menu () {
588 | SUB_MENU_TITLE="Summary Menu"
589 |
590 | menu_header
591 |
592 | RUN_INSTALL=false
593 | RET_SUM=false
594 |
595 | # List categories/menus to review or change
596 | echo "${Green} Select a category to review selections: ${Yellow}"
597 | PS3="${Green} Enter the number of the category to review: ${Yellow}"
598 | options=("Database" "Passwords" "SSL Cert Type" "Nginx" "Primary Authentication Extension" "2FA Extension" "Custom Extension" "Accept and Run Installation" "Cancel and Start Over" "Cancel and Exit Script")
599 | select opt in "${options[@]}"
600 | do
601 | case $opt in
602 | "Database") sum_db; break;;
603 | "Passwords") sum_pw; break;;
604 | "SSL Cert Type") sum_ssl; break;;
605 | "Nginx") sum_nginx; break;;
606 | "Primary Authentication Extension") sum_prime_auth_ext; break;;
607 | "2FA Extension") sum_secondary_auth_ext; break;;
608 | "Custom Extension") sum_cust_ext; break;;
609 | "Accept and Run Installation") RUN_INSTALL=true; break;;
610 | "Cancel and Start Over") ScriptLoc=$(readlink -f "$0"); exec "$ScriptLoc"; break;;
611 | "Cancel and Exit Script") tput sgr0; exit 1; break;;
612 | * ) echo "${Green} ${REPLY} is not a valid option, enter the number representing the category to review.";;
613 | esac
614 | done
615 | }
616 |
617 | ###### DATABASE SUMMARY ############################################
618 | sum_db () {
619 | SUB_MENU_TITLE="Database Summary"
620 |
621 | menu_header
622 |
623 | echo "${Green} Guacamole DB name: ${Yellow}${DB_NAME}"
624 | echo "${Green} Guacamole DB username: ${Yellow}${DB_USER}"
625 | echo -e "${Green} Java KeyStore key-size: ${Yellow}${JKSTORE_KEY_SIZE}\n"
626 |
627 | while true; do
628 | echo -n "${Green} Would you like to change these selections (default no)? ${Yellow}"
629 | read yn
630 | case $yn in
631 | [Yy]* ) db_menu; break;;
632 | [Nn]*|"" ) break;;
633 | * ) echo "${Green} Please enter yes or no. ${Yellow}";;
634 | esac
635 | done
636 |
637 | sum_menu
638 | }
639 |
640 | ###### PASSWORD SUMMARY ############################################
641 | sum_pw () {
642 | SUB_MENU_TITLE="Passwords Summary"
643 |
644 | menu_header
645 |
646 | echo "${Green} MariaDB root password: ${Yellow}${MYSQL_PASSWD}"
647 | echo "${Green} Guacamole DB password: ${Yellow}${DB_PASSWD}"
648 | echo -e "${Green} Guacamole Java KeyStore password: ${Yellow}${JKS_GUAC_PASSWD}\n"
649 |
650 | while true; do
651 | echo -n "${Green} Would you like to change these selections (default no)? ${Yellow}"
652 | read yn
653 | case $yn in
654 | [Yy]* ) pw_menu; break;;
655 | [Nn]*|"" ) break;;
656 | * ) echo "${Green} Please enter yes or no. ${Yellow}";;
657 | esac
658 | done
659 |
660 | sum_menu
661 | }
662 |
663 | ###### SSL CERTIFICATE SUMMARY #####################################
664 | sum_ssl () {
665 | SUB_MENU_TITLE="SSL Certificate Summary"
666 |
667 | menu_header
668 |
669 | echo -e "${Green} Certficate Type: ${Yellow}${SSL_CERT_TYPE}\n"
670 |
671 | # Check the certificate selection to display proper information for selection
672 | case $SSL_CERT_TYPE in
673 | "LetsEncrypt")
674 | echo "${Green} e-mail for LetsEncrypt certificate: ${Yellow}${EMAIL_NAME}"
675 | echo "${Green} LetEncrypt key-size: ${Yellow}${LE_KEY_SIZE}"
676 | echo -e "${Green} Use OCSP Stapling?: ${Yellow}${OCSP_USE}\n"
677 | ;;
678 | "Self-signed")
679 | echo -e "${Green} Self-Signed SSL key-size: ${Yellow}${SSL_KEY_SIZE}\n"
680 | ;;
681 | "None")
682 | echo -e "${Yellow} As no certificate type was selected, an SSL certificate can be configured manually at a later time.\n"
683 | ;;
684 | esac
685 |
686 | while true; do
687 | echo -n "${Green} Would you like to change these selections (default no)? ${Yellow}"
688 | read yn
689 | case $yn in
690 | [Yy]* ) ssl_cert_type_menu; break;;
691 | [Nn]*|"" ) break;;
692 | * ) echo "${Green} Please enter yes or no. ${Yellow}";;
693 | esac
694 | done
695 |
696 | sum_menu
697 | }
698 |
699 | ###### NGINX SUMMARY ###############################################
700 | sum_nginx () {
701 | SUB_MENU_TITLE="Nginx Summary"
702 |
703 | menu_header
704 |
705 | echo "${Green} Guacamole Server LAN IP address: ${Yellow}${GUAC_LAN_IP}"
706 | echo "${Green} Guacamole Server hostname or public domain: ${Yellow}${DOMAIN_NAME}"
707 | echo "${Green} URI path: ${Yellow}${GUAC_URIPATH}"
708 | echo "${Green} Using only 256-bit >= ciphers?: ${Yellow}${NGINX_SEC}"
709 | echo -e "${Green} Content-Security-Policy [CSP] enabled?: ${Yellow}${USE_CSP}\n"
710 |
711 | while true; do
712 | echo -n "${Green} Would you like to change these selections (default no)? ${Yellow}"
713 | read yn
714 | case $yn in
715 | [Yy]* ) nginx_menu; break;;
716 | [Nn]*|"" ) break;;
717 | * ) echo "${Green} Please enter yes or no. ${Yellow}";;
718 | esac
719 | done
720 |
721 | sum_menu
722 | }
723 |
724 | ###### STANDARD EXTENSIONS SUMMARY #################################
725 | sum_prime_auth_ext () {
726 | SUB_MENU_TITLE="Primary Authentication Extension Summary"
727 |
728 | menu_header
729 |
730 | echo -e "${Green} Primary Authentication type: ${Yellow}${PRIME_AUTH_TYPE}\n"
731 |
732 | echo "${Yellow}${Bold} -- MariaDB is used with all authentication implementations --${Reset}"
733 | echo "${Green} Default Guacamole username: ${Yellow}guacadmin"
734 | echo -e "${Green} Default Guacamole password: ${Yellow}guacadmin\n"
735 |
736 | # Check the authentication selection to display proper information for the selection
737 | case $PRIME_AUTH_TYPE in
738 | "LDAP")
739 | echo -e "${Reset}${Bold} -- LDAP Specific Parameters --${Reset}\n"
740 | echo "${Green} Use LDAPS instead of LDAP: ${Yellow}${SECURE_LDAP}"
741 | echo -e "${Green} LDAP(S) port: ${Yellow}${LDAP_PORT}\n"
742 |
743 | if [ $SECURE_LDAP = true ]; then
744 | echo "${Green} LDAPS full filename and path: ${Yellow}${LDAPS_CERT_FULL}"
745 | echo -e "${Green} CACert Java Keystroe password: ${Yellow}${JKS_CACERT_PASSWD}\n"
746 | fi
747 |
748 | echo "${Green} LDAP Server Hostname (should be FQDN, Ex: ldaphost.domain.com): ${Yellow}${LDAP_HOSTNAME}"
749 | echo "${Green} LDAP User-Base-DN (Ex: dc=domain,dc=com): ${Yellow}${LDAP_BASE_DN}"
750 | echo "${Green} LDAP Search-Bind-DN (Ex: cn=user,ou=Admins,dc=domain,dc=com): ${Yellow}${LDAP_BIND_DN}"
751 | echo "${Green} LDAP Search-Bind-Password: ${Yellow}${LDAP_BIND_PW}"
752 | echo "${Green} LDAP Username-Attribute: ${Yellow}${LDAP_UNAME_ATTR}"
753 | echo -e "${Green} LDAP user search filter: ${Yellow}${LDAP_SEARCH_FILTER}\n"
754 | ;;
755 | "RADIUS")
756 | echo -e "${Red} RADIUS cannot currently be installed by this script.\n"
757 | ;;
758 | "OpenID")
759 | echo -e "${Red} OpenID cannot currently be installed by this script.\n"
760 | ;;
761 | "CAS")
762 | echo -e "${Red} CAS cannot currently be installed by this script.\n"
763 | ;;
764 | esac
765 |
766 | while true; do
767 | echo -n "${Green} Would you like to change the authentication method and properties (default no)? ${Yellow}"
768 | read yn
769 | case $yn in
770 | [Yy]* ) prime_auth_ext_menu; break;;
771 | [Nn]*|"" ) break;;
772 | * ) echo "${Green} Please enter yes or no. ${Yellow}";;
773 | esac
774 | done
775 |
776 | sum_menu
777 | }
778 |
779 | ###### SELECTED EXTENSIONS SUMMARY #################################
780 | sum_secondary_auth_ext () {
781 | SUB_MENU_TITLE="2FA Extension Summary"
782 |
783 | menu_header
784 |
785 | echo -e "${Green} 2FA selection: ${Yellow}${TFA_TYPE}\n"
786 |
787 | # Check the authentication selection to display proper information for the selection
788 | case $TFA_TYPE in
789 | "None")
790 | echo -e "${Yellow}${Bold} -- No form of 2FA will be implemented by this script --${Reset}\n"
791 | ;;
792 | "TOTP")
793 | echo "${Green} TOTP issuer: ${Yellow}${TOTP_ISSUER}"
794 | echo "${Green} Number of TOTP digits: ${Yellow}${TOTP_DIGITS}"
795 | echo "${Green} TOTP period in seconds: ${Yellow}${TOTP_PER}"
796 | echo -e "${Green} TOTP mode: ${Yellow}${TOTP_MODE}\n"
797 | ;;
798 | "DUO")
799 | echo -e "${Red} DUO cannot currently be installed by this script.\n"
800 | ;;
801 | esac
802 |
803 | while true; do
804 | echo -n "${Green} Would you like to change the 2FA method and properties (default no)? ${Yellow}"
805 | read yn
806 | case $yn in
807 | [Yy]* ) secondary_auth_ext_menu; break;;
808 | [Nn]*|"" ) break;;
809 | * ) echo "${Green} Please enter yes or no. ${Yellow}";;
810 | esac
811 | done
812 |
813 | sum_menu
814 | }
815 |
816 | ###### CUSTOM EXTENSION SUMMARY ####################################
817 | sum_cust_ext () {
818 | SUB_MENU_TITLE="Custom Extension Summary"
819 |
820 | menu_header
821 |
822 | echo -e "${Green} Install a custom Guacamole extension: ${Yellow}${INSTALL_CUST_EXT}\n"
823 |
824 | if [ $INSTALL_CUST_EXT = true ]; then
825 | echo "${Green} Filename of the .jar extension file: ${Yellow}${CUST_FN}"
826 | echo "${Green} Full path of the dir containing the .jar extension file: ${Yellow}${CUST_DIR}"
827 | echo -e "${Green} Full file path: ${Yellow}${CUST_FULL}\n"
828 | fi
829 |
830 | while true; do
831 | echo -n "${Green} Would you like to change these selections (default no)? ${Yellow}"
832 | read yn
833 | case $yn in
834 | [Yy]* ) cust_ext_menu; break;;
835 | [Nn]*|"" ) break;;
836 | * ) echo "${Green} Please enter yes or no. ${Yellow}";;
837 | esac
838 | done
839 |
840 | sum_menu
841 | }
842 |
843 | ###### MENU EXECUTION ##############################################
844 | db_menu
845 | pw_menu
846 | ssl_cert_type_menu
847 | nginx_menu
848 | prime_auth_ext_menu
849 | secondary_auth_ext_menu
850 | cust_ext_menu
851 | sum_menu
852 |
853 | # Sets file descriptor to 3 for this special echo function and spinner
854 | exec 3>&1
855 |
856 | ######################################################################
857 | ###### UTILITY FUNCTIONS ###########################################
858 | ######################################################################
859 |
860 | ###### PROGRESS SPINNER FUNCTION ###################################
861 | # Used to show a process is making progress/running
862 | spinner () {
863 | pid=$!
864 | #Store the background process id in a temp file to use in err_handler
865 | echo $(jobs -p) > "${VAR_FILE}"
866 |
867 | spin[0]="-"
868 | spin[1]="\\"
869 | spin[2]="|"
870 | spin[3]="/"
871 |
872 | # Loop while the process is still running
873 | while kill -0 $pid 2>/dev/null
874 | do
875 | for i in "${spin[@]}"
876 | do
877 | if kill -0 $pid 2>/dev/null; then #Check that the process is running to prevent a full 4 character cycle on error
878 | # Display the spinner in 1/4 states
879 | echo -ne "\b\b\b${Bold}[${Green}$i${Reset}${Bold}]" >&3
880 | sleep .5 # time between each state
881 | else #process has ended, stop next loop from finishing iteration
882 | break
883 | fi
884 | done
885 | done
886 |
887 | # Check if background process failed once complete
888 | if wait $pid; then # Exit 0
889 | echo -ne "\b\b\b${Bold}[${Green}-done-${Reset}${Bold}]" >&3
890 | else # Any other exit
891 | false
892 | fi
893 |
894 | #Set background process id value to -1 representing no background process running to err_handler
895 | echo "-1" > "${VAR_FILE}"
896 |
897 | tput sgr0 >&3
898 | }
899 |
900 | ###### SPECIAL ECHO FUNCTION #######################################
901 | # This allows echo to log and stdout (now fd3) while sending all else to log by default via exec
902 | s_echo () {
903 | # Use first arg $1 to determine if echo skips a line (yes/no)
904 | # Second arg $2 is the message
905 | case $1 in
906 | # No preceeding blank line
907 | [Nn])
908 | echo -ne "\n${2}" | tee -a /dev/fd/3
909 | echo # add new line after in log only
910 | ;;
911 | # Preceeding blank line
912 | [Yy]|*)
913 | echo -ne "\n\n${2}" | tee -a /dev/fd/3
914 | echo # add new line after in log only
915 | ;;
916 | esac
917 | }
918 |
919 | # Used to force all stdout and stderr to the log file
920 | # s_echo function will be used when echo needs to be displayed and logged
921 | exec &> "${logfile}"
922 |
923 | ###### ERROR HANDLER FUNCTION ######################################
924 | # Called by trap to display/log error info and exit script
925 | err_handler () {
926 | EXITCODE=$?
927 |
928 | #Read values from temp file used to store cross process values
929 | F_BG=$(sed -n 1p "${VAR_FILE}")
930 |
931 | # Check if the temp variable file is greater than 1 line of text
932 | if [ $(wc -l < "${VAR_FILE}") -gt 1 ]; then
933 | # If so, set variable according to value of the 2nd line in the file.
934 | H_ERR=$(sed -n 2p "${VAR_FILE}")
935 | else # Otherwise, set to false, error was not triggered previously
936 | H_ERR=false
937 | fi
938 |
939 | #Check this is the first time the err_handler has triggered
940 | if [ $H_ERR = false ]; then
941 | #Check if error occured with a background process running
942 | if [ $F_BG -gt 0 ]; then
943 | echo -ne "\b\b\b${Bold}[${Red}-FAILED-${Reset}${Bold}]" >&3
944 | fi
945 |
946 | FAILED_COMMAND=$(eval echo "$BASH_COMMAND") # Used to expand the variables in the command returned by BASH_COMMAND
947 | s_echo "y" "${Reset}${Red}%%% ${Reset}${Bold}ERROR (Script Failed) | Line${Reset} ${BASH_LINENO[0]} ${Bold}| Command:${Reset} ${FAILED_COMMAND} ${Bold}| Exit code:${Reset} ${EXITCODE} ${Red}%%%${Reset}\n\n"
948 |
949 | #Flag as trap having been run already skipping double error messages
950 | echo "true" >> "${VAR_FILE}"
951 | fi
952 |
953 | # Log cleanup to remove escape sequences caused by tput for formatting text
954 | sed -i 's/\x1b\[[0-9;]*m\|\x1b[(]B\x1b\[m//g' ${logfile}
955 |
956 | tput sgr0 >&3
957 | exit $EXITCODE
958 | }
959 |
960 | ###### CHECK INSTALLED PACKAGE FUNCTION ############################
961 | # Query rpm for package without triggering trap when not found
962 | chk_installed () {
963 | if rpm -q "$@"; then
964 | RETVAL=$?
965 | else
966 | RETVAL=$?
967 | fi
968 | }
969 |
970 | ###### ERROR TRAP ##################################################
971 | # Trap to call error function to display and log error details
972 | trap err_handler ERR SIGINT SIGQUIT
973 |
974 | ######################################################################
975 | ###### INSALLATION #################################################
976 | ######################################################################
977 |
978 | ###### REPOS INSTALLATION ##########################################
979 | reposinstall () {
980 | s_echo "n" "${Bold} ----==== INSTALLING GUACAMOLE ${GUAC_SOURCE} ${GUAC_VER} ====----"
981 | s_echo "y" "Installing Repos"
982 |
983 | # Install EPEL Repo
984 | chk_installed "epel-release"
985 |
986 | if [ $RETVAL -eq 0 ]; then
987 | s_echo "n" "${Reset}-EPEL is installed."
988 | else
989 | { rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-${MAJOR_VER}.noarch.rpm; } &
990 | s_echo "n" "${Reset}-EPEL is missing. Installing... "; spinner
991 | fi
992 |
993 | # Install RPMFusion Repo
994 | chk_installed "rpmfusion-free-release"
995 |
996 | if [ $RETVAL -eq 0 ]; then
997 | s_echo "n" "-RPMFusion is installed."
998 | else
999 | { rpm -Uvh https://download1.rpmfusion.org/free/el/rpmfusion-free-release-${MAJOR_VER}.noarch.rpm; } &
1000 | s_echo "n" "-RPMFusion is missing. Installing... "; spinner
1001 | fi
1002 |
1003 | # Install Nginx Repo
1004 | { echo "[nginx-stable]
1005 | name=Nginx Stable Repo
1006 | baseurl=${NGINX_URL}
1007 | gpgcheck=1
1008 | enabled=1
1009 | gpgkey=https://nginx.org/keys/nginx_signing.key
1010 | module_hotfixes=true" > /etc/yum.repos.d/nginx.repo; } &
1011 | s_echo "n" "${Reset}-Installing Nginx repo... "; spinner
1012 |
1013 | # Install libjpeg-turbo Repo
1014 | {
1015 | yum install -y wget
1016 | wget ${LIBJPEG_REPO} -P /etc/yum.repos.d/
1017 |
1018 | # Exclude beta releases
1019 | sed -i "s/exclude.*/${LIBJPEG_EXCLUDE}/g" /etc/yum.repos.d/libjpeg-turbo.repo
1020 | } &
1021 | s_echo "n" "-Installing libjpeg-turbo repo... "; spinner
1022 |
1023 | # Enable repos needed if using RHEL
1024 | if [ $OS_NAME == "RHEL" ] ; then
1025 | { subscription-manager repos --enable "rhel-*-optional-rpms" --enable "rhel-*-extras-rpms"; } &
1026 | s_echo "n" "-Enabling ${OS_NAME} optional and extras repos... "; spinner
1027 | fi
1028 |
1029 | yumupdate
1030 | }
1031 |
1032 | ###### YUM UPDATES #################################################
1033 | yumupdate () {
1034 |
1035 | # Update OS/packages
1036 | { yum update -y; } &
1037 | s_echo "y" "${Bold}Updating ${OS_NAME}, please wait... "; spinner
1038 |
1039 | baseinstall
1040 | }
1041 |
1042 | ###### INSTALL BASE PACKAGES #######################################
1043 | baseinstall () {
1044 | s_echo "y" "${Bold}Installing Required Dependencies"
1045 |
1046 | # Install Required Packages
1047 | {
1048 | yum install -y cairo-devel ffmpeg-devel freerdp-devel freerdp-plugins gcc gnu-free-mono-fonts libjpeg-turbo-devel libjpeg-turbo-official libpng-devel libssh2-devel libtelnet-devel libvncserver-devel libvorbis-devel libwebp-devel libwebsockets-devel mariadb mariadb-server nginx openssl-devel pango-devel policycoreutils-python pulseaudio-libs-devel setroubleshoot tomcat uuid-devel
1049 | } &
1050 | s_echo "n" "${Reset}-Installing required packages... "; spinner
1051 |
1052 | # Additional packages required by git
1053 | if [ $GUAC_SOURCE == "Git" ]; then
1054 | { yum install -y git libtool java-1.8.0-openjdk-devel; } &
1055 | s_echo "n" "-Installing packages required for git... "; spinner
1056 |
1057 | #Install Maven
1058 | cd /opt
1059 | {
1060 | wget ${MAVEN_URL}${MAVEN_BIN}
1061 | tar -xvzf ${MAVEN_BIN}
1062 | ln -s ${MAVEN_FN} maven
1063 | rm -rf /opt/${MAVEN_BIN}
1064 | } &
1065 | s_echo "n" "-Installing Apache Maven for git... "; spinner
1066 | export PATH=/opt/maven/bin:${PATH}
1067 | cd ~
1068 | fi
1069 |
1070 | createdirs
1071 | }
1072 |
1073 | ###### CREATE DIRECTORIES ##########################################
1074 | createdirs () {
1075 | {
1076 | rm -fr ${INSTALL_DIR}
1077 | mkdir -v /etc/guacamole
1078 | mkdir -vp ${INSTALL_DIR}{client,selinux}
1079 | mkdir -vp ${LIB_DIR}{extensions,lib}
1080 | mkdir -v /usr/share/tomcat/.guacamole/
1081 | } &
1082 | s_echo "y" "${Bold}Creating Required Directories... "; spinner
1083 |
1084 | cd ${INSTALL_DIR}
1085 |
1086 | downloadguac
1087 | }
1088 |
1089 | ###### DOWNLOAD GUACAMOLE ##########################################
1090 | downloadguac () {
1091 | s_echo "y" "${Bold}Downloading Guacamole Packages"
1092 |
1093 | # MySQL Connector
1094 | downloadmysqlconn () {
1095 | { wget ${MYSQL_CON_URL}${MYSQL_CON}.tar.gz; } &
1096 | s_echo "n" "-Downloading MySQL Connector package for installation... "; spinner
1097 | }
1098 |
1099 | if [ $GUAC_SOURCE == "Git" ]; then
1100 | { git clone ${GUAC_URL}${GUAC_SERVER}; } &
1101 | s_echo "n" "${Reset}-Cloning Guacamole Server package from git... "; spinner
1102 | { git clone ${GUAC_URL}${GUAC_CLIENT}; } &
1103 | s_echo "n" "-Cloning Guacamole Client package from git... "; spinner
1104 | downloadmysqlconn
1105 | else # Stable release
1106 | { wget "${GUAC_URL}source/${GUAC_SERVER}.tar.gz" -O ${GUAC_SERVER}.tar.gz; } &
1107 | s_echo "n" "${Reset}-Downloading Guacamole Server package for installation... "; spinner
1108 | { wget "${GUAC_URL}binary/${GUAC_CLIENT}.war" -O ${INSTALL_DIR}client/guacamole.war; } &
1109 | s_echo "n" "-Downloading Guacamole Client package for installation... "; spinner
1110 | { wget "${GUAC_URL}binary/${GUAC_JDBC}.tar.gz" -O ${GUAC_JDBC}.tar.gz; } &
1111 | s_echo "n" "-Downloading Guacamole JDBC Extension package for installation... "; spinner
1112 | downloadmysqlconn
1113 |
1114 | # Decompress Guacamole Packages
1115 | s_echo "y" "${Bold}Decompressing Guacamole Packages"
1116 |
1117 | {
1118 | tar xzvf ${GUAC_SERVER}.tar.gz
1119 | rm -f ${GUAC_SERVER}.tar.gz
1120 | mv -v ${GUAC_SERVER} server
1121 | } &
1122 | s_echo "n" "${Reset}-Decompressing Guacamole Server source... "; spinner
1123 |
1124 | {
1125 | tar xzvf ${GUAC_JDBC}.tar.gz
1126 | rm -f ${GUAC_JDBC}.tar.gz
1127 | mv -v ${GUAC_JDBC} extension
1128 | mv -v extension/mysql/guacamole-auth-jdbc-mysql-${GUAC_VER}.jar ${LIB_DIR}extensions/
1129 | } &
1130 | s_echo "n" "-Decompressing Guacamole JDBC extension... "; spinner
1131 | fi
1132 |
1133 | {
1134 | tar xzvf ${MYSQL_CON}.tar.gz
1135 | rm -f ${MYSQL_CON}.tar.gz
1136 | mv -v ${MYSQL_CON}/${MYSQL_CON}.jar ${LIB_DIR}lib/
1137 | } &
1138 | s_echo "n" "-Decompressing MySQL Connector... "; spinner
1139 |
1140 | installguacserver
1141 | }
1142 |
1143 | ###### INSTALL GUACAMOLE SERVER ####################################
1144 | installguacserver () {
1145 | s_echo "y" "${Bold}Install Guacamole Server"
1146 |
1147 | if [ $GUAC_SOURCE == "Git" ]; then
1148 | cd guacamole-server/
1149 | { autoreconf -fi; } &
1150 | s_echo "n" "${Reset}-Guacamole Server compile prep... "; spinner
1151 | else # Stable release
1152 | cd server
1153 | fi
1154 |
1155 | # Compile Guacamole Server
1156 | { ./configure --with-systemd-dir=/etc/systemd/system; } &
1157 | s_echo "n" "${Reset}-Compiling Guacamole Server Stage 1 of 4... "; spinner
1158 | { make; } &
1159 | s_echo "n" "-Compiling Guacamole Server Stage 2 of 4... "; spinner
1160 | { make install; } &
1161 | s_echo "n" "-Compiling Guacamole Server Stage 3 of 4... "; spinner
1162 | { ldconfig; } &
1163 | s_echo "n" "-Compiling Guacamole Server Stage 4 of 4... "; spinner
1164 | cd ..
1165 |
1166 | installguacclient
1167 | }
1168 |
1169 | ###### INSTALL GUACAMOLE CLIENT ####################################
1170 | installguacclient () {
1171 | s_echo "y" "${Bold}Install Guacamole Client"
1172 |
1173 | if [ $GUAC_SOURCE == "Git" ]; then
1174 | cd guacamole-client/
1175 | { mvn package; } &
1176 | s_echo "n" "${Reset}-Compiling Guacamole Client... "; spinner
1177 |
1178 | { mv -v guacamole/target/guacamole-${GUAC_VER}.war ${LIB_DIR}guacamole.war; } &
1179 | s_echo "n" "-Moving Guacamole Client... "; spinner
1180 | cd ..
1181 | else # Stable release
1182 | { mv -v client/guacamole.war ${LIB_DIR}guacamole.war; } &
1183 | s_echo "n" "${Reset}-Moving Guacamole Client... "; spinner
1184 | fi
1185 |
1186 | finishguac
1187 | }
1188 |
1189 | ###### FINALIZE GUACAMOLE INSTALLATION #############################
1190 | finishguac () {
1191 | s_echo "y" "${Bold}Setup Guacamole"
1192 |
1193 | # Generate Guacamole Configuration File
1194 | { echo "# Hostname and port of guacamole proxy
1195 | guacd-hostname: localhost
1196 | guacd-port: ${GUAC_PORT}
1197 | # MySQL properties
1198 | mysql-hostname: localhost
1199 | mysql-port: ${MYSQL_PORT}
1200 | mysql-database: ${DB_NAME}
1201 | mysql-username: ${DB_USER}
1202 | mysql-password: ${DB_PASSWD}
1203 | mysql-default-max-connections-per-user: 0
1204 | mysql-default-max-group-connections-per-user: 0" > /etc/guacamole/${GUAC_CONF}; } &
1205 | s_echo "n" "${Reset}-Generating Guacamole configuration file... "; spinner
1206 |
1207 | # Create Required Symlinks for Guacamole
1208 | {
1209 | ln -vfs ${LIB_DIR}guacamole.war /var/lib/tomcat/webapps
1210 | ln -vfs /etc/guacamole/${GUAC_CONF} /usr/share/tomcat/.guacamole/
1211 | ln -vfs ${LIB_DIR}lib/ /usr/share/tomcat/.guacamole/
1212 | ln -vfs ${LIB_DIR}extensions/ /usr/share/tomcat/.guacamole/
1213 | ln -vfs /usr/local/lib/freerdp/guac* /usr/lib${ARCH}/freerdp
1214 | } &
1215 | s_echo "n" "-Making required symlinks... "; spinner
1216 |
1217 | # Copy JDBC if using git
1218 | if [ $GUAC_SOURCE == "Git" ]; then
1219 | # Get JDBC from compiled client
1220 | { find ./guacamole-client/extensions -name "guacamole-auth-jdbc-mysql-${GUAC_VER}.jar" -exec mv -v {} ${LIB_DIR}extensions/ \;; } &
1221 | s_echo "n" "-Moving Guacamole JDBC extension to extensions dir... "; spinner
1222 | fi
1223 |
1224 | # Setup guacd user, group and permissions
1225 | {
1226 | # Create a user and group for guacd with a home folder but no login
1227 | groupadd ${GUACD_USER}
1228 | # The guacd user is created as a service account, no login but does get a home dir as needed by freerdp
1229 | useradd -r ${GUACD_USER} -m -s "/bin/nologin" -g ${GUACD_USER} -c ${GUACD_USER}
1230 |
1231 | # Set the user that runs the guacd service
1232 | sed -i "s/User=daemon/User=${GUACD_USER}/g" /etc/systemd/system/guacd.service
1233 | } &
1234 | s_echo "n" "-Setup guacd user... "; spinner
1235 |
1236 | appconfigs
1237 | }
1238 |
1239 | ###### DATABASE/TOMCAT/JKS SETUP ###################################
1240 | appconfigs () {
1241 | s_echo "y" "${Bold}Configure MariaDB"
1242 |
1243 | # Enable/Start MariaDB/MySQL Service
1244 | {
1245 | systemctl enable mariadb.service
1246 | systemctl restart mariadb.service
1247 | } &
1248 | s_echo "n" "${Reset}-Enable & start MariaDB service... "; spinner
1249 |
1250 | # Set MariaDB/MySQL Root Password
1251 | { mysqladmin -u root password ${MYSQL_PASSWD}; } &
1252 | s_echo "n" "-Setting root password for MariaDB... "; spinner
1253 |
1254 | # Run MariaDB/MySQL Secure Install
1255 | {
1256 | mysql_secure_installation <' /etc/tomcat/server.xml
1308 | sed -i "s/JKS_GUAC_PASSWD/${JKS_GUAC_PASSWD}/g" /etc/tomcat/server.xml
1309 | } &
1310 | s_echo "n" "${Reset}-Base Tomcat configuration... "; spinner
1311 |
1312 | {
1313 | # Tomcat RemoteIpValve (to pass remote host IP's from proxy to tomcat. Allows Guacamole to log remote host IPs)
1314 | sed -i '/<\/Host>/i\' /etc/tomcat/server.xml
1319 |
1320 | sed -i "s/GUAC_SERVER_IP/${GUAC_LAN_IP}/g" /etc/tomcat/server.xml
1321 | } &
1322 | s_echo "n" "-Set RemoteIpValve in Tomcat configuration... "; spinner
1323 |
1324 | {
1325 | # Add ErrorReportingValve to prevent displaying tomcat info on error pages
1326 | sed -i '/<\/Host>/i\' /etc/tomcat/server.xml
1329 | } &
1330 | s_echo "n" "-Set ErrorReportingVavle in Tomcat configuration... "; spinner
1331 |
1332 | # Java KeyStore Setup
1333 | { keytool -genkey -alias Guacamole -keyalg RSA -keysize ${JKSTORE_KEY_SIZE} -keystore /var/lib/tomcat/webapps/.keystore -storepass ${JKS_GUAC_PASSWD} -keypass ${JKS_GUAC_PASSWD} -noprompt -dname "CN='', OU='', O='', L='', S='', C=''"; } &
1334 | s_echo "y" "${Bold}Configuring the Java KeyStore... "; spinner
1335 |
1336 | # Enable/Start Tomcat and Guacamole Services
1337 | {
1338 | systemctl enable tomcat
1339 | systemctl restart tomcat
1340 | systemctl enable guacd
1341 | systemctl restart guacd
1342 | } &
1343 | s_echo "y" "${Bold}Enable & Start Tomcat and Guacamole Services... "; spinner
1344 |
1345 | nginxcfg
1346 | }
1347 |
1348 | ###### NGINX CONFIGURATION #########################################
1349 | nginxcfg () {
1350 | s_echo "y" "${Bold}Nginx Configuration"
1351 |
1352 | # Backup Nginx Configuration
1353 | { mv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf.ori.bkp; } &
1354 | s_echo "n" "${Reset}-Making Nginx config backup... "; spinner
1355 |
1356 | # HTTP Nginx Conf
1357 | { echo "server {
1358 | listen 80;
1359 | listen [::]:80;
1360 | server_name ${DOMAIN_NAME};
1361 | return 301 https://\$host\$request_uri;
1362 |
1363 | location ${GUAC_URIPATH} {
1364 | proxy_pass http://${GUAC_LAN_IP}:8080/guacamole/;
1365 | proxy_buffering off;
1366 | proxy_http_version 1.1;
1367 | proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
1368 | proxy_set_header Upgrade \$http_upgrade;
1369 | proxy_set_header Connection \$http_connection;
1370 | proxy_cookie_path /guacamole/ ${GUAC_URIPATH};
1371 | access_log off;
1372 | }
1373 | }" > /etc/nginx/conf.d/guacamole.conf
1374 | } &
1375 | s_echo "n" "${Reset}-Generate Nginx guacamole.config... "; spinner
1376 |
1377 | # HTTPS/SSL Nginx Conf
1378 | {
1379 | echo "server {
1380 | #listen 443 ssl http2 default_server;
1381 | #listen [::]:443 ssl http2 default_server;
1382 | server_name ${DOMAIN_NAME};
1383 | server_tokens off;
1384 | #ssl_certificate guacamole.crt;
1385 | #ssl_certificate_key guacamole.key; " > /etc/nginx/conf.d/guacamole_ssl.conf
1386 |
1387 | # If OCSP Stapling was selected add lines
1388 | if [ $OCSP_USE = true ]; then
1389 | if [[ -r /etc/resolv.conf ]]; then
1390 | NAME_SERVERS=$(awk '/^nameserver/{print $2}' /etc/resolv.conf | xargs)
1391 | fi
1392 |
1393 | if [[ -z $NAME_SERVERS ]]; then
1394 | NAME_SERVERS=$NAME_SERVERS_DEF
1395 | fi
1396 |
1397 | echo " #ssl_trusted_certificate guacamole.pem;
1398 | ssl_stapling on;
1399 | ssl_stapling_verify on;
1400 | resolver ${NAME_SERVERS} valid=30s;
1401 | resolver_timeout 30s;" >> /etc/nginx/conf.d/guacamole_ssl.conf
1402 | fi
1403 |
1404 | # If using >= 256-bit ciphers
1405 | if [ $NGINX_SEC = true ]; then
1406 | echo " ssl_ciphers 'TLS_CHACHA20_POLY1305_SHA256:TLS_AES_256_GCM_SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384';" >> /etc/nginx/conf.d/guacamole_ssl.conf
1407 | else
1408 | echo " ssl_ciphers 'TLS_CHACHA20_POLY1305_SHA256:TLS_AES_256_GCM_SHA384:TLS_AES_128_GCM_SHA256:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256';" >> /etc/nginx/conf.d/guacamole_ssl.conf
1409 | fi
1410 |
1411 | # Rest of HTTPS/SSL Nginx Conf
1412 | echo " ssl_protocols TLSv1.3 TLSv1.2;
1413 | ssl_ecdh_curve secp521r1:secp384r1:prime256v1;
1414 | ssl_prefer_server_ciphers on;
1415 | ssl_session_cache shared:SSL:10m;
1416 | ssl_session_timeout 1d;
1417 | ssl_session_tickets off;
1418 | add_header Referrer-Policy \"no-referrer\";
1419 | add_header Strict-Transport-Security \"max-age=15768000; includeSubDomains\" always;" >> /etc/nginx/conf.d/guacamole_ssl.conf
1420 |
1421 | # If CSP was enabled, add line, otherwise add but comment out (to allow easily manual toggle of the feature)
1422 | if [ $USE_CSP = true ]; then
1423 | echo " add_header Content-Security-Policy \"default-src 'none'; script-src 'self' 'unsafe-eval'; connect-src 'self' wss://${DOMAIN_NAME}; object-src 'self'; frame-src 'self'; img-src 'self' data:; style-src 'self' 'unsafe-inline'; font-src 'self'; form-action 'self'; base-uri 'self'; frame-ancestors 'self';\" always;" >> /etc/nginx/conf.d/guacamole_ssl.conf
1424 | else
1425 | echo " #add_header Content-Security-Policy \"default-src 'none'; script-src 'self' 'unsafe-eval'; connect-src 'self' wss://${DOMAIN_NAME}; object-src 'self'; frame-src 'self'; img-src 'self' data:; style-src 'self' 'unsafe-inline'; font-src 'self'; form-action 'self'; base-uri 'self'; frame-ancestors 'self';\" always;" >> /etc/nginx/conf.d/guacamole_ssl.conf
1426 | fi
1427 |
1428 | echo " add_header X-Frame-Options \"SAMEORIGIN\" always;
1429 | add_header X-Content-Type-Options \"nosniff\" always;
1430 | add_header X-XSS-Protection \"1; mode=block\" always;
1431 | proxy_hide_header Server;
1432 | proxy_hide_header X-Powered-By;
1433 | client_body_timeout 10;
1434 | client_header_timeout 10;
1435 |
1436 | location ${GUAC_URIPATH} {
1437 | proxy_pass http://${GUAC_LAN_IP}:8080/guacamole/;
1438 | proxy_buffering off;
1439 | proxy_http_version 1.1;
1440 | proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
1441 | proxy_set_header Upgrade \$http_upgrade;
1442 | proxy_set_header Connection \$http_connection;
1443 | proxy_cookie_path /guacamole/ \"${GUAC_URIPATH}; HTTPOnly; Secure; SameSite\";
1444 | access_log /var/log/nginx/guac_access.log;
1445 | error_log /var/log/nginx/guac_error.log;
1446 | }
1447 | }" >> /etc/nginx/conf.d/guacamole_ssl.conf
1448 | } &
1449 | s_echo "n" "-Generate Nginx guacamole_ssl.config... "; spinner
1450 |
1451 | # Nginx CIS hardening v1.0.0
1452 | {
1453 | # 2.3.2 Restrict access to Nginx files
1454 | find /etc/nginx -type d | xargs chmod 750
1455 | find /etc/nginx -type f | xargs chmod 640
1456 |
1457 | # 2.4.3 & 2.4.4 set keepalive_timeout and send_timeout to 1-10 seconds, default 65/60.
1458 | sed -i '/keepalive_timeout/c\keepalive_timeout 10\;' /etc/nginx/nginx.conf
1459 | # sed -i '/send_timeout/c\send_timeout 10\;' /etc/nginx/nginx.conf
1460 |
1461 | # 2.5.2 Reoving mentions of Nginx from index and error pages
1462 | ! read -r -d '' BLANK_HTML <<"EOF"
1463 |
1464 |
1465 |
1466 |
1467 |
1468 |
1469 |
1470 | EOF
1471 |
1472 | echo "${BLANK_HTML}" > /usr/share/nginx/html/index.html
1473 | echo "${BLANK_HTML}" > /usr/share/nginx/html/50x.html
1474 |
1475 | # 3.4 Ensure logs are rotated (may set this as a user defined parameter)
1476 | sed -i "s/daily/weekly/" /etc/logrotate.d/nginx
1477 | sed -i "s/rotate 52/rotate 13/" /etc/logrotate.d/nginx
1478 | } &
1479 | s_echo "n" "-Hardening Nginx config... "; spinner
1480 |
1481 | # Enable/Start Nginx Service
1482 | {
1483 | systemctl enable nginx
1484 | systemctl restart nginx
1485 | } &
1486 | s_echo "n" "-Enable & Start Nginx Service... "; spinner
1487 |
1488 | # Call each Guac extension function for those selected
1489 | if [ $INSTALL_LDAP = true ]; then ldapsetup; fi
1490 | if [ $INSTALL_TOTP = true ]; then totpsetup; fi
1491 | if [ $INSTALL_DUO = true ]; then duosetup; fi
1492 | if [ $INSTALL_RADIUS = true ]; then radiussetup; fi
1493 | if [ $INSTALL_CAS = true ]; then cassetup; fi
1494 | if [ $INSTALL_OPENID = true ]; then openidsetup; fi
1495 | if [ $INSTALL_CUST_EXT = true ]; then custsetup; fi
1496 |
1497 | selinuxsettings
1498 | }
1499 |
1500 | ###### LDAP SETUP ##################################################
1501 | ldapsetup () {
1502 | s_echo "y" "${Bold}Setup the LDAP Extension"
1503 |
1504 | # Append LDAP configuration lines to guacamole.properties
1505 | { echo "
1506 | # LDAP properties
1507 | ldap-hostname: ${LDAP_HOSTNAME}
1508 | ldap-port: ${LDAP_PORT}" >> /etc/guacamole/${GUAC_CONF}; } &
1509 | s_echo "n" "${Reset}-Updating guacamole.properties file for LDAP... "; spinner
1510 |
1511 | # LDAPS specific properties
1512 | if [ $SECURE_LDAP = true ]; then
1513 | {
1514 | KS_PATH=$(find "/usr/lib/jvm/" -name "cacerts")
1515 | keytool -storepasswd -new ${JKS_CACERT_PASSWD} -keystore ${KS_PATH} -storepass "changeit"
1516 | keytool -importcert -alias "ldaps" -keystore ${KS_PATH} -storepass ${JKS_CACERT_PASSWD} -file ${LDAPS_CERT_FULL} -noprompt
1517 |
1518 | echo "ldap-encryption-method: ssl" >> /etc/guacamole/${GUAC_CONF}
1519 | } &
1520 | s_echo "n" "-Updating guacamole.properties file for LDAPS... "; spinner
1521 | fi
1522 |
1523 | # Finish appending general LDAP configuration lines to guacamole.properties
1524 | { echo "ldap-user-base-dn: ${LDAP_BASE_DN}
1525 | ldap-search-bind-dn: ${LDAP_BIND_DN}
1526 | ldap-search-bind-password: ${LDAP_BIND_PW}
1527 | ldap-username-attribute: ${LDAP_UNAME_ATTR}
1528 | ldap-user-search-filter: ${LDAP_SEARCH_FILTER}
1529 | mysql-auto-create-accounts: true" >> /etc/guacamole/${GUAC_CONF}; } &
1530 | s_echo "n" "-Finishing updates to the guacamole.properties file for LDAP... "; spinner
1531 |
1532 | if [ $GUAC_SOURCE == "Git" ]; then
1533 | # Copy LDAP Extension to Extensions Directory
1534 | { find ./guacamole-client/extensions -name "${GUAC_LDAP}.jar" -exec mv -v {} ${LIB_DIR}extensions/ \;; } &
1535 | s_echo "n" "-Moving Guacamole LDAP extension to extensions dir... "; spinner
1536 | else # Stable release
1537 | # Download LDAP Extension
1538 | { wget "${GUAC_URL}binary/${GUAC_LDAP}.tar.gz" -O ${GUAC_LDAP}.tar.gz; } &
1539 | s_echo "n" "-Downloading LDAP extension... "; spinner
1540 |
1541 | # Decompress LDAP Extension
1542 | {
1543 | tar xzvf ${GUAC_LDAP}.tar.gz
1544 | rm -f ${GUAC_LDAP}.tar.gz
1545 | mv ${GUAC_LDAP} extension
1546 | } &
1547 | s_echo "n" "-Decompressing Guacamole LDAP Extension... "; spinner
1548 |
1549 | # Copy LDAP Extension to Extensions Directory
1550 | { mv -v extension/${GUAC_LDAP}/${GUAC_LDAP}.jar ${LIB_DIR}extensions/; } &
1551 | s_echo "n" "-Moving Guacamole LDAP extension to extensions dir... "; spinner
1552 | fi
1553 | }
1554 |
1555 | ###### TOTP SETUP ##################################################
1556 | totpsetup () {
1557 | s_echo "y" "${Bold}Setup the TOTP Extension"
1558 |
1559 | # Append TOTP configuration lines to guacamole.properties
1560 | { echo "
1561 | # TOTP properties
1562 | totp-issuer: ${TOTP_ISSUER}
1563 | totp-digits: ${TOTP_DIGITS}
1564 | totp-period: ${TOTP_PER}
1565 | totp-mode: ${TOTP_MODE}" >> /etc/guacamole/${GUAC_CONF}; } &
1566 | s_echo "n" "${Reset}-Updating guacamole.properties file for TOTP... "; spinner
1567 |
1568 | if [ $GUAC_SOURCE == "Git" ]; then
1569 | # Copy TOTP Extension to Extensions Directory
1570 | { find ./guacamole-client/extensions -name "${GUAC_TOTP}.jar" -exec mv -v {} ${LIB_DIR}extensions/ \;; } &
1571 | s_echo "n" "-Moving Guacamole TOTP extension to extensions dir... "; spinner
1572 | else # Stable release
1573 | # Download TOTP Extension
1574 | { wget "${GUAC_URL}binary/${GUAC_TOTP}.tar.gz" -O ${GUAC_TOTP}.tar.gz; } &
1575 | s_echo "n" "-Downloading TOTP extension... "; spinner
1576 |
1577 | # Decompress TOTP Extension
1578 | {
1579 | tar xzvf ${GUAC_TOTP}.tar.gz
1580 | rm -f ${GUAC_TOTP}.tar.gz
1581 | mv ${GUAC_TOTP} extension
1582 | } &
1583 | s_echo "n" "-Decompressing Guacamole TOTP Extension... "; spinner
1584 |
1585 | # Copy TOTP Extension to Extensions Directory
1586 | { mv -v extension/${GUAC_TOTP}/${GUAC_TOTP}.jar ${LIB_DIR}extensions/; } &
1587 | s_echo "n" "-Moving Guacamole TOTP extension to extensions dir... "; spinner
1588 | fi
1589 | }
1590 |
1591 | ###### DUO SETUP ###################################################
1592 | duosetup () {
1593 | # Placehold until extension is added
1594 | echo "duosetup"
1595 | }
1596 |
1597 | ###### RADIUS SETUP ################################################
1598 | radiussetup () {
1599 | # Placehold until extension is added
1600 | echo "radiussetup"
1601 | }
1602 |
1603 | ###### CAS SETUP ###################################################
1604 | cassetup () {
1605 | # Placehold until extension is added
1606 | echo "cassetup"
1607 | }
1608 |
1609 | ###### OpenID SETUP ################################################
1610 | openidsetup () {
1611 | # Placehold until extension is added
1612 | echo "openidsetup"
1613 | }
1614 |
1615 | ###### CUSTOM EXTENSION SETUP ######################################
1616 | custsetup () {
1617 | # Copy Custom Extension to Extensions Directory
1618 | { mv -v ${CUST_FULL} ${LIB_DIR}extensions/; } &
1619 | s_echo "y" "${Bold}Copying Custom Guacamole Extension to Extensions Dir... "; spinner
1620 | }
1621 |
1622 | ###### SELINUX SETTINGS ############################################
1623 | selinuxsettings () {
1624 | {
1625 | # Set Booleans
1626 | setsebool -P httpd_can_network_connect 1
1627 | setsebool -P httpd_can_network_relay 1
1628 | setsebool -P tomcat_can_network_connect_db 1
1629 |
1630 | # Guacamole Client Context
1631 | semanage fcontext -a -t tomcat_exec_t "${LIB_DIR}guacamole.war"
1632 | restorecon -v "${LIB_DIR}guacamole.war"
1633 |
1634 | # Guacamole JDBC Extension Context
1635 | semanage fcontext -a -t tomcat_exec_t "${LIB_DIR}extensions/guacamole-auth-jdbc-mysql-${GUAC_VER}.jar"
1636 | restorecon -v "${LIB_DIR}extensions/guacamole-auth-jdbc-mysql-${GUAC_VER}.jar"
1637 |
1638 | # MySQL Connector Extension Context
1639 | semanage fcontext -a -t tomcat_exec_t "${LIB_DIR}lib/${MYSQL_CON}.jar"
1640 | restorecon -v "${LIB_DIR}lib/${MYSQL_CON}.jar"
1641 |
1642 | # Guacamole LDAP Extension Context (If selected)
1643 | if [ $INSTALL_LDAP = true ]; then
1644 | semanage fcontext -a -t tomcat_exec_t "${LIB_DIR}extensions/${GUAC_LDAP}.jar"
1645 | restorecon -v "${LIB_DIR}extensions/${GUAC_LDAP}.jar"
1646 | fi
1647 |
1648 | # Guacamole TOTP Extension Context (If selected)
1649 | if [ $INSTALL_TOTP = true ]; then
1650 | # Placehold until extension is added
1651 | # echo "totp true"
1652 | semanage fcontext -a -t tomcat_exec_t "${LIB_DIR}extensions/${GUAC_TOTP}.jar"
1653 | restorecon -v "${LIB_DIR}extensions/${GUAC_TOTP}.jar"
1654 | fi
1655 |
1656 | # Guacamole Duo Extension Context (If selected)
1657 | if [ $INSTALL_DUO = true ]; then
1658 | # Placehold until extension is added
1659 | echo "duo true"
1660 | #semanage fcontext -a -t tomcat_exec_t "${LIB_DIR}extensions/${GUAC_LDAP}.jar"
1661 | #restorecon -v "${LIB_DIR}extensions/${GUAC_LDAP}.jar"
1662 | fi
1663 |
1664 | # Guacamole RADIUS Extension Context (If selected)
1665 | if [ $INSTALL_RADIUS = true ]; then
1666 | # Placehold until extension is added
1667 | echo "radius true"
1668 | #semanage fcontext -a -t tomcat_exec_t "${LIB_DIR}extensions/${GUAC_LDAP}.jar"
1669 | #restorecon -v "${LIB_DIR}extensions/${GUAC_LDAP}.jar"
1670 | fi
1671 |
1672 | # Guacamole CAS Extension Context (If selected)
1673 | if [ $INSTALL_CAS = true ]; then
1674 | # Placehold until extension is added
1675 | echo "cas true"
1676 | #semanage fcontext -a -t tomcat_exec_t "${LIB_DIR}extensions/${GUAC_LDAP}.jar"
1677 | #restorecon -v "${LIB_DIR}extensions/${GUAC_LDAP}.jar"
1678 | fi
1679 |
1680 | # Guacamole OpenID Extension Context (If selected)
1681 | if [ $INSTALL_OPENID = true ]; then
1682 | # Placehold until extension is added
1683 | echo "openid true"
1684 | #semanage fcontext -a -t tomcat_exec_t "${LIB_DIR}extensions/${GUAC_LDAP}.jar"
1685 | #restorecon -v "${LIB_DIR}extensions/${GUAC_LDAP}.jar"
1686 | fi
1687 |
1688 | # Guacamole Custom Extension Context (If selected)
1689 | if [ $INSTALL_CUST_EXT = true ]; then
1690 | semanage fcontext -a -t tomcat_exec_t "${LIB_DIR}extensions/${CUST_FN}"
1691 | restorecon -v "${LIB_DIR}extensions/${CUST_FN}"
1692 | fi
1693 | } &
1694 |
1695 | s_echo "y" "${Bold}Setting SELinux Context... "; spinner
1696 |
1697 | # Log SEL status
1698 | sestatus
1699 |
1700 | firewallsettings
1701 | }
1702 |
1703 | ###### FIREWALL SETTINGS ###########################################
1704 | firewallsettings () {
1705 | s_echo "y" "${Bold}Firewall Configuration"
1706 |
1707 | chk_installed "firewalld"
1708 |
1709 | # Ensure firewalld is enabled and started
1710 | {
1711 | if [ $RETVAL -eq 0 ]; then
1712 | systemctl enable firewalld
1713 | systemctl restart firewalld
1714 | fi
1715 | } &
1716 | s_echo "n" "${Reset}-firewalld is installed and started on the system... "; spinner
1717 |
1718 | # Backup firewall public zone config
1719 | { cp /etc/firewalld/zones/public.xml $fwbkpfile; } &
1720 | s_echo "n" "-Backing up firewall public zone to: $fwbkpfile "; spinner
1721 |
1722 | # Open HTTP and HTTPS ports
1723 | {
1724 | echo -e "Add new rule...\nfirewall-cmd --permanent --zone=public --add-service=http"
1725 | firewall-cmd --permanent --zone=public --add-service=http
1726 | echo -e "Add new rule...\nfirewall-cmd --permanent --zone=public --add-service=https"
1727 | firewall-cmd --permanent --zone=public --add-service=https
1728 | } &
1729 | s_echo "n" "-Opening HTTP and HTTPS service ports... "; spinner
1730 |
1731 | # Open 8080 and 8443 ports. Need to review if this is required or not
1732 | {
1733 | echo -e "Add new rule...\nfirewall-cmd --permanent --zone=public --add-port=8080/tcp"
1734 | firewall-cmd --permanent --zone=public --add-port=8080/tcp
1735 | echo -e "Add new rule...\nfirewall-cmd --permanent --zone=public --add-port=8443/tcp"
1736 | firewall-cmd --permanent --zone=public --add-port=8443/tcp
1737 | } &
1738 | s_echo "n" "-Opening ports 8080 and 8443 on TCP... "; spinner
1739 |
1740 | #echo -e "Reload firewall...\nfirewall-cmd --reload\n"
1741 | { firewall-cmd --reload; } &
1742 | s_echo "n" "-Reloading firewall... "; spinner
1743 |
1744 | sslcerts
1745 | }
1746 |
1747 | ###### SSL CERTIFICATE #############################################
1748 | sslcerts () {
1749 | s_echo "y" "${Bold}SSL Certificate Configuration"
1750 |
1751 | if [ $SSL_CERT_TYPE != "None" ]; then
1752 | # Lets Encrypt Setup (If selected)
1753 | if [ $SSL_CERT_TYPE = "LetsEncrypt" ]; then
1754 | # Install certbot from repo
1755 | { yum install -y certbot python2-certbot-nginx; } &
1756 | s_echo "n" "${Reset}-Downloading certboot tool... "; spinner
1757 |
1758 | # OCSP
1759 | {
1760 | if [ $OCSP_USE = true ]; then
1761 | certbot certonly --nginx --must-staple -n --agree-tos --rsa-key-size ${LE_KEY_SIZE} -m "${EMAIL_NAME}" -d "${DOMAIN_NAME}"
1762 | else # Generate without OCSP --must-staple
1763 | certbot certonly --nginx -n --agree-tos --rsa-key-size ${LE_KEY_SIZE} -m "${EMAIL_NAME}" -d "${DOMAIN_NAME}"
1764 | fi
1765 | } &
1766 | s_echo "n" "-Generating a ${SSL_CERT_TYPE} SSL Certificate... "; spinner
1767 |
1768 | # Symlink Lets Encrypt certs so renewal does not break Nginx
1769 | {
1770 | ln -vs "/etc/letsencrypt/live/${DOMAIN_NAME}/fullchain.pem" /etc/nginx/guacamole.crt
1771 | ln -vs "/etc/letsencrypt/live/${DOMAIN_NAME}/privkey.pem" /etc/nginx/guacamole.key
1772 | ln -vs "/etc/letsencrypt/live/${DOMAIN_NAME}/chain.pem" /etc/nginx/guacamole.pem
1773 | } &
1774 | s_echo "n" "-Creating symlinks to ${SSL_CERT_TYPE} SSL certificates... "; spinner
1775 |
1776 | # Setup automatic cert renewal
1777 | {
1778 | systemctl enable certbot-renew.service
1779 | systemctl enable certbot-renew.timer
1780 | systemctl list-timers --all | grep certbot
1781 | } &
1782 | s_echo "n" "-Setup automatic ${SSL_CERT_TYPE} SSL certificate renewals... "; spinner
1783 |
1784 | else # Use a Self-Signed Cert
1785 | { openssl req -x509 -sha512 -nodes -days 365 -newkey rsa:${SSL_KEY_SIZE} -keyout /etc/nginx/guacamole.key -out /etc/nginx/guacamole.crt -subj "/C=''/ST=''/L=''/O=''/OU=''/CN=''"; } &
1786 | s_echo "n" "${Reset}-Generating ${SSL_CERT_TYPE} SSL Certificate... "; spinner
1787 | fi
1788 |
1789 | # Nginx CIS v1.0.0 - 4.1.3 ensure private key permissions are restricted
1790 | {
1791 | ls -l /etc/nginx/guacamole.key
1792 | chmod 400 /etc/nginx/guacamole.key
1793 | } &
1794 | s_echo "n" "${Reset}-Changing permissions on SSL private key... "; spinner
1795 |
1796 | {
1797 | # Uncomment listen lines from Nginx guacamole_ssl.conf (fixes issue introduced by Nginx 1.16.0)
1798 | sed -i 's/#\(listen.*443.*\)/\1/' /etc/nginx/conf.d/guacamole_ssl.conf
1799 | # Uncomment cert lines from Nginx guacamole_ssl.conf
1800 | sed -i 's/#\(.*ssl_.*certificate.*\)/\1/' /etc/nginx/conf.d/guacamole_ssl.conf
1801 | } &
1802 | s_echo "n" "${Reset}-Enabling SSL certificate in guacamole_ssl.conf... "; spinner
1803 |
1804 | HTTPS_ENABLED=true
1805 | else # Cert is set to None
1806 | s_echo "n" "${Reset}-No SSL Cert selected..."
1807 |
1808 | # Will not force/use HTTPS without a cert, comment out redirect
1809 | { sed -i '/\(return 301 https\)/s/^/#/' /etc/nginx/conf.d/guacamole.conf; } &
1810 | s_echo "n" "${Reset}-Update guacamole.conf to allow HTTP connections... "; spinner
1811 |
1812 | HTTPS_ENABLED=false
1813 | fi
1814 |
1815 | showmessages
1816 | }
1817 |
1818 | ###### COMPLETION MESSAGES #########################################
1819 | showmessages () {
1820 | s_echo "y" "${Bold}Services"
1821 |
1822 | # Restart all services and log status
1823 | {
1824 | systemctl restart tomcat
1825 | systemctl status tomcat
1826 | systemctl restart guacd
1827 | systemctl status guacd
1828 | systemctl restart mariadb
1829 | systemctl status mariadb
1830 | systemctl restart nginx
1831 | systemctl status nginx
1832 |
1833 | # Verify that the guacd user is running guacd
1834 | ps aux | grep ${GUACD_USER}
1835 | ps -U ${GUACD_USER}
1836 | } &
1837 | s_echo "n" "${Reset}-Restarting all services... "; spinner
1838 |
1839 | # Completion messages
1840 | s_echo "y" "${Bold}${Green}##### Installation Complete! #####${Reset}"
1841 |
1842 | s_echo "y" "${Bold}Log Files"
1843 | s_echo "n" "${Reset}-Log file: ${logfile}"
1844 | s_echo "n" "-firewall backup file: ${fwbkpfile}"
1845 |
1846 | # Determine Guac server URL for web GUI
1847 | if [ ${DOMAIN_NAME} = "localhost" ]; then
1848 | GUAC_URL=${GUAC_LAN_IP}${GUAC_URIPATH}
1849 | else # Not localhost
1850 | GUAC_URL=${DOMAIN_NAME}${GUAC_URIPATH}
1851 | fi
1852 |
1853 | # Determine if HTTPS is used or not
1854 | if [ ${HTTPS_ENABLED} = true ]; then
1855 | HTTPS_MSG="${Reset} or ${Bold}https://${GUAC_URL}${Reset}"
1856 | else # HTTPS not used
1857 | HTTPS_MSG="${Reset}. Without a cert, HTTPS is not forced/available."
1858 | fi
1859 |
1860 | # Manage Guac
1861 | s_echo "y" "${Bold}To manage Guacamole"
1862 | s_echo "n" "${Reset}-go to: ${Bold}http://${GUAC_URL}${HTTPS_MSG}"
1863 | s_echo "n" "-The default username and password are: ${Red}guacadmin"
1864 |
1865 | # Recommendations
1866 | s_echo "y" "Important Recommendations${Reset}"
1867 |
1868 | if [ $INSTALL_LDAP = false ]; then
1869 | s_echo "n" "-It is highly recommended to create an admin account in Guacamole and delete/disable the default asap!"
1870 | else
1871 | s_echo "n" "-You should assign at least one AD/LDAP user to have full admin, see the directions on how-to at:"
1872 | s_echo "n" "${Green} https://github.com/Zer0CoolX/guacamole-install-rhel-7/wiki/LDAP-or-LDAPS-Authentication#important-manual-steps${Reset}"
1873 | s_echo "n" "-Afterwards, it is highly recommended to delete/disable the default admin account and/or create a uniquely named local admin account asap!"
1874 |
1875 | if [ $SECURE_LDAP = true ]; then
1876 | s_echo "n" "-Its highly recommended to remove the LDAPS certificate file from: ${LDAPS_CERT_FULL}"
1877 | fi
1878 | fi
1879 |
1880 | s_echo "y" "${Green}While not technically required, you should consider a reboot after verifying installation${Reset}"
1881 | s_echo "y" "${Bold}Contact ${Reset}${ADM_POC}${Bold} with any questions or concerns regarding this script\n"
1882 |
1883 | # Log cleanup to remove escape sequences caused by tput for formatting text
1884 | sed -i 's/\x1b\[[0-9;]*m\|\x1b[(]B\x1b\[m//g' ${logfile}
1885 |
1886 | tput sgr0 >&3
1887 | }
1888 |
1889 | ###### INSTALLATION EXECUTION ######################################
1890 | # Runs the install if the option was selected from the summary menu
1891 | if [ ${RUN_INSTALL} = true ]; then
1892 | tput sgr0 >&3
1893 | clear >&3
1894 | reposinstall
1895 | if [ $DEL_TMP_VAR = true ]; then
1896 | rm "$VAR_FILE"
1897 | fi
1898 | exit 0
1899 | fi
1900 |
--------------------------------------------------------------------------------