├── CHANGELOG.md ├── LICENSE ├── README.md ├── installTAK └── lib └── img ├── connector_wizard01.png ├── fqdn_wizard01.png ├── fqdn_wizard01a.png ├── fqdn_wizard02.png ├── fqdn_wizard03.png ├── fqdn_wizard04.png ├── takDP_wizard01.png ├── takDP_wizard02.png ├── takfedwizard01.png ├── takfedwizard02.png ├── takfedwizard03.png ├── takwizard_prompt01.png ├── takwizard_prompt02.png ├── takwizard_prompt03.png ├── takwizard_prompt03a.png ├── takwizard_prompt04.png ├── takwizard_prompt05.png ├── takwizard_prompt06.png ├── takwizard_prompt07.png ├── takwizard_prompt08.png └── webtak_options01.png /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | *Admittedly I'm not the best at documenting changes officially - I accept that. Let's start...* 3 | 4 | I found this site as my guide: [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) , and will attempt to follow this: [Semantic Versioning](https://semver.org/). 5 | 6 | ## [2.0.4] - 02JUN2025 7 | ### Fixed 🛠️ 8 | - [Rocky/RHEL/Debian] Corrected postgresql directory reference on removal, orignially had them reversed 9 | 10 | ## [2.0.3] - 30MAY2025 11 | ### Fixed 🛠️ 12 | - [Rocky/RHEL] Fixed dnf install vs dnf reinstall not being recognized when installing on Rocky/RHEL 13 | - [Let's Encrypt] Fixed issue with DataPackage not having the FQDN when using Let's Encrypt 14 | - [Debian] When reinstalling the TAK Server the PostgreSQL directory is not deleted 15 | 16 | ## [2.0.2] - 18MAY2025 17 | ### Changed 🔃 18 | - Updated MongoDB reference to v8.0 19 | - Changed webadmin cert for TAK Server Federation Hub to webadmin-hub to ensure that the admin cert is not overwritten if TAK Server and FedHub are installed on the same system 20 | - ### Depreciated 📦 21 | - [Debian] Removed gnupg and updated to gnupg2 22 | - [Debian] Removed MongoDB 7.0 References 23 | ### Fixed 🛠️ 24 | - Firewall does not apply QUIC settings when installing TAK Server 5.4 25 | - [Debian] TAK Server already installed being bypassed because of copy-paste error 26 | - [Docker] Fixed federation cert not being copied after installation 27 | - CoreConfig regeneration on reinstallation 28 | 29 | ## [2.0.1] - 21APR2025 30 | ### Fixed 🛠️ 31 | - Fixed uuidgen Ubuntu dependencies. 32 | 33 | ## [2.0.0] - 21APR2025 34 | ### Added ➕ 35 | - CHANGELOG to identify changes made to the project 36 | - Added system memory checker to ensure system has 8GB RAM or higher 37 | - TAK Server cleanup process to allow installTAK to be run on the same system without rebuilding [[Issue 9](https://github.com/myTeckNet/installTAK/issues/9)] 38 | ### Changed 🔃 39 | - Added TAK Server Federation Hub installation support for both DOCKER, RPM, and DEB [[Issue 8](https://github.com/myTeckNet/installTAK/issues/8)] 40 | ### Documentation📎 41 | - updated README to include the Federation Hub text dialogs 42 | ### Depreciated 📦 43 | - ufw soon to be replaced with firewalld to reduce additional dependencies 44 | ### Removed 🗑️ 45 | - tak-server-systemd submodule as it is no longer needed since TAK Server 5.3 added takserver and takserver-noplugin services 46 | ### Fixed 🛠️ 47 | - Raspberry Pi 4/5 hangs on starting services due to timeouts [[Issue 3](https://github.com/myTeckNet/installTAK/issues/3)] 48 | - Certificate Auto-Enrollment not being applied for DOCKER [[Issue 4](https://github.com/myTeckNet/installTAK/issues/4)] 49 | - Federation not being applied for DOCKER 50 | - Docker: Containers do not start automatically on system reboot [[Issue 7](https://github.com/myTeckNet/installTAK/issues/7)] 51 | ### Security 🔐 52 | - Added dialogs to prompt for enable/disable WebTAK user and admin authentication 53 | - Removed the takserver-db exposed port as it was not required -------------------------------------------------------------------------------- /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 | [tpc]: https://tak.gov 2 | [takServer]: https://tak.gov/products/tak-server 3 | [mytecknet-ca]: https://mytecknet.com/lets-sign-our-tak-server/ 4 | [walkthrough]: https://youtu.be/-mjqOsbfu9c 5 | # Description 6 | Using the [TAK Server installation binaries or Docker images][takserver] provided by [TAK.gov][tpc], the `installTAK` script provides a one-command installation solution for all TAK enthusiasts to get a TAK Server up and running in minutes on a freshly installed operating system. 7 | 8 | A video walk-through can be found [here][walkthrough]. 9 | 10 | **Federation Hub** instructions can be found [here](#federation-hub) 11 | 12 | ## Operating Systems Tested: 13 | All operating systems were tested with a minimal installation unless specifically annotated differently. 14 | - Rocky Linux 8 15 | - Rocky Linux 9 16 | - Red Hat Enterprise Linux (RHEL) 8 [**Not Hardened**] 17 | - Red Hat Enterprise Linux (RHEL) 9 [**Not Hardened**] 18 | - **Ubuntu Server 22 LTS** 19 | - **Ubuntu Server 24 LTS** 20 | - Docker version 24 21 | - PhotonOS w/ Docker Installed 22 | - Raspbian Desktop (64-bit) on **Raspberry Pi 5 w/ 8GB RAM** 23 | - Ubuntu 22/24 LTS on **Raspberry Pi 5 w/ 8GB RAM** 24 | 25 | **NOTE:** *Ubuntu Long Term Support (TLS)* versions tested only, all other versions may not work. 26 | 27 | # Installation 28 | To install the `installTAK` script from the source use the following commands to install the repository to a folder of your choice: 29 | ```shell 30 | git clone https://github.com/myTeckNetCode/installTAK.git ./installTAK 31 | ``` 32 | The above command will install the installTAK script in the current directory in a new folder called *installTAK*. After the repository has been cloned navigate to the *installTAK* directory. 33 | ``` 34 | cd installTAK 35 | ``` 36 | 37 | If you have not done so already, head to [TAK.gov][tpc], download the [TAK Server][takserver] installation files, and place them in this newly created *installTAK* directory. 38 | 39 | Run the following command to display the installation arguments: 40 | ```shell 41 | ./installTAK 42 | ``` 43 | Running `installTAK` alone will display the intended command usage.  For example is the **takserver-5.3-RELEASE4.noarch.rpm** and **takserver-public-gpg.key** are in the installTAK directory run the following: 44 | ```shell 45 | ./installTAK takserver-5.3-RELEASE4.noarch.rpm 46 | ``` 47 | For Ubuntu/Debian systems ensure to download the **deb_policy.pol** and place it in the *installTAK* directory. 48 | 49 | To enable **FIPS** Certificates append *--fips* at the end of the command. Custom certificates with stronger algorithms will be generated for use on systems with **FIPS** enabled. **ATAK** may not support certificates generated with these stronger algorithms. Use at your own discretion. 50 | ```shell 51 | ./installTAK takserver-5.3-RELEASE4.noarch.rpm --fips 52 | ``` 53 | 54 | ## Installation from Download ZIP 55 | Installation from ZIP requires external repository contents. Download the **installTAK.zip**. 56 | 57 | 1. Extract the installTAK.zip 58 | 59 | Final directory tree should look like this: 60 | ``` 61 | installTAK 62 | ├───lib 63 | │ └───img 64 | ``` 65 | ## Installation Command Examples: 66 | script usage: installTAK [path to TAK Server installer [rpm | deb | zip ]] 67 | ```shell 68 | # RPM 69 | ./installTAK takserver-*.noarch.rpm 70 | ``` 71 | ```shell 72 | # Ubuntu/Raspberry-Pi 73 | ./installTAK takserver-*_ALL.deb 74 | ``` 75 | ```shell 76 | # Docker/Container 77 | ./installTAK takserver-docker-*.zip 78 | ``` 79 | 80 | The `installTAK` script will detect the operating system it is being run against to determine the prerequisites needed to install the TAK Server. After the prerequisites have been installed, it will install the takserver binary or container. Following a complete installation or deployment of the TAK Server or container the TAK Server wizard will run to complete the remaining steps. 81 | 82 | ![TAK Wizard Prompt 01](lib/img/takwizard_prompt01.png "Welcome Splash") 83 | 84 | In the following prompt, enter the certificate information associated with your organization. All fields are required, City names with spaces are okay here. 85 | 86 | ![TAK Wizard Prompt 02](lib/img/takwizard_prompt02.png "PKI Configuration") 87 | 88 | If you wish to change the default certificate password, you have the option to do it here. 89 | 90 | ![TAK Wizard Prompt 03](lib/img/takwizard_prompt03.png "Change Default Certificate Password?") 91 | 92 | ### [Optional] Certificate Password 93 | If you select **yes** to change the default certificate password, enter your new password here. 94 | 95 | ![TAK Wizard Prompt 03a](lib/img/takwizard_prompt03a.png "Change Default Certificate Password?") 96 | 97 | Enter the name for your Root Certificate Authority (CA); otherwise, if you leave this blank a random name will be generated for you. 98 | 99 | ![TAK Wizard Prompt 04](lib/img/takwizard_prompt04.png "Root Certificate Authority (CA)") 100 | 101 | Enter the name of your Intermediate Certificate Authority (CA), this certificate is used to sign and issue certificates on behalf of the root CA; otherwise, if you leave this blank a random name will be generated for you. 102 | 103 | ![TAK Wizard Prompt 05](lib/img/takwizard_prompt05.png "Issuing Certificate Authority (CA)") 104 | 105 | Certificate enrollment allows you as the TAK Administrator to pass a preconfigured data package (**enrollmentDP.zip**) to users/clients that will prompt the user for credentials needed to authenticate to the TAK Server. Credentials are managed in the **Manage Users** UI of the TAK Server. Selecting **yes** here will open TCP Port `8446` inbound for enrollment. 106 | 107 | ![TAK Wizard Prompt 06](lib/img/takwizard_prompt06.png "Enable Certificate Auto-Enrollment?") 108 | 109 | Enabling TAK Server Federation allows you to share data that is owned by the TAK Server to other TAK Servers. Selecting **yes** here will open TCP Port `9001` for inbound TAK Federation. 110 | 111 | ![TAK Wizard Prompt 07](lib/img/takwizard_prompt07.png "Enable TAK Server Federation?") 112 | 113 | By default the TAK Server accepts connections over **SSL/TLS**. Additionally, the TAK Server supports the **QUIC** protocol. Select the appropriate connection type for this TAK Server. 114 | 115 | ![TAK Connection Types](lib/img/connector_wizard01.png "TAK Server Connection Types") 116 | 117 | When certificate enrollment is enabled it opens credentialed access via the API on TCP port `8446`. The practice of poor passwords and complexity could open this as a potential attack vector for administrative access. Select the options that are required for your deployment. Otherwise, selecting none will only allow certificate requests and not access to WebTAK features. 118 | 119 | ![WebTAK Security Options](lib/img/webtak_options01.png "WebTAK Security Options") 120 | 121 | The following prompt provides the configuration summary. Review this prompt for accuracy, select **Confirm** to commit all changes or select **Reset Wizard** to run through the TAK Wizard again. 122 | 123 | ![TAK Wizard Prompt 08](lib/img/takwizard_prompt08.png "Configuration Summary") 124 | 125 | ### [Optional] Certificate Enrollment 126 | If you selected **yes** to enable certificate auto-enrollment, you will be presented with an input to name this TAK Server description connection. This will be displayed on the TAK Clients as the friendly name. 127 | 128 | ![TAK Wizard Prompt 09](lib/img/takDP_wizard01.png "TAK Server Description") 129 | 130 | If your TAK Server is public facing and has a registered Domain Name and associated record you can select yes to enter the FQDN information here. Otherwise, selecting **no** will use the ip address for connections. 131 | 132 | ![TAK Wizard Prompt 10](lib/img/takDP_wizard02.png "Fully Qualified Domain Name") 133 | 134 | ### [Optional] Fully Qualified Domain Name (FQDN) Connections 135 | If you selected **yes** that this TAK Server supports FQDN Connections, you will be asked how this TAK Server will be trusted. If you or your organization have a registered Domain Name, select **Local**. 136 | 137 | ![TAK Wizard Prompt 10](lib/img/fqdn_wizard01.png "Fully Qualified Domain Name") 138 | 139 | Selecting Local will not create a certificate signing request as the local csr can be used or a local one be generated manually. Click [here][mytecknet-ca] learn more about using a third-party certificate signer. By default, the TAK Server IP Address is displayed. 140 | 141 | ![TAK Wizard Prompt 10a](lib/img/fqdn_wizard01a.png "Local Fully Qualified Domain Name") 142 | 143 | Selecting **Let's Encrypt** will utilize Let's Encrypt as the public Certificate Authority and will begin the public certificate signing request and issuance. 144 | 145 | Before continuing with the **Let's Encrypt** configuration ensure that you allow TCP port 80 into your network by either enabling port forwarding in your router to the TAK Server or cloud service provider (CSP). Consult your CSP for specific instructions. 146 | 147 | ![TAK Wizard Prompt 11](lib/img/fqdn_wizard02.png "Let's Encrypt Fully Qualified Domain Name") 148 | 149 | Enter the public host record for this TAK Server. This is commonly associated to the Host Record created in the Domain Name System (DNS) Server or your DNS cloud provider. Additionally, enter an email to associate this host record; by **default** this email **will not** be shared with *Let's Encrypt* or *Certbot* however is a requirement in the certificate request. 150 | 151 | ![TAK Wizard Prompt 12](lib/img/fqdn_wizard03.png "Let's Encrypt Fully Qualified Domain Name") 152 | 153 | The following prompt provides the configuration summary. Review this prompt for accuracy, select **Confirm** to commit all changes or select **Reset Wizard** to run through the Let's Encrypt Wizard again. 154 | 155 | ![TAK Wizard Prompt 13](lib/img/fqdn_wizard04.png "Let's Encrypt Fully Qualified Domain Name") 156 | 157 | ### Post Installation Files 158 | After successful installation the local *installTAK* repo will delete itself since its only meant to run once. The TAK Server installation binary and dependencies will be included. Based on your responses to the TAK Setup Wizard the following files will be created in the current users Linux home directory (/home/$USER) or if root (/root). 159 | 160 | - Certificate Auto-Enrollment 161 | - Yes: enrollmentDP.zip 162 | - No: caCert.p12 163 | - webadmin.p12 164 | 165 | # Federation-Hub 166 | The TAK Server Federation Hub enables forwarding of federated TAK data in a multi-hop setup. The hub supports centralized management of federation 167 | configuration using a hub and spoke topology. Instead of TAK server federates connecting to each other directly, they connect to a Federation Hub. The 168 | hub performs connection and trust management, and brokers federated data according to a policy defined by an administrator. The TAK Server Federation Hub software can be installed and run independently of TAK Server. 169 | 170 | ## Installation 171 | The `installTAK` script will detect the operating system it is being run against to determine the prerequisites needed to install the TAK Server Federation Hub. After the prerequisites have been installed, it will install the federation-hub binary or container. Following a complete installation or deployment of the TAK Server Federation Hub or container the TAK Server Federation Hub wizard will run to complete the remaining steps. 172 | 173 | At the following prompt, select the Federation version you wish to support to establish federated connections. Use the space bar to toggle between on or off. Selecting Version 2 will open TCP port `9102` and selecting Version 1 will open TCP port `9101` respectively. Enable the appropriate version to match your federated ecosystem. 174 | 175 | ![TAK Federation Hub Wizard Prompt 06](lib/img/takfedwizard01.png "Federation Hub Federation Version Support") 176 | 177 | Additionally, the TAK Server Federation Hub supports JSON Web Token (JWT) to establish an authenticated federation rather than the mutual client authentication with certificates. Selecting *Yes* will enable Federation Token Authentication and open TCP port `9103`. Otherwise, selecting *No* will disable this feature. 178 | 179 | ![TAK Federation Hub Wizard Prompt 07](lib/img/takfedwizard02.png "Federation Hub Token Federated Support") 180 | 181 | The following prompt provides the configuration summary. Review this prompt for accuracy, select **Confirm** to commit all changes or select **Reset Wizard** to run through the TAK Wizard again. 182 | 183 | ![TAK Federation Hub Wizard Prompt 08](lib/img/takfedwizard03.png "Federation Hub Configuration Summary") 184 | 185 | # Post Installation Tasks 186 | Following the execution of the `installTAK` the **webadmin.p12** is created by default. This is the TAK Server administrator certificate used to administer the TAK Server from the browser. This file needs to be copied from the TAK Server to your local workstation. Most modern operating systems come with secure shell (ssh) installed by default. If you don't feel comfortable with the command line interface (CLI) tools like [WinSCP](https://winscp.net/eng/index.php) are available. 187 | To copy files from Linux using SCP run the following command: 188 | **Syntax**: scp @:~/webadmin.p12 189 | ```shell 190 | scp takadmin@192.168.1.100:~/webadmin.p12 . 191 | ``` 192 | **Note**: There is a period (.) and a space following the .p12 file extension. This denotes the current working directory the terminal/shell is in. 193 | ```shell 194 | # [Windows] This will copy the webadmin.p12 to the current user's downloads directory 195 | scp takadmin@192.168.1.100:~/webadmin.p12 %userprofile%\Downloads 196 | ``` -------------------------------------------------------------------------------- /installTAK: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #Version 2.0 3 | #JR@myTeckNet 4 | #globalVariables 5 | fips=${2:-false} 6 | sVER="2.0.4" 7 | logfile="/tmp/.takinstall.log" 8 | RED='\033[0;31m' 9 | YELLOW='\033[0;33m' 10 | GREEN='\033[0;32m' 11 | NC='\033[0m' 12 | BASEDIR=$(dirname "$(readlink -f "$0")") 13 | curuser=$(printenv SUDO_USER) 14 | #homeDir=$(cat /etc/passwd | awk -F':' '/'"$curuser"'/ { print $6 }' | head -n 1) #REMOVE 15 | homeDir=$(getent passwd "$curuser" | cut -d: -f6) 16 | distro=$(awk -F'=' '/^ID=/ { print tolower($2) }' /etc/*-release | tr -d '"') 17 | distro_ver=$(awk -F'=' '/^VERSION_ID=/ { print tolower($2) }' /etc/*-release | tr -d '"') 18 | model=$(awk -F': ' '/^Model/ {print $2}' /proc/cpuinfo) 19 | memTotal=$(awk -F': ' '/^MemTotal/ {print $2}' /proc/meminfo | tr -d ' kB') 20 | # Script Abort 21 | abort() { 22 | if [[ -z $ERRoR ]]; then 23 | echo -e "${RED}ERR: An error has occurred, please check the log file at $logfile.${NC}" 24 | else 25 | echo -e "${RED}[$(date +%F-%T) ERR]: $ERRoR${NC}" 2>&1 | tee -a $logfile 26 | fi 27 | echo -e "${RED}Task aborted.${NC}" 28 | exit 1 29 | } 30 | #:::::::::: 31 | # Prerequisite Checks 32 | #:::::::::: 33 | prerequisite(){ 34 | echo -e "${YELLOW}Conducting Prerequisite Checks...${NC}" 2>&1 | tee -a $logfile 35 | # Determine Linux distribution 36 | if [[ -z $distro ]]; then 37 | ERRoR="Unable to determine Linux distribution." 38 | abort 39 | fi 40 | # Determine Total Memory // RAM 41 | if [[ $memTotal -lt 7800000 ]]; then 42 | ERRoR="Minimum 8GB of RAM required." 43 | abort 44 | fi 45 | # Determine Linux Version 46 | case $distro in 47 | rocky|rhel) 48 | if ! [[ $distro_ver =~ [8-9] ]]; then 49 | ERRoR="Platform Version Unsupported." 50 | abort 51 | else 52 | gpgKEY=$(find ${PWD} -name 'takserver-public-gpg.key' -type f -exec ls -t1 {} + | head -1) 53 | if [[ ! -f $gpgKEY ]]; then 54 | ERRoR="takserver-public-gpg.key not found within the directory." 55 | abort 56 | else 57 | rpm --import "$gpgKEY" 58 | fi 59 | fi 60 | ;; 61 | ubuntu) 62 | # Determine if Ubuntu Version is LTS 63 | distro_ver=$(awk -F'=' '/^VERSION=/ { print tolower($2) }' /etc/*-release | tr -d '"') 64 | if ! [[ $distro_ver =~ lts ]]; then 65 | ERRoR="Platform Version Unsupported." 66 | abort 67 | else 68 | # Determine if deb_policy.pol and takserver-public-gpg.key exists 69 | debPol=$(find ${PWD} -name 'deb_policy.pol' -type f -exec ls -t1 {} + | head -1) 70 | gpgKEY=$(find ${PWD} -name 'takserver-public-gpg.key' -type f -exec ls -t1 {} + | head -1) 71 | if [[ ! -f $gpgKEY ]]; then 72 | ERRoR="takserver-public-gpg.key not found within the directory." 73 | abort 74 | else 75 | if [[ ! -f $debPol ]]; then 76 | ERRoR="deb_policy.pol not found within the directory." 77 | abort 78 | else 79 | # Execute the Ubuntu/Debian Tasks 80 | if ! [[ $(apt list --installed | grep -wi 'debsig-verify') ]]; then 81 | apt-get install debsig-verify -y 2>&1 | tee -a $logfile 82 | fi 83 | debPolicyID=$(grep -o 'id="[^"]\+"' "${debPol}" | head -1 | tr -d 'id="') 84 | rm -Rf "/usr/share/debsig/keyrings/${debPolicyID}" && mkdir -p "/usr/share/debsig/keyrings/${debPolicyID}" 85 | rm -Rf "/etc/debsig/policies/${debPolicyID}" && mkdir -p "/etc/debsig/policies/${debPolicyID}" 86 | touch /usr/share/debsig/keyrings/${debPolicyID}/debsig.gpg 87 | if ! [[ $(apt list --installed | grep -wi 'gnupg2') ]]; then 88 | apt-get install -y gnupg2 2>&1 | tee -a $logfile 89 | fi 90 | gpg2 --no-default-keyring --keyring /usr/share/debsig/keyrings/${debPolicyID}/debsig.gpg --import ${gpgKEY} 91 | cp ${debPol} /etc/debsig/policies/${debPolicyID}/debsig.pol 92 | verify_deb=$(debsig-verify $1 | grep -Eo 'Verified') 93 | if [[ $verify_deb == "Verified" ]]; then 94 | echo -e "${GREEN}Signature Verified.${NC}" 2>&1 | tee -a $logfile 95 | else 96 | ERRoR="Unable to verify signature." 97 | abort 98 | fi 99 | fi 100 | fi 101 | fi 102 | ;; 103 | esac 104 | echo -e "${GREEN}[1/8]Prerequisite Checks Completed.${NC}" 2>&1 | tee -a $logfile 105 | } 106 | #:::::::::: 107 | # Begin RPM/DEB Installation 108 | #:::::::::: 109 | Install(){ 110 | takBinary=$1 111 | dir=/opt/tak 112 | # Gather System Information for logging 113 | cat /etc/*-release &> $logfile 114 | echo $model &>> $logfile 115 | # Update JVM limits 116 | echo -e "${YELLOW}Increasing JVM threads...${NC}" 117 | echo -e "\n# Applying JVM Limits.\n" &>> $logfile 118 | echo -e "* soft nofile 32768\n* hard nofile 32768" | tee --append /etc/security/limits.conf > /dev/null 119 | echo -e "${GREEN}[2/8] JVM Task Complete.${NC}" 2>&1 | tee -a $logfile 120 | # Install Extra Packages for Linux 121 | echo -e "${YELLOW}Installing Extra Packages for Linux...${NC}" 122 | echo -e "\n# Installing Extra Packages for Linux.\n" &>> $logfile 123 | case $distro in 124 | rocky) 125 | case $distro_ver in 126 | 8.*) dnf config-manager --set-enabled powertools 2>&1 | tee -a $logfile && dnf install epel-release -y 2>&1 | tee -a $logfile 127 | ;; 128 | 9.*) dnf config-manager --set-enabled crb 2>&1 | tee -a $logfile && dnf install epel-release -y 2>&1 | tee -a $logfile 129 | ;; 130 | esac 131 | echo -e "${GREEN}[3/8] EPEL Task Complete.${NC}" 2>&1 | tee -a $logfile 132 | ;; 133 | rhel) 134 | echo -e "${YELLOW}Checking RHEL Subscription Status...${NC}" 135 | sStatus=$(subscription-manager status | grep -Eo "Overall Status: .+" | sed 's/^.\{16\}//') && echo -e "$sStatus" &>> $logfile 136 | if [[ "$sStatus" == "Unknown" ]]; then 137 | ERRoR="System not registered with an entitlement server. You can use subscription-manager to register." 138 | abort 139 | fi 140 | case $distro_ver in 141 | 8.*) 142 | subscription-manager repos --enable codeready-builder-for-rhel-8-$(arch)-rpms 2>&1 | tee -a $logfile 143 | rpm --import https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-8 144 | dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm -y 2>&1 | tee -a $logfile 145 | ;; 146 | 9.*) 147 | subscription-manager repos --enable codeready-builder-for-rhel-9-$(arch)-rpms 2>&1 | tee -a $logfile 148 | rpm --import https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-9 149 | dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm -y 2>&1 | tee -a $logfile 150 | ;; 151 | esac 152 | echo -e "${GREEN}[3/8] EPEL Task Complete.${NC}" 2>&1 | tee -a $logfile 153 | ;; 154 | ubuntu|debian) 155 | echo -e "${GREEN}[3/8] Debian System detected, EPEL Skipped.${NC}" 2>&1 | tee -a $logfile 156 | ;; 157 | esac 158 | # Install PostgreSQL and PostGIS 159 | echo -e "${YELLOW}Installing PostgreSQL and PostGIS...${NC}" 160 | echo -e "\n# Installing PostgreSQL and PostGIS.\n" &>> $logfile 161 | case $distro in 162 | rocky|rhel) 163 | rpm --import https://download.postgresql.org/pub/repos/yum/keys/PGDG-RPM-GPG-KEY-RHEL 164 | case $distro_ver in 165 | 8.*) dnf install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-$(arch)/pgdg-redhat-repo-latest.noarch.rpm -y 2>&1 | tee -a $logfile 166 | ;; 167 | 9.*) dnf install https://download.postgresql.org/pub/repos/yum/reporpms/EL-9-$(arch)/pgdg-redhat-repo-latest.noarch.rpm -y 2>&1 | tee -a $logfile 168 | ;; 169 | esac 170 | dnf -qy module disable postgresql &>> $logfile 171 | echo -e "${GREEN}[4/8] PostgreSQL and PostGIS Task Complete.${NC}" 2>&1 | tee -a $logfile 172 | ;; 173 | ubuntu|debian) 174 | apt-get install curl ca-certificates -y 2>&1 | tee -a $logfile 175 | install -d /usr/share/postgresql-common/pgdg 176 | curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc 177 | sudo sh -c 'echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' 178 | echo -e "${GREEN}[4/8] PostgreSQL and PostGIS Task Complete.${NC}" 2>&1 | tee -a $logfile 179 | apt update -y 2>&1 | tee -a $logfile 180 | ;; 181 | esac 182 | # Install Java-OpenJDK 183 | echo -e "${YELLOW}Installing Java-OpenJDK...${NC}" 184 | echo -e "\n# Installing Java-OpenJDK.\n" &>> $logfile 185 | case $distro in 186 | rocky|rhel) 187 | dnf install java-17-openjdk-devel -y 2>&1 | tee -a $logfile 188 | ;; 189 | ubuntu|debian) 190 | apt-get install openjdk-17-jre -y 2>&1 | tee -a $logfile 191 | ;; 192 | esac 193 | echo -e "${GREEN}[5/8] Java-OpenJDK Task Complete.${NC}" 2>&1 | tee -a $logfile 194 | # Perform TAK Server Installation 195 | echo -e "${YELLOW}Installing $takBinary...${NC}" 196 | echo -e "\n# Installing $takBinary.\n" &>> $logfile 197 | case $distro in 198 | rocky|rhel) 199 | if [[ $(dnf list installed | grep -wi 'takserver.noarch') ]]; then 200 | dnf reinstall $takBinary -y 2>&1 | tee -a $logfile 201 | else 202 | dnf install $takBinary -y 2>&1 | tee -a $logfile 203 | fi 204 | servicePostgreSQL="postgresql-15" 205 | ;; 206 | ubuntu|debian) 207 | apt-get install ./$takBinary -y --reinstall 2>&1 | tee -a $logfile 208 | servicePostgreSQL="postgresql" 209 | ;; 210 | esac 211 | # Check TAK Server installation 212 | if [ $(systemctl is-active $servicePostgreSQL) == active ]; then 213 | echo -e "${GREEN}[6/8] Installation of $takBinary Task Complete.${NC}" 2>&1 | tee -a $logfile 214 | else 215 | echo -e "${RED}[6/8] Installation of $takBinary Task, PostgreSQL/PostGIS Service not found.${NC}" 2>&1 | tee -a $logfile 216 | ERRoR="Installation of $takBinary Task, PostgreSQL/PostGIS Service not found." 217 | abort 218 | fi 219 | # Configure SELinux 220 | echo -e "${YELLOW}Configuring SELinux...${NC}" 221 | echo -e "\n# Configuring SELinux.\n" &>> $logfile 222 | if [ $distro == "rocky" ]; then 223 | echo -e "\n# [Rocky Linux] Installing checkpolicy.\n" &>> $logfile 224 | dnf install checkpolicy -y 2>&1 | tee -a $logfile 225 | echo -e "${GREEN}[Rocky Linux] Installation of checkpolicy Task Complete.${NC}" 2>&1 | tee -a $logfile 226 | fi 227 | if [ $distro == "rocky" ] || [ $distro == "rhel" ]; then 228 | cd $dir && ./apply-selinux.sh 2>&1 | tee -a $logfile 229 | cd $homeDir 230 | fi 231 | echo -e "${GREEN}[7/8] Configuring SELinux Task Complete.${NC}" 2>&1 | tee -a $logfile 232 | # Install additional dependencies 233 | echo -e "${YELLOW}Install Additional Dependencies...${NC}" 234 | echo -e "\n# Installing Additional Dependencies.\n" &>> $logfile 235 | case $distro in 236 | rocky|rhel) 237 | dnf install dialog zip unzip -y 2>&1 | tee -a $logfile 238 | ;; 239 | ubuntu|debian) 240 | apt-get install dialog zip unzip uuid-runtime -y 2>&1 | tee -a $logfile 241 | ;; 242 | esac 243 | cp $dir/CoreConfig.example.xml $dir/CoreConfig.example.xml.bak 244 | echo -e "${GREEN}[8/8] Dependency Installation Task Complete.${NC}" 2>&1 | tee -a $logfile 245 | } 246 | fedhubInstall(){ 247 | fedhubBinary=$1 248 | dir=/opt/tak/federation-hub 249 | # Gather System Information for logging 250 | cat /etc/*-release &> $logfile 251 | # Install Java-OpenJDK 252 | echo -e "${YELLOW}Installing Java-OpenJDK...${NC}" 253 | echo -e "\n# Installing Java-OpenJDK.\n" &>> $logfile 254 | case $distro in 255 | rocky|rhel) 256 | dnf install java-17-openjdk-devel -y 2>&1 | tee -a $logfile 257 | ;; 258 | ubuntu|debian) 259 | apt-get install openjdk-17-jre -y 2>&1 | tee -a $logfile 260 | ;; 261 | esac 262 | echo -e "${GREEN}[1/5] Java-OpenJDK Task Complete.${NC}" 2>&1 | tee -a $logfile 263 | # Perform TAK Server Installation 264 | echo -e "${YELLOW}Installing $fedhubBinary...${NC}" 265 | echo -e "\n# Installing $fedhubBinary.\n" &>> $logfile 266 | case $distro in 267 | rocky|rhel) 268 | dnf install $fedhubBinary -y 2>&1 | tee -a $logfile 269 | ;; 270 | ubuntu|debian) 271 | apt-get install ./$fedhubBinary -y 2>&1 | tee -a $logfile 272 | ;; 273 | esac 274 | # Check TAK Server installation 275 | echo -e "${GREEN}[2/5] Installation of $takBinary Task Complete.${NC}" 2>&1 | tee -a $logfile 276 | # Install MongoDB 277 | echo -e "${YELLOW}Installing MongoDB...${NC}" 278 | echo -e "\n# Installing MongoDB.\n" &>> $logfile 279 | case $distro in 280 | rocky|rhel) 281 | cp $dir/scripts/db/mongodb-org.repo /etc/yum.repos.d/mongodb-org.repo 282 | dnf update -y && dnf install mongodb-org -y 2>&1 | tee -a $logfile 283 | ;; 284 | ubuntu|debian) 285 | distro_codename=$(awk -F'=' '/^VERSION_CODENAME=/ { print tolower($2) }' /etc/*-release | tr -d '"') 286 | # Delete the previous 7.0 if it exists 287 | if [[ -f '/etc/apt/sources.list.d/mongodb-org-7.0.list' ]]; then 288 | rm -v /etc/apt/sources.list.d/mongodb-org-7.0.list 289 | fi 290 | if [[ -f '/usr/share/keyrings/mongodb-server-8.0.gpg' ]]; then 291 | rm -v /usr/share/keyrings/mongodb-server-8.0.gpg 292 | fi 293 | curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | gpg2 -o /usr/share/keyrings/mongodb-server-8.0.gpg --dearmor 294 | case $distro_ver in 295 | 22.*) 296 | echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] https://repo.mongodb.org/apt/ubuntu $distro_codename/mongodb-org/8.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-8.0.list 297 | ;; 298 | 24.*) 299 | echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] https://repo.mongodb.org/apt/ubuntu $distro_codename/mongodb-org/8.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-8.0.list 300 | ;; 301 | esac 302 | apt update -y && apt-get install -y mongodb-org 2>&1 | tee -a $logfile 303 | ;; 304 | esac 305 | case $distro in 306 | rocky|rhel) 307 | if [[ $(dnf list installed | grep -wi 'mongodb-org' ) ]]; then 308 | echo -e "${GREEN}[3/5] Installing MongoDB Task Complete.${NC}" 2>&1 | tee -a $logfile 309 | else 310 | echo -e "${RED}[3/8] Installation of $takBinary Task, MongoDB Service not found.${NC}" 2>&1 | tee -a $logfile 311 | ERRoR="Installation of $takBinary Task, MongoDB Service not found." 312 | abort 313 | fi 314 | ;; 315 | ubuntu|debian) 316 | if [[ $(dpkg -l | grep -wi 'mongodb-org' ) ]]; then 317 | echo -e "${GREEN}[3/5] Installing MongoDB Task Complete.${NC}" 2>&1 | tee -a $logfile 318 | else 319 | echo -e "${RED}[3/8] Installation of $takBinary Task, MongoDB Service not found.${NC}" 2>&1 | tee -a $logfile 320 | ERRoR="Installation of $takBinary Task, MongoDB Service not found." 321 | abort 322 | fi 323 | ;; 324 | esac 325 | # Configure SELinux 326 | echo -e "${YELLOW}Configuring SELinux...${NC}" 327 | echo -e "\n# Configuring SELinux.\n" &>> $logfile 328 | if [ $distro == "rocky" ]; then 329 | echo -e "\n# [Rocky Linux] Installing checkpolicy.\n" &>> $logfile 330 | dnf install checkpolicy -y 2>&1 | tee -a $logfile 331 | echo -e "${GREEN}[Rocky Linux] Installation of checkpolicy Task Complete.${NC}" 2>&1 | tee -a $logfile 332 | fi 333 | if [ $distro == "rocky" ] || [ $distro == "rhel" ]; then 334 | cd $dir && ./apply-selinux.sh 2>&1 | tee -a $logfile 335 | cd $homeDir 336 | fi 337 | echo -e "${GREEN}[4/5] Configuring SELinux Task Complete.${NC}" 2>&1 | tee -a $logfile 338 | # Install additional dependencies 339 | echo -e "${YELLOW}Install Additional Dependencies...${NC}" 340 | echo -e "\n# Installing Additional Dependencies.\n" &>> $logfile 341 | case $distro in 342 | rocky|rhel) 343 | dnf install dialog zip unzip -y 2>&1 | tee -a $logfile 344 | ;; 345 | ubuntu|debian) 346 | apt-get install dialog zip unzip -y 2>&1 | tee -a $logfile 347 | ;; 348 | esac 349 | echo -e "${GREEN}[5/5] Dependency Installation Task Complete.${NC}" 2>&1 | tee -a $logfile 350 | } 351 | #:::::::::: 352 | # TAK Wizard Text User Interface 353 | #:::::::::: 354 | splash(){ 355 | exec 3>&1 356 | dialog --backtitle "$backTitle" --title "- TAK Setup Wizard-" --ok-label "Continue" --msgbox \ 357 | "WELCOME to the TAK initial setup script.\n\n"' 358 | '"This script will guide you through the initial configuration \nneeded to complete your setup of TAK Server.\n\n"' 359 | '"Navigation around the menu boxes is done using the or .\n\n"' 360 | '"Selecting options in a checklist is best done using the .\n\n"' 361 | '"Hit enter to continue." 0 0 362 | exec 3>&- 363 | } 364 | # Certificate Properties 365 | set-certproperties(){ 366 | public_IP=$(curl -s https://api.ipify.org) 367 | public_geoIP=$(curl -s http://ip-api.com/line/$public_IP?fields=8218) 368 | IFS=$'\n' read -r -d '' -a geoIPInfo < <(echo "$public_geoIP" | sed 's/ \([A-Za-z]*:\) /\n\1 /g') 369 | if ! [[ ${certconfig[0]} ]]; then 370 | Country=${geoIPInfo[0]} 371 | else 372 | Country=${certconfig[0]} 373 | fi 374 | if ! [[ ${certconfig[1]} ]]; then 375 | State=${geoIPInfo[1]} 376 | else 377 | State=${certconfig[1]} 378 | fi 379 | if ! [[ ${certconfig[2]} ]]; then 380 | City=${geoIPInfo[2]} 381 | else 382 | City=${certconfig[2]} 383 | fi 384 | if ! [[ ${certconfig[3]} ]]; then 385 | Organization="TAK" 386 | else 387 | Organization=${certconfig[3]} 388 | fi 389 | if ! [[ ${certconfig[4]} ]]; then 390 | Organizational_Unit="TAK" 391 | else 392 | Organizational_Unit=${certconfig[4]} 393 | fi 394 | oldIFS="$IFS" 395 | IFS=$'\n' 396 | exec 3>&1 397 | certconfig=($(dialog --clear --ok-label "Submit" --no-cancel --backtitle "$backTitle" --title "TAK PKI Configuration" \ 398 | --form "The following values are required for the self-signed certificate signing request. The information will be used to identify the certificate via its Distinguished Name or DN."' 399 | '"\n\nSet the following options for your certificate request."' 400 | '"\n\nUse the UP and DOWN Arrow Keys to navigate; TAB to SUBMIT." 0 0 0 \ 401 | "Country:" 1 1 "$Country" 1 20 30 0 \ 402 | "State:" 2 1 "$State" 2 20 30 0 \ 403 | "City:" 3 1 "$City" 3 20 30 0 \ 404 | "Organization:" 4 1 "$Organization" 4 20 30 0 \ 405 | "Organizational Unit:" 5 1 "$Organizational_Unit" 5 20 30 0 \ 406 | 2>&1 1>&3)) 407 | exec 3>&- 408 | } 409 | apply-certproperties(){ 410 | echo -e "${YELLOW}Applying Certificate Properties...${NC}" 411 | echo -e "\n# Applying Certificate Properties.\n" &>> $logfile 412 | certCountry=$(awk -F'=' '/^COUNTRY=/ { print $2 }' $dir/certs/cert-metadata.sh | tr -d '"') 413 | certState=$(awk -F'=' '/^STATE=/ { print $2 }' $dir/certs/cert-metadata.sh | tr -d '"') 414 | certCity=$(awk -F'=' '/^CITY=/ { print $2 }' $dir/certs/cert-metadata.sh | tr -d '"') 415 | certOrg=$(awk -F'=' '/^ORGANIZATION=/ { print $2 }' $dir/certs/cert-metadata.sh | tr -d '"') 416 | certOrgUnit=$(awk -F'=' '/^ORGANIZATIONAL_UNIT=/ { print $2 }' $dir/certs/cert-metadata.sh | tr -d '"') 417 | 418 | sed -i 8,15s/$certCountry/"'"${certconfig[0]}"'"/g $dir/certs/cert-metadata.sh 419 | sed -i 8,15s/$certState/"'"${certconfig[1]}"'"/g $dir/certs/cert-metadata.sh 420 | sed -i 8,15s/$certCity/"'"${certconfig[2]}"'"/g $dir/certs/cert-metadata.sh 421 | sed -i 8,15s/$certOrg/"'"${certconfig[3]}"'"/g $dir/certs/cert-metadata.sh 422 | sed -i 8,15s/$certOrgUnit/"'"${certconfig[4]}"'"/g $dir/certs/cert-metadata.sh 423 | echo -e "${GREEN}[1/7] Applying Certificate Properties Task Complete.${NC}" 2>&1 | tee -a $logfile 424 | } 425 | # Certificate Password 426 | set-certauthpass() { 427 | exec 3>&1 428 | # Prompt to chanage the default certificate password 429 | dialog --backtitle "$backTitle" --title "TAK PKI Configuration" --defaultno \ 430 | --yesno "By default the certificate password is 'atakatak'."' 431 | '"\n\nwould you like to change it?" 0 0 \ 432 | 2>&1 1>&3 433 | # Exit status 434 | certpasswd=$? 435 | if [ $certpasswd = 0 ]; then 436 | CAPASSWD=$CAPASSWD 437 | CAPASSWD=($(dialog --clear --no-cancel --backtitle "$backTitle" \ 438 | --title "TAK PKI Configuration" \ 439 | --inputbox "Enter new certificate password:" \ 440 | 0 0 \ 441 | 2>&1 1>&3)) 442 | # Exit status 443 | caResponse=$? 444 | else 445 | CAPASSWD=atakatak 446 | fi 447 | exec 3>&- 448 | } 449 | apply-certauthpass() { 450 | if [[ $caResponse = 0 ]]; then 451 | echo -e "${YELLOW}Applying Certificate Password...${NC}" 452 | echo -e "\n# Applying Certificate Password.\n" &>> $logfile 453 | sed -i s/atakatak/$CAPASSWD/g $dir/certs/cert-metadata.sh 454 | if [[ $fedhub == "true" ]]; then 455 | sed -i "s/atakatak/$CAPASSWD/g" $fedBrokeryml 456 | sed -i "s/atakatak/$CAPASSWD/g" $fedUIyml 457 | else 458 | sed -i "s/atakatak/$CAPASSWD/g" $exampleconfigxml 459 | fi 460 | echo -e "${GREEN}Applying Certificate Password Task Complete.${NC}" &>> $logfile 461 | else 462 | echo -e "${YELLOW}Certificate Password Unchanged...${NC}" 463 | echo -e "\n# Certificate Password Unchanged.\n" &>> $logfile 464 | CAPASSWD=atakatak 465 | fi 466 | } 467 | # Public/Private Key Infrastructure 468 | set-certauthname() { 469 | rootCA="${rootCA}" 470 | intCA="${intCA}" 471 | exec 3>&1 472 | # Prompt for Root Certificate Authority Name 473 | rootCA="$(dialog --clear --no-cancel --backtitle "$backTitle" \ 474 | --title "TAK PKI Configuration" \ 475 | --inputbox "The Root Certificate Authority is the first certificate in the PKI environment. It will be used to sign the issuing CA next."' 476 | '"\n\nEnter a name for the Root CA:" 0 0 \ 477 | 2>&1 1>&3)" 478 | if [[ $rootCA = "" ]]; then 479 | rootCA="$(date +%s%N | sha256sum | base64 | head -c 12)-ROOT-CA-01" 480 | else 481 | # Convert spaces to dash 482 | rootCA="${rootCA// /-}" 483 | # Change case to Upper 484 | rootCA=$(echo "$rootCA" | tr [a-z] [A-Z]) 485 | fi 486 | # Prompt for Intermediate Certificate Authority Name 487 | intCA="$(dialog --clear --no-cancel --backtitle "$backTitle" \ 488 | --title "TAK PKI Configuration" \ 489 | --inputbox "The Intermediate CA will act as the Issuing CA for all certificates on the behalf of the Root CA."' 490 | '"\n\nEnter a name for the Intermediate CA:" 0 0 \ 491 | 2>&1 1>&3)" 492 | if [[ $intCA = "" ]]; then 493 | intCA="$(date +%s%N | sha256sum | base64 | head -c 12)-CA-01" 494 | else 495 | # Convert spaces to dash 496 | intCA="${intCA// /-}" 497 | # Change case to Upper 498 | intCA=$(echo "$intCA" | tr [a-z] [A-Z]) 499 | fi 500 | exec 3>&- 501 | } 502 | apply-certauthname() { 503 | echo -e "${YELLOW}Creating Root Certificate Authority ${rootCA}...${NC}" 504 | echo -e "\n# Creating Root Certificate Authority ${rootCA}.\n" &>> $logfile 505 | # Create new RootCA 506 | cd $dir/certs || exit 507 | if [[ $fips == "true" ]]; then 508 | $makerootca --ca-name "$rootCA" --fips 509 | else 510 | $makerootca --ca-name "$rootCA" 511 | fi 512 | echo -e "${GREEN}[2/7]Creating Root Certificate Authority ${rootCA} Task Complete.${NC}" 2>&1 | tee -a $logfile 513 | # Create Intermediate CA 514 | echo -e "${YELLOW}Creating Intermediate/Issuing Certificate Authority ${intCA}...${NC}" 515 | echo -e "\n# Creating Intermediate/Issuing Certificate Authority ${intCA}.\n" &>> $logfile 516 | if [[ $fips == "true" ]]; then 517 | echo y | $makeCert ca "$intCA" --fips 518 | else 519 | echo y | $makeCert ca "$intCA" 520 | fi 521 | echo -e "${GREEN}[3/7] Creating Intermediate/Issuing Certificate Authority ${intCA} Task Complete.${NC}" 2>&1 | tee -a $logfile 522 | echo -e "${YELLOW}Updating the CoreConfiguration Files...${NC}" 523 | echo -e "\n# Updating the CoreConfiguration Files.\n" &>> $logfile 524 | if [[ $fedhub == "true" ]]; then 525 | # Update the federation-hub-ui.yaml for the truststore 526 | sed -i "s/truststore-root/truststore-$intCA/g" $fedUIyml 527 | else 528 | # Update the CoreConfig.example.xml for the truststore 529 | sed -i "s/truststore-root/truststore-$intCA/g" $exampleconfigxml 530 | # Update the CoreConfig.example.xml for the CRL 531 | crl=$"\ \n " 532 | # Append CRL 533 | sed -i "119i $crl" $exampleconfigxml # 118 // TAK Server 5.3 or Older 534 | echo -e "${GREEN}[4/7] Updating the CoreConfiguration Files Task Complete.${NC}" 2>&1 | tee -a $logfile 535 | fi 536 | # Create new TAK Server Certificate 537 | echo -e "${YELLOW}Creating the Client Certificate for ${HOSTNAME}...${NC}" 538 | echo -e "\n# Creating the Client Certificate for ${HOSTNAME}.\n" &>> $logfile 539 | if [[ $fips == "true" ]]; then 540 | $makeCert server ${HOSTNAME} --fips 541 | else 542 | $makeCert server ${HOSTNAME} 543 | fi 544 | if [[ $fedhub == "true" ]]; then 545 | sed -i "s/takserver.jks/${HOSTNAME}.jks/g" $fedBrokeryml 546 | sed -i "s/takserver.jks/${HOSTNAME}.jks/g" $fedUIyml 547 | else 548 | sed -i "s/takserver.jks/${HOSTNAME}.jks/g" $exampleconfigxml 549 | fi 550 | echo -e "${GREEN}[5/7] Creating the Client Certificate for ${HOSTNAME} Task Complete.${NC}" 2>&1 | tee -a $logfile 551 | } 552 | # Certificate Enrollment Configuration 553 | set-certautoenroll() { 554 | exec 3>&1 555 | dialog --backtitle "$backTitle" \ 556 | --title "Certificate Auto-Enrollment Configuration" \ 557 | --yesno "Certificate Auto-Enrollemnt enables the client to request a certificate from the TAK Server without the need to pass soft certificates to the TAK Clients."' 558 | '"\n\nDo you want to enable Certificate Auto-Enrollement?" 0 0 \ 559 | 2>&1 1>&3 560 | # Exit Status 561 | certAEnrollment=$? 562 | exec 3>&- 563 | } 564 | apply-certautoenroll() { 565 | if [ $certAEnrollment = 0 ]; then 566 | echo -e "${YELLOW}Applying Certificate Auto Enrollment Configuration...${NC}" 567 | echo -e "\n# Applying Certificate Auto Enrollment Configuration.\n" &>> $logfile 568 | CertificateAutoEnrollment=$"\ \n\n \n \n \n \n \n \n \n " 569 | sed -i "/<\/buffer>/a $CertificateAutoEnrollment" $exampleconfigxml 570 | sed -i 's///g' $exampleconfigxml 571 | case $distro in 572 | rocky|rhel) 573 | firewall-cmd --zone=public --add-port 8446/tcp --permanent >/dev/null 574 | firewall-cmd --reload >/dev/null 575 | ;; 576 | ubuntu|debian) 577 | apt-get install ufw -y 2>&1 | tee -a $logfile 578 | # Initial Firewall Rules 579 | ufw default deny incoming 580 | ufw default allow outgoing 581 | ufw allow ssh 582 | ufw allow 8446 >/dev/null 583 | ;; 584 | esac 585 | echo -e "${GREEN}[6/7] Applying Certificate Auto Enrollment Configuration Task Complete.${NC}" 2>&1 | tee -a $logfile 586 | else 587 | echo -e "${GREEN}[6/7] SKIP Certificate Auto Enrollment Configuration Task.${NC}" 2>&1 | tee -a $logfile 588 | fi 589 | } 590 | # TAK Federation Configuration 591 | set-takfederation() { 592 | exec 3>&1 593 | dialog --backtitle "$backTitle" \ 594 | --title "Federation Configuration" \ 595 | --yesno "Federation allows TAK clients connected to the TAK Server to share data across different connected networks.\n\n"' 596 | '"Federation requires the exchanging of the TAK Server CAs to establish a secure server to server connection for sharing information."' 597 | '"\n\nDo you want to enable TAK Server Federation v2?" 0 0 \ 598 | 2>&1 1>&3 599 | serverFederation=$? 600 | exec 3>&- 601 | } 602 | apply-takfederation() { 603 | if [ $serverFederation = 0 ]; then 604 | echo -e "${YELLOW}Applying TAK Server Federation Configuration...${NC}" 605 | echo -e "\n# Applying TAK Server Federation Configuration.\n" &>> $logfile 606 | fedEnabled=$"\ \n\n \n \n \n \n \n \n \n pref\n \n \n" 607 | if [ $certAEnrollment = 0 ]; then 608 | sed -i "/<\/security>/a $fedEnabled" $exampleconfigxml # 144 // TAK Server 5.3 or Older 609 | sed -i '156,165d' $exampleconfigxml # Remove older federation config 610 | else 611 | sed -i "/<\/security>/a $fedEnabled" $exampleconfigxml # 134 No Certificate Auto Enrollment 612 | sed -i '147,155d' $exampleconfigxml 613 | sed -i 's///g' $exampleconfigxml 614 | fi 615 | case $distro in 616 | rocky|rhel) 617 | firewall-cmd --zone=public --add-port 9001/tcp --permanent >/dev/null 618 | firewall-cmd --reload >/dev/null 619 | ;; 620 | ubuntu|debian) 621 | ufw allow 9001 >/dev/null 622 | ;; 623 | esac 624 | echo -e "${GREEN}[7/7] Applying TAK Server Federation Configuration Task Complete.${NC}" 2>&1 | tee -a $logfile 625 | else 626 | echo -e "${GREEN}[7/7] SKIP TAK Server Federation Configuration Task.${NC}" 2>&1 | tee -a $logfile 627 | fi 628 | } 629 | # Federation-Hub Version 630 | set-fedhubversion(){ 631 | oldIFS="$IFS" 632 | IFS=$'\n' 633 | exec 3>&1 634 | fedhubversion=($(dialog --clear --ok-label "Continue" --no-cancel --backtitle "$backTitle" --title "Federation Hub Federation Version" --checklist "TAK Federation Hub Server supports both version 1 (v1) and version 2 (v2) federation connection types.\n\n"' 635 | '"By default both versions are enabled; however, in most cases v2 is used for TAK Federations."' 636 | '"\n\nWhich versions do you wish to support?" 13 85 0 \ 637 | V2 "Enable Version 2" on \ 638 | V1 "Enable Version 1" on \ 639 | 2>&1 1>&3)) 640 | exec 3>&- 641 | IFS="$oldIFS" 642 | } 643 | apply-fedhubversion(){ 644 | if ! [[ $fedhubversion ]]; then 645 | fedhubversion="V2" 646 | else 647 | echo -e "${YELLOW}Applying TAK Federation Version Configuration...${NC}" 648 | echo -e "\n# Applying TAK Federation Hub Version Configuration.\n" &>> $logfile 649 | case $fedhubversion in 650 | "V2") 651 | sed -i "s/v1Enabled: true/v1Enabled: false/g" $fedBrokeryml 652 | case $distro in 653 | rocky|rhel) 654 | firewall-cmd --zone=public --add-port 9102/tcp --permanent >/dev/null 655 | firewall-cmd --reload >/dev/null 656 | ;; 657 | ubuntu|debian) 658 | ufw allow 9102 >/dev/null 659 | ;; 660 | esac 661 | ;; 662 | "V1") 663 | sed -i "s/v2Enabled: true/v2Enabled: false/g" $fedBrokeryml 664 | case $distro in 665 | rocky|rhel) 666 | firewall-cmd --zone=public --add-port 9101/tcp --permanent >/dev/null 667 | firewall-cmd --reload >/dev/null 668 | ;; 669 | ubuntu|debian) 670 | ufw allow 9101 >/dev/null 671 | ;; 672 | esac 673 | ;; 674 | "V2 V1") 675 | case $distro in 676 | rocky|rhel) 677 | firewall-cmd --zone=public --add-port 9101/tcp --add-port 9102/tcp --permanent >/dev/null 678 | firewall-cmd --reload >/dev/null 679 | ;; 680 | ubuntu|debian) 681 | ufw allow 9101 >/dev/null 682 | ufw allow 9102 >/dev/null 683 | ;; 684 | esac 685 | ;; 686 | esac 687 | echo -e "${GREEN}[6/7] Applying TAK Federation Hub Version Task Complete.${NC}" 2>&1 | tee -a $logfile 688 | fi 689 | } 690 | set-fedhubToken(){ 691 | exec 3>&1 692 | dialog --backtitle "$backTitle" \ 693 | --title "Federation Hub Token Federation" \ 694 | --yesno "TAK Federation Hub supports Token based Federations.\n\nBy default this is DISABLED, would you like to ENABLE it?" 7 65 \ 695 | 2>&1 1>&3 696 | fedhubToken=$? 697 | exec 3>&- 698 | } 699 | apply-fedhubToken(){ 700 | if [[ $fedhubToken = 0 ]]; then 701 | echo -e "${YELLOW}Applying TAK Federation Hub Token Configuration...${NC}" 702 | echo -e "\n# Applying TAK Federation Hub Token Configuration.\n" &>> $logfile 703 | tee --append $fedBrokeryml >/dev/null </dev/null 712 | firewall-cmd --reload >/dev/null 713 | ;; 714 | ubuntu|debian) 715 | ufw allow 9103 >/dev/null 716 | ;; 717 | esac 718 | fi 719 | echo -e "${GREEN}[7/7] Applying TAK Federation Hub Token Task Complete.${NC}" 2>&1 | tee -a $logfile 720 | else 721 | echo -e "${GREEN}[7/7] SKIPPED TAK Federation Hub Token Task Complete.${NC}" 2>&1 | tee -a $logfile 722 | fi 723 | } 724 | # Display the Review Changes Screen 725 | finalize-install() { 726 | exec 3>&1 727 | if [[ $certAEnrollment = 0 ]]; then 728 | enrollmentState="Enabled" 729 | elif [ $fedhub == "true" ]; then 730 | enrollmentState="OMIT [FederationHub]" 731 | else 732 | enrollmentState="Disabled" 733 | fi 734 | if [[ $serverFederation = 0 ]]; then 735 | federationState="Enabled" 736 | elif [ $fedhub == "true" ]; then 737 | federationState="OMIT [FederationHub]" 738 | else 739 | federationState="Disabled" 740 | fi 741 | if ! [[ $webTAKOptions ]]; then 742 | webTAKOptions="Disabled" 743 | fi 744 | if [[ $fedhub == "true" ]]; then 745 | takConnectorType="OMIT [FederationHub]" 746 | webTAKOptions="OMIT [FederationHub]" 747 | fi 748 | dialog --backtitle "$backTitle" --title "Configuration Summary" --scrollbar --defaultno --yes-label "Confirm" --no-label "Reset Wizard" --yesno \ 749 | "The TAK Server will be initialized with the following configuration:\n"' 750 | '"\nCertificate Information\n"' 751 | '"Country: ${certconfig[0]}\n"' 752 | '"State: ${certconfig[1]}\n"' 753 | '"City: ${certconfig[2]}\n"' 754 | '"Organization: ${certconfig[3]}\n"' 755 | '"Organizational_Unit: ${certconfig[4]}\n"' 756 | '"Certificate Password: $CAPASSWD\n"' 757 | '"Root CA Name: $rootCA\n"' 758 | '"Intermediate/Subordinate CA Name: $intCA\n"' 759 | '"\nOptional Configuration Settings\n"' 760 | '"Certificate Enrollment: $enrollmentState\n"' 761 | '"WebTAK Options: $webTAKOptions\n"' 762 | '"Federation: $federationState\n"' 763 | '"FIPS: $fips\n"' 764 | '"TAK Connection Type: $takConnectorType\n"' 765 | '"\nSelect Confirm to continue. Reset to Restart the Config Wizard." 0 0 2>&1 1>&3 766 | return=$? 767 | if [ $return = 1 ]; then 768 | if [[ $fedhub == "true" ]]; then 769 | fedWizard 770 | else 771 | takWizard 772 | fi 773 | else 774 | executeConfiguration 775 | fi 776 | exec 3>&- 777 | } 778 | enableFQDN(){ 779 | LEdir="/etc/letsencrypt" 780 | echo -e "${YELLOW}Installing CertBot...${NC}" 781 | echo -e "\n# Installing CertBot.\n" &>> $logfile 782 | case $distro in 783 | rocky|rhel) 784 | dnf install certbot -y 2>&1 | tee -a $logfile 785 | firewall-cmd --zone=public --add-port 80/tcp --permanent >/dev/null 786 | firewall-cmd --reload >/dev/null 787 | ;; 788 | ubuntu|debian) 789 | apt-get install certbot -y 2>&1 | tee -a $logfile 790 | ufw allow 80 >/dev/null 791 | ;; 792 | esac 793 | echo -e "${GREEN}Installation of CertBot Task Complete.${NC}" 2>&1 | tee -a $logfile 794 | exec 3>&1 795 | dialog --backtitle "$backTitle" --title "- Lets Encrypt Certificate -" --ok-label "Continue" --msgbox \ 796 | "Before continuing ensure that TCP port 80 is allowed into your network.\n\n"' 797 | '"This is either done through port-forwarding via your router or adding it to the network firewall for cloud based deployments.\n\n"' 798 | '"Hit enter to continue." 0 0 799 | exec 3>&- 800 | FQDNURL=${certREQ[0]} 801 | ACMEeMail=${certREQ[1]} 802 | oldIFS="$IFS" 803 | IFS=$'\n' 804 | exec 3>&1 805 | certREQ=($(dialog --clear --ok-label "Submit" --no-cancel --title "Lets Encrypt Certificate Request" \ 806 | --form "The following values are required for the public signing certificate signing request. The information will be used to identify the certificate via its Fully Qualified Domain Name (FQDN)."' 807 | '"\n\nUse the UP and DOWN Arrow Keys to navigate; TAB to SUBMIT." 0 0 0 \ 808 | "Server FQDN URL:" 1 1 "$FQDNURL" 1 20 30 0 \ 809 | "E-Mail for ACME CA Registration:" 2 1 "$ACMEeMail" 2 20 30 0 \ 810 | 2>&1 1>&3)) 811 | 812 | dialog --backtitle "$backTitle" --title "Let's Encrypt Configuration Summary" --scrollbar --defaultno --yes-label "Confirm" --no-label "Reset Wizard" --yesno \ 813 | "The TAK Server will be initialized with the following configuration:\n"' 814 | '"\nCertificate Information\n"' 815 | '"Server FQDN URL: ${certREQ[0]}\n"' 816 | '"E-Mail for ACME CA Registration: ${certREQ[1]}\n"' 817 | '"\nSelect Confirm to continue. Reset to Restart the Config Wizard." 0 0 2>&1 1>&3 818 | return=$? 819 | if [ $return = 1 ]; then 820 | enableFQDN 821 | else 822 | set-LEFQDN 823 | fi 824 | exec 3>&- 825 | IFS="$oldIFS" 826 | } 827 | set-LEFQDN(){ 828 | echo -e "${YELLOW}Requesting public certificate for: ${certREQ[0]}...${NC}" 829 | echo -e "\n# Requesting public certificate for: ${certREQ[0]}.\n" &>> $logfile 830 | certbot certonly -d ${certREQ[0]} -m ${certREQ[1]} --standalone --agree-tos --no-eff-email 831 | case $type in 832 | OS) 833 | openssl pkcs12 -export -in $LEdir/live/${certREQ[0]}/fullchain.pem -inkey $LEdir/live/${certREQ[0]}/privkey.pem -out $certs/${HOSTNAME}-le.p12 -name ${certREQ[0]} -passin pass:${CAPASSWD} -passout pass:${CAPASSWD} 834 | keytool -importkeystore -destkeystore $certs/${HOSTNAME}-le.jks -srckeystore $certs/${HOSTNAME}-le.p12 -srcstoretype pkcs12 -deststorepass "${CAPASSWD}" -destkeypass "${CAPASSWD}" -srcstorepass "${CAPASSWD}" 835 | sed -i "s#connector port=\"8446\" clientAuth=\"false\" _name=\"cert_https\"#connector port=\"8446\" clientAuth=\"false\" _name=\"cert_https_LE\" keystore=\"JKS\" keystoreFile=\"certs/files/${HOSTNAME}-le.jks\" keystorePass=\"${CAPASSWD}\"#g" $configxml 836 | sed -i "s#connector port=\"8446\" clientAuth=\"false\" _name=\"cert_https\"#connector port=\"8446\" clientAuth=\"false\" _name=\"cert_https_LE\" keystore=\"JKS\" keystoreFile=\"certs/files/${HOSTNAME}-le.jks\" keystorePass=\"${CAPASSWD}\"#g" $exampleconfigxml 837 | echo -e "${GREEN}Requesting public certificate for: ${certREQ[0]} Task Complete.${NC}" 2>&1 | tee -a $logfile 838 | # Create auto-renew script 839 | # https://www.baeldung.com/linux/letsencrypt-renew-ssl-certificate-automatically 840 | if [ -f /etc/cron.d/certbot ]; then 841 | sed -i "s#certbot -q renew --no-random-sleep-on-renew#certbot -q renew --no-random-sleep-on-renew $dir/renew-tak-le#g" /etc/cron.d/certbot 842 | else 843 | SLEEPTIME=$(awk 'BEGIN{srand(); print int(rand()*(3600+1))}'); echo "0 0,12 * * * root sleep $SLEEPTIME && certbot renew -q && /opt/tak/renew-tak-le" | sudo tee -a /etc/crontab > /dev/null 844 | tee /etc/cron.d/certbot-tak-le >/dev/null </dev/null <> $logfile 863 | echo -e "${YELLOW}Please Wait...${NC}" 864 | if grep -i 'raspberry pi' /proc/cpuinfo >/dev/null; then 865 | # Services must start in this order [Raspberry Pi] 866 | systemctl restart takserver-noplugins & 867 | ( tail -f -n0 $dir/logs/takserver-messaging.log & ) | grep -q "Started TAK Server messaging Microservice" 868 | else 869 | systemctl restart takserver.service & 870 | ( tail -f -n0 $dir/logs/takserver-messaging.log & ) | grep -q "Started TAK Server messaging Microservice" 871 | fi 872 | ;; 873 | Container) 874 | Ccerts=/opt/tak/certs/files 875 | docker cp -L $LEdir/live/${certREQ[0]}/fullchain.pem takserver:$Ccerts 876 | docker cp -L $LEdir/live/${certREQ[0]}/privkey.pem takserver:$Ccerts 877 | docker exec takserver bash -c "openssl pkcs12 -export -in $Ccerts/fullchain.pem -inkey $Ccerts/privkey.pem -out $Ccerts/${HOSTNAME}-le.p12 -name ${certREQ[0]} -passin pass:${CAPASSWD} -passout pass:${CAPASSWD}" 878 | docker exec takserver bash -c "keytool -importkeystore -destkeystore $Ccerts/${HOSTNAME}-le.jks -srckeystore $Ccerts/${HOSTNAME}-le.p12 -srcstoretype pkcs12 -deststorepass "${CAPASSWD}" -destkeypass "${CAPASSWD}" -srcstorepass "${CAPASSWD}"" 879 | sed -i "s#connector port=\"8446\" clientAuth=\"false\" _name=\"cert_https\"#connector port=\"8446\" clientAuth=\"false\" _name=\"cert_https_LE\" keystore=\"JKS\" keystoreFile=\"certs/files/${HOSTNAME}-le.jks\" keystorePass=\"${CAPASSWD}\"#g" $configxml 880 | sed -i "s#connector port=\"8446\" clientAuth=\"false\" _name=\"cert_https\"#connector port=\"8446\" clientAuth=\"false\" _name=\"cert_https_LE\" keystore=\"JKS\" keystoreFile=\"certs/files/${HOSTNAME}-le.jks\" keystorePass=\"${CAPASSWD}\"#g" $exampleconfigxml 881 | if [ -f /etc/cron.d/certbot ]; then 882 | sed -i "s#certbot -q renew --no-random-sleep-on-renew#certbot -q renew --no-random-sleep-on-renew $dir/renew-tak-le#g" /etc/cron.d/certbot 883 | else 884 | tee $dir/certbot-tak-le >/dev/null < /dev/null 890 | chmod 644 $dir/certbot-tak-le 891 | systemctl restart crond.service 892 | fi 893 | tee $dir/renew-tak-le >/dev/null <&1 | tee -a $logfile 907 | echo -e "${GREEN}Let's Encrypt Certificate Task Complete.${NC}" 908 | } 909 | # Client Connection Support 910 | set-takConnector(){ 911 | oldIFS="$IFS" 912 | IFS=$'\n' 913 | exec 3>&1 914 | takConnectorType=($(dialog --clear --ok-label "Continue" --no-cancel --backtitle "$backTitle" --title "TAK Server Connection Type" --checklist "To connect to the TAK Server, clients must connect securely to an open port on both the server and network.\n\n"' 915 | '"The TAK Server supports two types of connections: TCP/SSL and UDP/QUIC. Select the type of connection to support based on your network requirements.\n\n"' 916 | '"- TCP/SSL is the default and communicates over TCP/8089, selecting this option will allow TCP inbound connections to this server.\n\n"' 917 | '"- UDP/QUIC is an alternate communications port over UDP/8090, selecting this option will allow UDP inbound connections to this server.\n\n"' 918 | '"Select SSL, QUIC or both to support this type of connection." 19 85 0 \ 919 | SSL "Enable TCP/SSL/TLS Connections" on \ 920 | QUIC "Enable UDP/QUIC Connections" off \ 921 | 2>&1 1>&3)) 922 | exec 3>&- 923 | IFS="$oldIFS" 924 | } 925 | apply-takConnector(){ 926 | if ! [[ $takConnectorType ]]; then 927 | exec 3>&1 928 | dialog --clear --infobox "Try Again" 10 30 929 | exec 3>&- 930 | set-takConnector 931 | else 932 | case $takConnectorType in 933 | "SSL") 934 | case $distro in 935 | rocky|rhel) 936 | firewall-cmd --zone=public --add-port 8089/tcp --permanent >/dev/null 937 | firewall-cmd --reload >/dev/null 938 | ;; 939 | ubuntu|debian) 940 | ufw allow 8089 >/dev/null 941 | ;; 942 | esac 943 | ;; 944 | "QUIC") 945 | sed -i "7i " $exampleconfigxml 946 | case $distro in 947 | rocky|rhel) 948 | firewall-cmd --zone=public --add-port 8090/udp --permanent >/dev/null 949 | firewall-cmd --reload >/dev/null 950 | ;; 951 | ubuntu|debian) 952 | ufw allow 8090/udp >/dev/null 953 | ;; 954 | esac 955 | ;; 956 | "SSL QUIC") 957 | sed -i "7i " $exampleconfigxml 958 | case $distro in 959 | rocky|rhel) 960 | firewall-cmd --zone=public --add-port 8089/tcp --add-port 8090/udp --permanent >/dev/null 961 | firewall-cmd --reload >/dev/null 962 | ;; 963 | ubuntu|debian) 964 | ufw allow 8089 >/dev/null 965 | ufw allow 8090/udp >/dev/null 966 | ;; 967 | esac 968 | ;; 969 | esac 970 | fi 971 | } 972 | # WebTAK Options 973 | set-webTAKOptions(){ 974 | if [ $certAEnrollment = 0 ]; then 975 | oldIFS="$IFS" 976 | IFS=$'\n' 977 | exec 3>&1 978 | webTAKOptions=($(dialog --clear --ok-label "Continue" --no-cancel --backtitle "$backTitle" --title "TAK Server WebTAK Options" --checklist "With Certificate Enrollment enabled users can authenitcate using credentials for WebTAK.\n\n"' 979 | '"As the administrator the following options are available to secure access to WebTAK using credentials. The use of poor password complexity can increase the risk to the TAK Server.\n\n"' 980 | '"- enableAdminUI enables the management console for administrator accounts who successfully authenticate.\n\n"' 981 | '"- enableWebtak enables WebTAK over credentials at https://$serverIP:8446/webtak for example.\n\n"' 982 | '"- enableNonAdminUI enabled the management console for any non-administrator who successfully authenticates.\n\n"' 983 | '"Select the options you wish to enable:" 24 85 0 \ 984 | enableAdminUI "Enable Admin UI" off \ 985 | enableWebtak "Enable WebTAK" off \ 986 | enableNonAdminUI "Enable NonAdminUI" off \ 987 | 2>&1 1>&3)) 988 | exec 3>&- 989 | IFS="$oldIFS" 990 | fi 991 | } 992 | apply-webTAKOptions(){ 993 | if [ $certAEnrollment = 0 ]; then 994 | if ! [[ $webTAKOptions ]]; then 995 | # Turn off all options 996 | sed -i 's/"cert_https"\//"cert_https" enableAdminUI="false" enableWebtak="false" enableNonAdminUI="false"\//g' $exampleconfigxml 997 | else 998 | case $webTAKOptions in 999 | "enableAdminUI") 1000 | sed -i 's/"cert_https"\//"cert_https" enableAdminUI="true" enableWebtak="false" enableNonAdminUI="false"\//g' $exampleconfigxml 1001 | ;; 1002 | "enableWebtak") 1003 | sed -i 's/"cert_https"\//"cert_https" enableAdminUI="false" enableWebtak="true" enableNonAdminUI="false"\//g' $exampleconfigxml 1004 | ;; 1005 | "enableNonAdminUI") 1006 | sed -i 's/"cert_https"\//"cert_https" enableAdminUI="false" enableWebtak="false" enableNonAdminUI="true"\//g' $exampleconfigxml 1007 | ;; 1008 | "enableAdminUI enableWebtak") 1009 | sed -i 's/"cert_https"\//"cert_https" enableAdminUI="true" enableWebtak="true" enableNonAdminUI="false"\//g' $exampleconfigxml 1010 | ;; 1011 | "enableAdminUI enableNonAdminUI") 1012 | sed -i 's/"cert_https"\//"cert_https" enableAdminUI="true" enableWebtak="false" enableNonAdminUI="true"\//g' $exampleconfigxml 1013 | ;; 1014 | "enableWebtak enableNonAdminUI") 1015 | sed -i 's/"cert_https"\//"cert_https" enableAdminUI="false" enableWebtak="true" enableNonAdminUI="true"\//g' $exampleconfigxml 1016 | ;; 1017 | "enableAdminUI enableWebtak enableNonAdminUI") 1018 | sed -i 's/"cert_https"\//"cert_https" enableAdminUI="true" enableWebtak="true" enableNonAdminUI="true"\//g' $exampleconfigxml 1019 | ;; 1020 | *) 1021 | sed -i 's/"cert_https"\//"cert_https" enableAdminUI="false" enableWebtak="false" enableNonAdminUI="false"\//g' $exampleconfigxml 1022 | ;; 1023 | esac 1024 | fi 1025 | fi 1026 | } 1027 | # Establish the DataPackage/Enrollment Process 1028 | create-datapackage() { 1029 | # Create temp dir 1030 | mkdir /tmp/enrollmentDP 1031 | cd /tmp/enrollmentDP || exit 1032 | UUID=$(uuidgen -r) 1033 | IFS=$'\n' 1034 | serverIP=$(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1) 1035 | exec 3>&1 1036 | serverDesc="${HOSTNAME}" 1037 | serverDesc=($(dialog --clear --no-cancel --backtitle "$backTitle" --title "TAK Server Description" --ok-label "Create DataPackage" \ 1038 | --inputbox "Enter a short description of this TAK Server connection to be displayed on the TAK Client." \ 1039 | 0 0 "TAK Server" 2>&1 1>&3)) 1040 | dialog --backtitle "$backTitle" --title "Configure FQDN" --defaultno --yesno "Does this TAK Server support FQDN connections?" 0 0 2>&1 1>&3 1041 | # Exit Status 1042 | setFQDN=$? 1043 | # Set FQDN YES 1044 | if [ $setFQDN = 0 ]; then 1045 | dialog --backtitle "$backTitle" --title "Configure FQDN" --defaultno --no-label Local --yes-label Lets-Encrypt \ 1046 | --yesno "How will this server be trusted?\n\n"' 1047 | '"Local: Use this option if your using an internal DNS and will setup your own trust anchor.\n\n"' 1048 | '"Let's Encrypt: This will request a public certificate from Let's Encrypt and configure the server appropriately.\n\n"' 1049 | '"Select the appropriate FQDN configuration for your environment." \ 1050 | 0 0 2>&1 1>&3 1051 | # Exit Status 1052 | optFQDN=$? 1053 | # FQDN YES 1054 | if [ $optFQDN = 0 ]; then 1055 | enableFQDN 1056 | else 1057 | resolve_dns=$(curl -s https://api.hackertarget.com/reversedns/?q=$public_IP) 1058 | IFS=' ' read -r -a resolveDNS <<< "$resolve_dns" 1059 | if ! [[ ${resolveDNS[1]} ]]; then 1060 | FQDName=${resolveDNS[1]} 1061 | else 1062 | FQDName=$public_IP 1063 | fi 1064 | serverEndPoint=($(dialog --clear --no-cancel --backtitle "$backTitle" --title "TAK Server Fully Qualified Domain Name (FQDN) Connection" --ok-label "Create DataPackage" \ 1065 | --inputbox "Enter the FQDN of this TAK Server connection; otherwise, enter the TAK Server Public IP Address." \ 1066 | 0 0 "$FQDName" 2>&1 1>&3)) 1067 | fi 1068 | else 1069 | serverEndPoint=$serverIP 1070 | fi 1071 | exec 3>&- 1072 | case $takConnectorType in 1073 | "SSL") connectorPort="8089:ssl";; 1074 | "QUIC") connectorPort="8090:quic";; 1075 | "SSL QUIC") connectorPort="8089:ssl" 1076 | connectorPort2="8090:quic";; 1077 | esac 1078 | # config.cnf 1079 | tee config.pref >/dev/null < 1081 | 1082 | 1083 | 1 1084 | $serverDesc 1085 | true 1086 | $serverEndPoint:$connectorPort 1087 | cert/caCert.p12 1088 | $CAPASSWD 1089 | true 1090 | true 1091 | Cache credentials 1092 | 1093 | 1094 | true 1095 | true 1096 | 8443 1097 | 8446 1098 | Blue 1099 | Team Member 1100 | 1101 | 1102 | EOF 1103 | # MANIFEST.xml 1104 | tee MANIFEST.xml >/dev/null < 1106 | 1107 | 1108 | 1109 | 1110 | 1111 | 1112 | 1113 | 1114 | 1115 | 1116 | EOF 1117 | echo $serverDesc > $dir/takdatapackagedesc 1118 | echo $serverEndPoint >> $dir/takdatapackagedesc 1119 | cp $certs/truststore-$intCA.p12 /tmp/enrollmentDP/caCert.p12 1120 | zip -j $homeDir/enrollmentDP.zip /tmp/enrollmentDP/* 1121 | if [ -v connectorPort2 ];then 1122 | sed -i "s/8089:ssl/$connectorPort2/g" /tmp/enrollmentDP/config.pref 1123 | sed -i "s/enrollmentDP/enrollmentDP-QUIC/g" /tmp/enrollmentDP/MANIFEST.xml 1124 | zip -j $homeDir/enrollmentDP-QUIC.zip /tmp/enrollmentDP/* 1125 | fi 1126 | chown -R "$curuser":"$curuser" $homeDir 1127 | cd /tmp 1128 | rm -Rf enrollmentDP 1129 | IFS="$oldIFS" 1130 | } 1131 | create-webadmin(){ 1132 | echo -e "${YELLOW}Creating Admin Certificate...${NC}" 1133 | echo -e "\n# Creating Admin Certificate.\n" &>> $logfile 1134 | cd $dir/certs || exit 1135 | if [[ $fips == "true" ]]; then 1136 | if [[ $fedhub == "true" ]]; then 1137 | echo y | $makeCert client webadmin-fed --fips 1138 | else 1139 | echo y | $makeCert client webadmin --fips 1140 | fi 1141 | else 1142 | if [[ $fedhub == "true" ]]; then 1143 | echo y | $makeCert client webadmin-fed 1144 | else 1145 | echo y | $makeCert client webadmin 1146 | fi 1147 | fi 1148 | if [[ $fedhub == "true" ]]; then 1149 | java -jar $dir/jars/federation-hub-manager.jar $certs/webadmin-fed.pem 1150 | else 1151 | java -jar $dir/utils/UserManager.jar certmod -A $certs/webadmin.pem 1152 | fi 1153 | if [[ $fedhub == "true" ]]; then 1154 | cp $certs/webadmin-fed.p12 $homeDir/ 1155 | else 1156 | cp $certs/webadmin.p12 $homeDir/ 1157 | fi 1158 | chown -R "$curuser":"$curuser" $homeDir 1159 | chown -R tak:tak $dir 1160 | echo -e "${GREEN}Creating Admin Certificate Task Complete.${NC}" 2>&1 | tee -a $logfile 1161 | } 1162 | # Establish the Wizard Workflow 1163 | takWizard(){ 1164 | # RPM/DEB Global Variables 1165 | javaconf="/usr/lib/jvm/java-17-openjdk-*" 1166 | javasecurity=$javaconf/conf/security/java.security 1167 | certs=$dir/certs/files 1168 | configxml=$dir/CoreConfig.xml 1169 | exampleconfigxml=$dir/CoreConfig.example.xml 1170 | makerootca=$dir/certs/makeRootCa.sh 1171 | makeCert=$dir/certs/makeCert.sh 1172 | splash 1173 | set-certproperties 1174 | set-certauthpass 1175 | set-certauthname 1176 | set-certautoenroll 1177 | set-takfederation 1178 | # If version is 5.3 or lower do not prompt for QUIC 1179 | version=($(echo "$takBinary" | grep -o -E '[0-9]+')) 1180 | if [[ ${version[0]} -lt 6 ]]; then 1181 | if [[ ${version[1]} -lt 4 ]]; then 1182 | set-takConnector 1183 | else 1184 | takConnectorType="SSL" # TAK Server 5.4 enables QUIC by default 1185 | # Apply the firewall rules for QUIC 1186 | case $distro in 1187 | rocky|rhel) 1188 | firewall-cmd --zone=public --add-port 8089/tcp --add-port 8090/udp --permanent >/dev/null 1189 | firewall-cmd --reload >/dev/null 1190 | ;; 1191 | ubuntu|debian) 1192 | ufw allow 8089 >/dev/null 1193 | ufw allow 8090/udp >/dev/null 1194 | ;; 1195 | esac 1196 | connectorPort2="8090:quic" # Create the QUIC DP by default 1197 | fi 1198 | fi 1199 | set-webTAKOptions 1200 | finalize-install 1201 | } 1202 | fedWizard(){ 1203 | # RPM/DEB Global Variables 1204 | certs=$dir/certs/files 1205 | fedBrokeryml=$dir/configs/federation-hub-broker.yml 1206 | fedUIyml=$dir/configs/federation-hub-ui.yml 1207 | makerootca=$dir/certs/makeRootCa.sh 1208 | makeCert=$dir/certs/makeCert.sh 1209 | splash 1210 | set-certproperties 1211 | set-certauthpass 1212 | set-certauthname 1213 | set-fedhubversion 1214 | set-fedhubToken 1215 | finalize-install 1216 | } 1217 | # Establish the Execution Workflow 1218 | executeConfiguration(){ 1219 | clear 1220 | case $type in 1221 | OS) 1222 | apply-certproperties 1223 | apply-certauthpass 1224 | apply-certauthname 1225 | if [[ $fedhub == "true" ]]; then 1226 | apply-fedhubversion 1227 | takDBpass=$(openssl rand -base64 14 | tr -dc 'a-zA-Z0-9') 1228 | sed -i "s/dbPassword\:/dbPassword\: ${takDBpass}/g" $fedBrokeryml 1229 | systemctl daemon-reload && systemctl enable mongod && systemctl start mongod 1230 | if [[ $(systemctl is-active mongod) == active ]]; then 1231 | echo -e "${GREEN}MongoDB service STARTED.${NC}" 2>&1 | tee -a $logfile 1232 | $dir/scripts/db/configure.sh 2>&1 | tee -a $logfile 1233 | else 1234 | echo -e "${RED}MongoDB service FAILED to start.${NC}" 2>&1 | tee -a $logfile 1235 | ERRoR="MongoDB service FAILED to start." 1236 | abort 1237 | fi 1238 | echo -e "${YELLOW}Configuring TAK Server Federation Hub for first run.${NC}" 1239 | echo -e "\n# Configuring TAK Server Federation Hub for first run.\n" &>> $logfile 1240 | touch $dir/logs/federation-hub-ui.log 1241 | chown -R tak:tak $dir 1242 | systemctl daemon-reload && systemctl enable federation-hub && systemctl start federation-hub 1243 | ( tail -f -n0 $dir/logs/federation-hub-ui.log & ) | grep -q "Started FederationHubUIServer" 1244 | echo -e "${GREEN}TAK Federation Hub service STARTED.${NC}" 2>&1 | tee -a $logfile 1245 | if [[ $fedhubToken = 0 ]]; then 1246 | systemctl stop federation-hub 1247 | if [ $(systemctl is-active federation-hub) == "active" ]; then 1248 | # Loop until the service is stopped 1249 | while [ $(systemctl is-active federation-hub) == "active" ]; do 1250 | sleep 1 1251 | done 1252 | else 1253 | apply-fedhubToken 1254 | echo -e "${YELLOW}Restrating TAK Server Federation Hub.${NC}" 1255 | fi 1256 | systemctl restart federation-hub & 1257 | ( tail -f -n0 $dir/logs/federation-hub-ui.log & ) | grep -q "Started FederationHubUIServer" 1258 | echo -e "${GREEN}TAK Federation Hub service STARTED.${NC}" 2>&1 | tee -a $logfile 1259 | fi 1260 | # Create Webadmin Certificate 1261 | create-webadmin 1262 | case $distro in 1263 | rocky|rhel) 1264 | # Add the api firewall port 1265 | firewall-cmd --zone=public --add-port 9100/tcp --add-port 9101/tcp --add-port 9102/tcp --permanent >/dev/null 1266 | firewall-cmd --reload >/dev/null 1267 | ;; 1268 | ubuntu|debian) 1269 | ufw allow 9100 >/dev/null 1270 | ufw allow 9101 >/dev/null 1271 | ufw allow 9102 >/dev/null 1272 | ufw enable >/dev/null 1273 | ;; 1274 | esac 1275 | # If federation hub is installed, restart the takserver.service 1276 | case $distro in 1277 | rocky|rhel) 1278 | if [[ $(dnf list installed | grep -wi 'takserver.noarch') ]]; then 1279 | systemctl restart takserver.service & 1280 | ( tail -f -n0 $dir/logs/takserver-messaging.log & ) | grep -q "Started TAK Server messaging Microservice" 1281 | fi 1282 | ;; 1283 | ubuntu|debian) 1284 | if [[ $(apt list --installed | grep -wi 'takserver/now') ]]; then 1285 | systemctl restart takserver.service & 1286 | ( tail -f -n0 $dir/logs/takserver-messaging.log & ) | grep -q "Started TAK Server messaging Microservice" 1287 | fi 1288 | ;; 1289 | esac 1290 | chown -R "$curuser":"$curuser" $homeDir 1291 | usermod -aG tak $curuser 1292 | clear 1293 | else 1294 | apply-certautoenroll 1295 | apply-takfederation 1296 | apply-takConnector 1297 | apply-webTAKOptions 1298 | echo -e "${YELLOW}Configuring TAK Server for first run.${NC}" 1299 | echo -e "\n# Configuring TAK Server for first run.\n" &>> $logfile 1300 | touch $dir/logs/takserver-messaging.log 1301 | chown -R tak:tak $dir 1302 | # Enable and Start the TAK Server 1303 | systemctl enable takserver && systemctl start takserver.service & 1304 | ( tail -f -n0 $dir/logs/takserver-messaging.log & ) | grep -q "Started TAK Server messaging Microservice" 1305 | echo -e "${GREEN}TAK Server service STARTED.${NC}" 2>&1 | tee -a $logfile 1306 | # Create DataPackage 1307 | if [[ $certAEnrollment = 0 ]]; then 1308 | echo -e "${YELLOW}Creating Enrollment Datapackage.${NC}" 1309 | echo -e "\n# Creating Enrollment Datapackage.\n" &>> $logfile 1310 | create-datapackage 1311 | else 1312 | # Copy the Issuing CA 1313 | echo -e "${YELLOW}Moving TAK Server Public Certificate.${NC}" 1314 | echo -e "\n# Moving TAK Server Public Certificate.\n" &>> $logfile 1315 | cp $certs/truststore-$intCA.p12 $homeDir/caCert.p12 1316 | chown -R "$curuser":"$curuser" $homeDir 1317 | fi 1318 | # Create Webadmin Certificate 1319 | create-webadmin 1320 | case $distro in 1321 | rocky|rhel) 1322 | # Add the api firewall port 1323 | firewall-cmd --zone=public --add-port 8443/tcp --permanent >/dev/null 1324 | firewall-cmd --reload >/dev/null 1325 | ;; 1326 | ubuntu|debian) 1327 | ufw allow 8443 >/dev/null 1328 | ufw enable >/dev/null 1329 | ;; 1330 | esac 1331 | usermod -aG tak $curuser 1332 | clear 1333 | if [[ $certAEnrollment = 0 ]]; then 1334 | echo -e "${GREEN}Datapackages for $serverDesc copied to $homeDir${NC}" 2>&1 | tee -a $logfile 1335 | else 1336 | echo -e "${GREEN}TAK Server Public Certificate copied to $homeDir/caCert.p12${NC}" 2>&1 | tee -a $logfile 1337 | fi 1338 | fi 1339 | if [[ $fedhub == "true" ]]; then 1340 | cp $certs/ca.pem $homeDir/FedHubCA.pem 1341 | else 1342 | cp $certs/ca.pem $homeDir/FedCA.pem 1343 | fi 1344 | if [[ $fedhub == "true" ]]; then 1345 | echo -e "${GREEN}TAK Server Federation Hub Public Certificate copied to $homeDir/FedHubCA.pem${NC}" 2>&1 | tee -a $logfile 1346 | else 1347 | echo -e "${GREEN}TAK Server Federation Hub Public Certificate copied to $homeDir/FedCA.pem${NC}" 2>&1 | tee -a $logfile 1348 | fi 1349 | if [[ $fedhub == "true" ]]; then 1350 | echo -e "Web Admin Certificate copied to ${GREEN}$homeDir/webadmin-fed.p12${NC}" 2>&1 | tee -a $logfile 1351 | else 1352 | echo -e "Web Admin Certificate copied to ${GREEN}$homeDir/webadmin.p12${NC}" 2>&1 | tee -a $logfile 1353 | fi 1354 | if [[ $fedhub == "true" ]]; then 1355 | serverIP=$(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1) 1356 | echo -e "Import the ${GREEN}webadmin-fed.p12${NC} then navigate to the Federation Hub UI: ${GREEN}https://$serverIP:9100${NC}" 2>&1 | tee -a $logfile 1357 | else 1358 | echo -e "Import the ${GREEN}webadmin.p12${NC} then navigate to the TAK Server UI: ${GREEN}https://$serverIP:8443${NC}" 2>&1 | tee -a $logfile 1359 | fi 1360 | echo -e "${GREEN}Initialization Complete.${NC}" 1361 | ;; 1362 | Container) 1363 | apply-certproperties 1364 | apply-certauthpass 1365 | echo -e "${YELLOW}Building Containers...${NC}" 2>&1 | tee -a $logfile 1366 | takDBpass=$(openssl rand -base64 14 | tr -dc 'a-zA-Z0-9') 1367 | if [[ $fedhub == "true" ]]; then 1368 | sed -i "s/dbPassword\:/dbPassword\: ${takDBpass}/g" $fedBrokeryml 1369 | docker build -t fedhub_db -f docker/Dockerfile.fedhub-db . 2>&1 | tee -a $logfile 1370 | docker build -t fedhub -f docker/Dockerfile.fedhub . 2>&1 | tee -a $logfile 1371 | else 1372 | sed -i "s/password=\"\"/password=\"${takDBpass}\"/g" $exampleconfigxml 1373 | docker build -t takserver_db -f docker/Dockerfile.takserver-db . 2>&1 | tee -a $logfile 1374 | docker build -t takserver -f docker/Dockerfile.takserver . 2>&1 | tee -a $logfile 1375 | fi 1376 | echo -e "${GREEN}Containers successfully deployed.${NC}" 2>&1 | tee -a $logfile 1377 | if [[ $fedhub == "true" ]]; then 1378 | # Removed -p 27017:27017 1379 | docker run --mount source=$takDB,destination=/var/lib/mongodb -v $dir/configs:/opt/tak/federation-hub/configs:z -it --restart=always --network $dockerNet --network-alias hub-db --name fedhub-db -d fedhub_db 1380 | else 1381 | # Removed -p 5432:5432 1382 | docker run --mount source=$takDB,destination=/var/lib/postgresql -v $dir:/opt/tak:z -it --restart=always --network $dockerNet --network-alias tak-database --name takserver-db -d takserver_db 1383 | fi 1384 | cd ${homeDir}/${dockerTAK} 1385 | if [[ $fedhub == "true" ]]; then 1386 | docker run -it -v $dir:/opt/tak/federation-hub:z --network $dockerNet --name fedhub -d fedhub 1387 | echo -e "${YELLOW}Configuring TAK Federation Hub for first run.${NC}" 1388 | else 1389 | docker run -it -v $dir:/opt/tak:z --network $dockerNet --name takserver -d takserver 1390 | echo -e "${YELLOW}Configuring TAK Server for first run.${NC}" 1391 | fi 1392 | echo -e "${YELLOW}Please Wait...${NC}" 1393 | sleep 10 1394 | if [[ $fips == "true" ]]; then 1395 | if [[ $fedhub == "true" ]]; then 1396 | docker exec fedhub bash -c "cd /opt/tak/federation-hub/certs && ./makeRootCa.sh --ca-name $rootCA --fips" 1397 | else 1398 | docker exec takserver bash -c "cd /opt/tak/certs && ./makeRootCa.sh --ca-name $rootCA --fips" 1399 | fi 1400 | else 1401 | if [[ $fedhub == "true" ]]; then 1402 | docker exec fedhub bash -c "cd /opt/tak/federation-hub/certs && ./makeRootCa.sh --ca-name $rootCA" 1403 | else 1404 | docker exec takserver bash -c "cd /opt/tak/certs && ./makeRootCa.sh --ca-name $rootCA" 1405 | fi 1406 | fi 1407 | echo -e "${GREEN}[2/7]Creating Root Certificate Authority ${rootCA} Task Complete.${NC}" 2>&1 | tee -a $logfile 1408 | if [[ $fips == "true" ]]; then 1409 | if [[ $fedhub == "true" ]]; then 1410 | docker exec fedhub bash -c "cd /opt/tak/federation-hub/certs && echo y |./makeCert.sh ca $intCA --fips" 1411 | else 1412 | docker exec takserver bash -c "cd /opt/tak/certs && echo y |./makeCert.sh ca $intCA --fips" 1413 | fi 1414 | else 1415 | if [[ $fedhub == "true" ]]; then 1416 | docker exec fedhub bash -c "cd /opt/tak/federation-hub/certs && echo y |./makeCert.sh ca $intCA" 1417 | else 1418 | docker exec takserver bash -c "cd /opt/tak/certs && echo y |./makeCert.sh ca $intCA" 1419 | fi 1420 | fi 1421 | echo -e "${GREEN}[3/7]Creating Intermediate/Issuing Certificate Authority ${intCA} Task Complete.${NC}" 2>&1 | tee -a $logfile 1422 | if [[ $fedhub == "true" ]]; then 1423 | sed -i "s/truststore-root/truststore-$intCA/g" $fedUIyml 1424 | else 1425 | sed -i "s/truststore-root/truststore-$intCA/g" $exampleconfigxml 1426 | crl=$"\ \n " 1427 | sed -i "109i $crl" $exampleconfigxml 1428 | fi 1429 | echo -e "${GREEN}[4/7]Updating the CoreConfiguration Files Task Complete.${NC}" 2>&1 | tee -a $logfile 1430 | if [[ $fips == "true" ]]; then 1431 | if [[ $fedhub == "true" ]]; then 1432 | docker exec fedhub bash -c "cd /opt/tak/federation-hub/certs && ./makeCert.sh server ${HOSTNAME} --fips" 1433 | else 1434 | docker exec takserver bash -c "cd /opt/tak/certs && ./makeCert.sh server ${HOSTNAME} --fips" 1435 | fi 1436 | else 1437 | if [[ $fedhub == "true" ]]; then 1438 | docker exec fedhub bash -c "cd /opt/tak/federation-hub/certs && ./makeCert.sh server ${HOSTNAME}" 1439 | else 1440 | docker exec takserver bash -c "cd /opt/tak/certs && ./makeCert.sh server ${HOSTNAME}" 1441 | fi 1442 | fi 1443 | if [[ $fedhub == "true" ]]; then 1444 | sed -i "s/takserver.jks/${HOSTNAME}.jks/g" $fedUIyml 1445 | sed -i "s/takserver.jks/${HOSTNAME}.jks/g" $fedBrokeryml 1446 | sed -i "s/keyAlias\: takserver/keyAlias\: ${HOSTNAME}/g" $fedUIyml 1447 | else 1448 | sed -i "s/takserver.jks/${HOSTNAME}.jks/g" $exampleconfigxml 1449 | fi 1450 | echo -e "${GREEN}[5/7]Creating the Client Certificate for ${HOSTNAME} Task Complete.${NC}" 2>&1 | tee -a $logfile 1451 | if [[ $fedhub == "true" ]]; then 1452 | docker rm -f fedhub 1453 | IFS="$oldIFS" 1454 | unset hostPort 1455 | unset hostPorts 1456 | hostPort[0]='-p 9100:9100' 1457 | case $fedhubversion in 1458 | "V2") 1459 | hostPort[1]='-p 9102:9102' 1460 | sed -i "s/v1Enabled: true/v1Enabled: false/g" $fedBrokeryml 1461 | ;; 1462 | "V1") 1463 | hostPort[1]='-p 9101:9101' 1464 | sed -i "s/v2Enabled: true/v2Enabled: false/g" $fedBrokeryml 1465 | ;; 1466 | "V2 V1") 1467 | hostPort[1]='-p 9101-9102:9101-9102' 1468 | ;; 1469 | esac 1470 | echo -e "${GREEN}[6/7]Applying TAK Federation Hub Version Task Complete.${NC}" 2>&1 | tee -a $logfile 1471 | apply-fedhubToken 1472 | if [ $fedhubToken = 0 ]; then 1473 | hostPort[2]='-p 9103:9103' 1474 | fi 1475 | hostPorts="${hostPort[*]}" 1476 | docker_command="docker run -it --restart=always -v $dir:/opt/tak/federation-hub:z $hostPorts --network $dockerNet --name fedhub -d fedhub" 1477 | eval $docker_command 1478 | echo -e "${YELLOW}Configuring TAK Server for final run.${NC}" 1479 | echo -e "${YELLOW}Please Wait...${NC}" 1480 | else 1481 | docker rm -f takserver 1482 | IFS="$oldIFS" 1483 | unset hostPort 1484 | unset hostPorts 1485 | hostPort[0]='-p 8443:8443' 1486 | if [ $certAEnrollment = 0 ]; then 1487 | hostPort[1]='-p 8446:8446' 1488 | echo -e "\n# Applying Certificate Auto Enrollment Configuration.\n" &>> $logfile 1489 | CertificateAutoEnrollment=$"\ \n\n \n \n \n \n \n \n \n " 1490 | sed -i "102i $CertificateAutoEnrollment" $exampleconfigxml 1491 | sed -i 's///g' $exampleconfigxml 1492 | echo -e "${GREEN}[6/7] Applying Certificate Auto Enrollment Configuration Task Complete.${NC}" 2>&1 | tee -a $logfile 1493 | else 1494 | # Copy the Issuing CA 1495 | echo -e "${YELLOW}Moving TAK Server Public Certificate.${NC}" 1496 | echo -e "\n# Moving TAK Server Public Certificate.\n" &>> $logfile 1497 | cp $certs/truststore-$intCA.p12 $homeDir/caCert.p12 1498 | chown -R "$curuser":"$curuser" $homeDir 1499 | echo -e "${GREEN}[6/7] SKIP Certificate Auto Enrollment Configuration Task.${NC}" 2>&1 | tee -a $logfile 1500 | fi 1501 | fedEnabled=$"\ \n\n \n \n \n \n \n \n \n pref\n \n " 1502 | if [ $serverFederation = 0 ]; then 1503 | hostPort[2]='-p 9001:9001' 1504 | echo -e "${GREEN}[7/7] Applying TAK Server Federation Configuration Task Complete.${NC}" 2>&1 | tee -a $logfile 1505 | sed -i "135i $fedEnabled" $exampleconfigxml 1506 | #sed -i '157,164d' $exampleconfigxml 1507 | else 1508 | sed -i 's///g' $exampleconfigxml 1509 | echo -e "${GREEN}[7/7] SKIP TAK Server Federation Configuration Task.${NC}" 2>&1 | tee -a $logfile 1510 | fi 1511 | case $takConnectorType in 1512 | "SSL") hostPort[3]='-p 8089:8089';; 1513 | "QUIC") sed -i "7i " $exampleconfigxml 1514 | hostPort[3]='-p 8090:8090/udp';; 1515 | "SSL QUIC") sed -i "7i " $exampleconfigxml 1516 | hostPort[3]='-p 8089:8089 -p 8090:8090/udp';; 1517 | esac 1518 | hostPorts="${hostPort[*]}" 1519 | rm $dir/CoreConfig.{xml,xml.backup} 1520 | docker_command="docker run -it --restart=always -v $dir:/opt/tak:z $hostPorts --network $dockerNet --name takserver -d takserver" 1521 | eval $docker_command 1522 | echo -e "${YELLOW}Configuring TAK Server for final run.${NC}" 1523 | echo -e "${YELLOW}Please Wait...${NC}" 1524 | docker exec takserver bash -c "cd /opt/tak/logs && touch takserver-messaging.log" 1525 | ( tail -f -n0 $dir/logs/takserver-messaging.log & ) | grep -q "Started TAK Server messaging Microservice" 1526 | fi 1527 | # Create Webadmin Certificate 1528 | if [[ $fips == "true" ]]; then 1529 | if [[ $fedhub == "true" ]]; then 1530 | docker exec fedhub bash -c "cd /opt/tak/federation-hub/certs && ./makeCert.sh client webadmin-fed --fips" 1531 | else 1532 | docker exec takserver bash -c "cd /opt/tak/certs && ./makeCert.sh client webadmin --fips" 1533 | fi 1534 | else 1535 | if [[ $fedhub == "true" ]]; then 1536 | docker exec fedhub bash -c "cd /opt/tak/federation-hub/certs && ./makeCert.sh client webadmin-fed --fips" 1537 | else 1538 | docker exec takserver bash -c "cd /opt/tak/certs && ./makeCert.sh client webadmin" 1539 | fi 1540 | fi 1541 | if [[ $fedhub == "true" ]]; then 1542 | docker exec fedhub bash -c "java -jar /opt/tak/federation-hub/jars/federation-hub-manager.jar /opt/tak/federation-hub/certs/files/webadmin-fed.pem" 1543 | clear 1544 | else 1545 | docker exec takserver bash -c "java -jar /opt/tak/utils/UserManager.jar certmod -A /opt/tak/certs/files/webadmin.pem" 1546 | fi 1547 | if [[ $fedhub == "true" ]]; then 1548 | cp $certs/ca.pem $homeDir/FedHubCA.pem 1549 | else 1550 | cp $certs/ca.pem $homeDir/FedCA.pem 1551 | fi 1552 | if [[ $fedhub == "true" ]]; then 1553 | cp $certs/webadmin-fed.p12 $homeDir/ 1554 | else 1555 | cp $certs/webadmin.p12 $homeDir/ 1556 | fi 1557 | if ! [[ $fedhub == "true" ]]; then 1558 | if [ $certAEnrollment = 0 ]; then 1559 | create-datapackage 1560 | clear 1561 | echo -e "Datapackages for $serverDesc copied to ${GREEN}$homeDir${NC}" 2>&1 | tee -a $logfile 1562 | else 1563 | clear 1564 | echo -e "TAK Server Public Certificate copied to ${GREEN}$homeDir/caCert.p12${NC}" 2>&1 | tee -a $logfile 1565 | fi 1566 | fi 1567 | if [[ $fedhub == "true" ]]; then 1568 | echo -e "${GREEN}TAK Server Federation Hub Public Certificate copied to $homeDir/FedHubCA.pem${NC}" 2>&1 | tee -a $logfile 1569 | else 1570 | echo -e "${GREEN}TAK Server Federation Hub Public Certificate copied to $homeDir/FedCA.pem${NC}" 2>&1 | tee -a $logfile 1571 | fi 1572 | if [[ $fedhub == "true" ]]; then 1573 | echo -e "Web Admin Certificate copied to ${GREEN}$homeDir/webadmin-fed.p12${NC}" 2>&1 | tee -a $logfile 1574 | else 1575 | echo -e "Web Admin Certificate copied to ${GREEN}$homeDir/webadmin.p12${NC}" 2>&1 | tee -a $logfile 1576 | fi 1577 | if [[ $fedhub == "true" ]]; then 1578 | serverIP=$(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1) 1579 | echo -e "Import the ${GREEN}webadmin-fed.p12${NC} then navigate to the Federation Hub UI: ${GREEN}https://$serverIP:9100${NC}" 2>&1 | tee -a $logfile 1580 | else 1581 | echo -e "Import the ${GREEN}webadmin.p12${NC} then navigate to the TAK Server UI: ${GREEN}https://$serverIP:8443${NC}" 2>&1 | tee -a $logfile 1582 | fi 1583 | echo -e "${GREEN}Initialization Complete.${NC}" 1584 | ;; 1585 | esac 1586 | } 1587 | #:::::::::: 1588 | # Begin Docker Installation 1589 | #:::::::::: 1590 | installDocker(){ 1591 | dockerTAK=$(basename "$1") 1592 | dockerTAK="${dockerTAK%.*}" 1593 | status=$(systemctl is-active docker) && echo -e "$status" &>> $logfile 1594 | if [ $status == "inactive" ]; then 1595 | echo -e "${RED}Docker service is not started.${NC}" 2>&1 | tee -a $logfile 1596 | echo -e "${YELLOW}Attempting to start the Docker service.${NC}" 2>&1 | tee -a $logfile 1597 | systemctl start docker 1598 | while [ $status == "active" ]; do 1599 | sleep 3 1600 | done 1601 | echo -e "${GREEN}Docker service STARTED.${NC}" 2>&1 | tee -a $logfile 1602 | fi 1603 | echo -e "${YELLOW}Installing additional packages.${NC}" 2>&1 | tee -a $logfile 1604 | case $distro in 1605 | rocky|rhel) 1606 | dnf install unzip zip dialog -y 2>&1 | tee -a $logfile 1607 | ;; 1608 | ubuntu|debian) 1609 | apt-get install unzip zip dialog -y 2>&1 | tee -a $logfile 1610 | ;; 1611 | photon) 1612 | tdnf install unzip zip dialog -y 2>&1 | tee -a $logfile 1613 | ;; 1614 | esac 1615 | echo -e "${GREEN}Installation of additional packages Complete.${NC}" 2>&1 | tee -a $logfile 1616 | echo -e "${YELLOW}Extracting $dockerTAK.${NC}" 2>&1 | tee -a $logfile 1617 | unzip $1 -d $homeDir 2>&1 | tee -a $logfile 1618 | echo -e "${GREEN}Extraction of $dockerTAK Complete.${NC}" 2>&1 | tee -a $logfile 1619 | cd ${homeDir}/${dockerTAK} 1620 | if [[ $fedhub == "true" ]]; then 1621 | dockerNet="takfedhub" 1622 | dir=${PWD}/tak/federation-hub 1623 | else 1624 | dockerNet="takserver" 1625 | dir=${PWD}/tak 1626 | fi 1627 | # Create Network 1628 | docker network rm $dockerNet 2>&1 | tee -a $logfile 1629 | docker network create $dockerNet 2>&1 | tee -a $logfile 1630 | # Create Persistent Volume 1631 | if [[ $fedhub == "true" ]]; then 1632 | takDB="takfedhub_mongodb" 1633 | else 1634 | takDB="takserver_pgsql" 1635 | fi 1636 | docker volume rm $takDB 2>&1 | tee -a $logfile 1637 | docker volume create $takDB 2>&1 | tee -a $logfile 1638 | } 1639 | # Set FIPS Status 1640 | if [[ $fips =~ -(fip) ]]; then 1641 | fips="true" 1642 | else 1643 | fips="false" 1644 | fi 1645 | # Execute Script 1646 | case $1 in 1647 | *.rpm|*.deb) 1648 | if [[ -f "$1" ]]; then 1649 | # Determine if the user is root; else use sudo 1650 | [ "$UID" -eq 0 ] || exec sudo "$0" "$@" 1651 | # Conduct Prerequisite Checks 1652 | if [[ $1 =~ "fed-hub" ]]; then 1653 | fedhub="true" 1654 | backTitle="TAK Federation Hub Setup Wizard - Version: $sVER" 1655 | type="OS" 1656 | echo -e "${GREEN}Installation Type: Federation Hub${NC}" >&2 | tee -a $logfile 1657 | # Check if the TAK Server Federation Hub is already installed 1658 | case $distro in 1659 | rocky|rhel) 1660 | if [[ $(dnf list installed | grep -wi 'takserver-fed-hub.noarch') ]]; then 1661 | echo -e "${RED}TAK Server Federation Hub already installed.${NC}" 2>&1 | tee -a $logfile 1662 | # Prompt to remove existing installation 1663 | read -p "TAK Server Federation Hub already installed, Overwrite? (y/n) " confirm 1664 | if [[ "$confirm" =~ ^[Yy]$ ]]; then 1665 | status=$(systemctl is-active federation-hub) 1666 | if [ $status == "active" ]; then 1667 | systemctl stop federation-hub 1668 | echo -e "${GREEN}TAK Server Federation Hub service STOPPED.${NC}" 1669 | fi 1670 | dnf remove takserver-fed-hub mongodb* -y 2>&1 | tee -a $logfile 1671 | rm -rf /var/lib/mongodb && rm -rf /opt/tak/federation-hub 1672 | if ! [[ $(dnf list installed | grep -wi 'takserver.noarch') ]]; then 1673 | groupdel -f tak 1674 | fi 1675 | # Just delete all, even if not present 1676 | firewall-cmd --zone=public --remove-port 9100/tcp --permanent >/dev/null 1677 | firewall-cmd --zone=public --remove-port 9101/tcp --permanent >/dev/null 1678 | firewall-cmd --zone=public --remove-port 9102/tcp --permanent >/dev/null 1679 | firewall-cmd --zone=public --remove-port 9103/tcp --permanent >/dev/null 1680 | firewall-cmd --reload >/dev/null 1681 | rm $homeDir/webadmin-fed.p12 $homeDir/FedHubCA.pem >/dev/null 1682 | echo -e "${GREEN}TAK Server Federation Hub successfully removed, continuing installation.${NC}" 2>&1 | tee -a $logfile 1683 | else 1684 | ERRoR="TAK Server Federation Hub already installed." 1685 | abort 1686 | fi 1687 | fi 1688 | ;; 1689 | ubuntu|debian) 1690 | if [[ $(apt list --installed | grep -wi 'takserver-fed-hub/now') ]]; then 1691 | echo -e "${RED}TAK Server Federation Hub already installed.${NC}" 2>&1 | tee -a $logfile 1692 | # Prompt to remove existing installation 1693 | read -p "TAK Server Federation Hub already installed, Overwrite? (y/n) " confirm 1694 | if [[ "$confirm" =~ ^[Yy]$ ]]; then 1695 | status=$(systemctl is-active takserver) 1696 | if [ $status == "active" ]; then 1697 | systemctl stop takserver 1698 | echo -e "${GREEN}TAK Server service STOPPED.${NC}" 1699 | fi 1700 | apt-get remove takserver-fed-hub mongodb* -y 2>&1 | tee -a $logfile 1701 | rm -rf /var/lib/mongodb && rm -rf /opt/tak/federation-hub 1702 | # Determine if takserver is installed 1703 | if ! [[ $(apt list --installed | grep -wi 'takserver/now') ]]; then 1704 | groupdel -f tak 1705 | fi 1706 | # Just delete all, even if not present 1707 | ufw delete allow 9100 >/dev/null 1708 | ufw delete allow 9101 >/dev/null 1709 | ufw delete allow 9102 >/dev/null 1710 | ufw delete allow 9103 >/dev/null 1711 | rm $homeDir/webadmin-fed.p12 $homeDir/FedHubCA.pem >/dev/null 1712 | echo -e "${GREEN}TAK Server successfully removed, continuing installation.${NC}" 2>&1 | tee -a $ 1713 | else 1714 | ERRoR="TAK Server Federation Hub already installed." 1715 | abort 1716 | fi 1717 | fi 1718 | ;; 1719 | esac 1720 | fedhubInstall $1 1721 | fedWizard 1722 | else 1723 | backTitle="TAK Server Setup Wizard - Version: $sVER" 1724 | type="OS" 1725 | echo -e "${GREEN}Installation Type: TAK Server${NC}" >&2 | tee -a $logfile 1726 | # Check if the TAK Server Federation Hub is already installed 1727 | case $distro in 1728 | rocky|rhel) 1729 | if [[ $(dnf list installed | grep -wi 'takserver.noarch') ]]; then 1730 | echo -e "${RED}TAK Server already installed.${NC}" 2>&1 | tee -a $logfile 1731 | # Prompt to remove existing installation 1732 | read -p "TAK Server already installed, Overwrite? (y/n) " confirm 1733 | if [[ "$confirm" =~ ^[Yy]$ ]]; then 1734 | status=$(systemctl is-active takserver) 1735 | if [ $status == "active" ]; then 1736 | systemctl stop takserver 1737 | echo -e "${GREEN}TAK Server service STOPPED.${NC}" 1738 | fi 1739 | su - postgres -c "psql -U postgres -c \"DROP DATABASE cot;\"" >/dev/null 1740 | su - postgres -c "psql -U postgres -c \"DROP USER martiuser;\"" >/dev/null 1741 | rm -rf /var/lib/pgsql >/dev/null 1742 | dnf remove takserver -y 2>&1 | tee -a $logfile 1743 | rm -rf /opt/tak/certs >/dev/null 1744 | rm -f /opt/tak/CoreConfig.{xml,xml.backup} >/dev/null 1745 | rm -Rf /opt/tak/jetty* >/dev/null 1746 | # Determine if Fedhub is installed 1747 | if ! [[ $(dnf list installed | grep -wi 'takserver-fed-hub.noarch') ]]; then 1748 | groupdel -f tak && rm -rf /opt/tak 1749 | fi 1750 | # Just delete all, even if not present 1751 | firewall-cmd --zone=public --remove-port 8089/tcp --permanent >/dev/null 1752 | firewall-cmd --zone=public --remove-port 8090/udp --permanent >/dev/null 1753 | firewall-cmd --zone=public --remove-port 8443/tcp --permanent >/dev/null 1754 | firewall-cmd --zone=public --remove-port 8446/tcp --permanent >/dev/null 1755 | firewall-cmd --zone=public --remove-port 9001/tcp --permanent >/dev/null 1756 | firewall-cmd --reload >/dev/null 1757 | rm $homeDir/webadmin.p12 $homeDir/FedCA.pem $homeDir/enrollmentDP.zip $homeDir/enrollmentDP-QUIC.zip >/dev/null 1758 | echo -e "${GREEN}TAK Server successfully removed, continuing installation.${NC}" 2>&1 | tee -a $logfile 1759 | else 1760 | ERRoR="TAK Server already installed." 1761 | abort 1762 | fi 1763 | fi 1764 | ;; 1765 | ubuntu|debian) 1766 | if [[ $(apt list --installed | grep -wi 'takserver/now') ]]; then 1767 | echo -e "${RED}TAK Server already installed.${NC}" 2>&1 | tee -a $logfile 1768 | # Prompt to remove existing installation 1769 | read -p "TAK Server already installed, Overwrite? (y/n) " confirm 1770 | if [[ "$confirm" =~ ^[Yy]$ ]]; then 1771 | status=$(systemctl is-active takserver) 1772 | if [ $status == "active" ]; then 1773 | systemctl stop takserver 1774 | echo -e "${GREEN}TAK Server service STOPPED.${NC}" 1775 | fi 1776 | # Drop the Database & User 1777 | su - postgres -c "psql -U postgres -c \"DROP DATABASE cot;\"" >/dev/null 1778 | su - postgres -c "psql -U postgres -c \"DROP USER martiuser;\"" >/dev/null 1779 | rm -rf /var/lib/postgresql >/dev/null 1780 | apt-get remove takserver -y 2>&1 | tee -a $logfile 1781 | rm -rf /opt/tak/certs >/dev/null 1782 | rm -f /opt/tak/CoreConfig.{xml,xml.backup} >/dev/null 1783 | rm -Rf /opt/tak/jetty* >/dev/null 1784 | # Determine if Fedhub is installed 1785 | if ! [[ $(apt list --installed | grep -wi 'takserver-fed-hub/now') ]]; then 1786 | groupdel -f tak && rm -rf /opt/tak 1787 | fi 1788 | # Just delete all, even if not present 1789 | ufw delete allow 8089 >/dev/null 1790 | ufw delete allow 8090/udp >/dev/null 1791 | ufw delete allow 8443 >/dev/null 1792 | ufw delete allow 8446 >/dev/null 1793 | ufw delete allow 9001 >/dev/null 1794 | rm $homeDir/webadmin.p12 $homeDir/FedCA.pem $homeDir/enrollmentDP.zip $homeDir/enrollmentDP-QUIC.zip >/dev/null 1795 | echo -e "${GREEN}TAK Server successfully removed, continuing installation.${NC}" 2>&1 | tee -a $logfile 1796 | else 1797 | ERRoR="TAK Server already installed." 1798 | abort 1799 | fi 1800 | fi 1801 | ;; 1802 | esac 1803 | prerequisite $1 1804 | Install $1 1805 | takWizard 1806 | fi 1807 | else 1808 | echo -e "${RED}File not found.${NC}" 1809 | abort 1810 | fi 1811 | ;; 1812 | *.zip) 1813 | if [[ -f "$1" ]]; then 1814 | # Determine if the user is root; else use sudo 1815 | [ "$UID" -eq 0 ] || exec sudo "$0" "$@" 1816 | # Conduct Prerequisite Checks 1817 | # Determine if TAK Server is already installed 1818 | if [[ $1 =~ "fedhub" ]]; then 1819 | fedhub="true" 1820 | backTitle="TAK Federation Hub Setup Wizard - Version: $sVER" 1821 | type="Container" 1822 | echo -e "${GREEN}Installation Type: Federation Hub${NC}" >&2 | tee -a $logfile 1823 | # Check if the TAK Server is already installed 1824 | if [[ $(docker inspect -f '{{.State.Running}}' "fedhub") == "true" ]]; then 1825 | echo -e "${RED}TAK Server already installed.${NC}" 2>&1 | tee -a $logfile 1826 | # Prompt to remove existing installation 1827 | read -p "TAK Server already installed, Overwrite? (y/n) " confirm 1828 | if [[ "$confirm" =~ ^[Yy]$ ]]; then 1829 | docker rm -f fedhub-db fedhub 1830 | docker network rm takfedhub 1831 | docker volume rm takfedhub_mongodb 1832 | else 1833 | ERRoR="TAK Server already installed." 1834 | abort 1835 | fi 1836 | fi 1837 | installDocker $1 1838 | fedWizard 1839 | else 1840 | backTitle="TAK Server Setup Wizard - Version: $sVER" 1841 | type="Container" 1842 | echo -e "${GREEN}Installation Type: TAK Server${NC}" >&2 | tee -a $logfile 1843 | # Check if the TAK Server is already installed 1844 | if [[ $(docker inspect -f '{{.State.Running}}' "takserver") == "true" ]]; then 1845 | echo -e "${RED}TAK Server already installed.${NC}" 2>&1 | tee -a $logfile 1846 | # Prompt to remove existing installation 1847 | read -p "TAK Server already installed, Overwrite? (y/n) " confirm 1848 | if [[ "$confirm" =~ ^[Yy]$ ]]; then 1849 | docker rm -f takserver-db takserver 1850 | docker network rm takserver 1851 | docker volume rm takserver_pgsql 1852 | else 1853 | ERRoR="TAK Server already installed." 1854 | abort 1855 | fi 1856 | fi 1857 | installDocker $1 1858 | takWizard 1859 | fi 1860 | else 1861 | echo -e "${RED}File not found.${NC}" 1862 | abort 1863 | fi 1864 | ;; 1865 | *) 1866 | echo -e "${RED}script usage:${NC} ./$(basename "$0") [TAK Server installer [rpm | deb | zip ]]\n" >&2 1867 | echo -e "${GREEN}TAK Server Binary Installation:${NC}" >&2 1868 | echo -e "${YELLOW}Example:${NC} ./$(basename "$0") takserver-5.3-RELEASE4.noarch.rpm" >&2 1869 | echo -e "${YELLOW}Example:${NC} ./$(basename "$0") takserver-5.3-RELEASE4_ALL.deb" >&2 1870 | echo -e "\n${GREEN}TAK Server Docker Installation:${NC}" >&2 1871 | echo -e "${YELLOW}Example:${NC} ./$(basename "$0") takserver-docker-5.3-RELEASE-4.zip" >&2 1872 | echo -e "\n${GREEN}Generate FIPS Compliant Certificates:${NC}" >&2 1873 | echo -e "${YELLOW}Example:${NC} ./$(basename "$0") takserver-5.3-RELEASE4.noarch.rpm --fips" >&2 1874 | echo -e "${YELLOW}Example:${NC} ./$(basename "$0") takserver-5.3-RELEASE4_ALL.deb --fips" >&2 1875 | echo -e "${YELLOW}Example:${NC} ./$(basename "$0") takserver-docker-5.3-RELEASE-4.zip --fips" >&2 1876 | exit 1 1877 | ;; 1878 | esac 1879 | # Perform Cleanup 1880 | rm -Rf $BASEDIR 1881 | exit -------------------------------------------------------------------------------- /lib/img/connector_wizard01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myTeckNet/installTAK/b26a2ceb0c56be968e1d75185644cc7cc3655a41/lib/img/connector_wizard01.png -------------------------------------------------------------------------------- /lib/img/fqdn_wizard01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myTeckNet/installTAK/b26a2ceb0c56be968e1d75185644cc7cc3655a41/lib/img/fqdn_wizard01.png -------------------------------------------------------------------------------- /lib/img/fqdn_wizard01a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myTeckNet/installTAK/b26a2ceb0c56be968e1d75185644cc7cc3655a41/lib/img/fqdn_wizard01a.png -------------------------------------------------------------------------------- /lib/img/fqdn_wizard02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myTeckNet/installTAK/b26a2ceb0c56be968e1d75185644cc7cc3655a41/lib/img/fqdn_wizard02.png -------------------------------------------------------------------------------- /lib/img/fqdn_wizard03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myTeckNet/installTAK/b26a2ceb0c56be968e1d75185644cc7cc3655a41/lib/img/fqdn_wizard03.png -------------------------------------------------------------------------------- /lib/img/fqdn_wizard04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myTeckNet/installTAK/b26a2ceb0c56be968e1d75185644cc7cc3655a41/lib/img/fqdn_wizard04.png -------------------------------------------------------------------------------- /lib/img/takDP_wizard01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myTeckNet/installTAK/b26a2ceb0c56be968e1d75185644cc7cc3655a41/lib/img/takDP_wizard01.png -------------------------------------------------------------------------------- /lib/img/takDP_wizard02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myTeckNet/installTAK/b26a2ceb0c56be968e1d75185644cc7cc3655a41/lib/img/takDP_wizard02.png -------------------------------------------------------------------------------- /lib/img/takfedwizard01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myTeckNet/installTAK/b26a2ceb0c56be968e1d75185644cc7cc3655a41/lib/img/takfedwizard01.png -------------------------------------------------------------------------------- /lib/img/takfedwizard02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myTeckNet/installTAK/b26a2ceb0c56be968e1d75185644cc7cc3655a41/lib/img/takfedwizard02.png -------------------------------------------------------------------------------- /lib/img/takfedwizard03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myTeckNet/installTAK/b26a2ceb0c56be968e1d75185644cc7cc3655a41/lib/img/takfedwizard03.png -------------------------------------------------------------------------------- /lib/img/takwizard_prompt01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myTeckNet/installTAK/b26a2ceb0c56be968e1d75185644cc7cc3655a41/lib/img/takwizard_prompt01.png -------------------------------------------------------------------------------- /lib/img/takwizard_prompt02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myTeckNet/installTAK/b26a2ceb0c56be968e1d75185644cc7cc3655a41/lib/img/takwizard_prompt02.png -------------------------------------------------------------------------------- /lib/img/takwizard_prompt03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myTeckNet/installTAK/b26a2ceb0c56be968e1d75185644cc7cc3655a41/lib/img/takwizard_prompt03.png -------------------------------------------------------------------------------- /lib/img/takwizard_prompt03a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myTeckNet/installTAK/b26a2ceb0c56be968e1d75185644cc7cc3655a41/lib/img/takwizard_prompt03a.png -------------------------------------------------------------------------------- /lib/img/takwizard_prompt04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myTeckNet/installTAK/b26a2ceb0c56be968e1d75185644cc7cc3655a41/lib/img/takwizard_prompt04.png -------------------------------------------------------------------------------- /lib/img/takwizard_prompt05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myTeckNet/installTAK/b26a2ceb0c56be968e1d75185644cc7cc3655a41/lib/img/takwizard_prompt05.png -------------------------------------------------------------------------------- /lib/img/takwizard_prompt06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myTeckNet/installTAK/b26a2ceb0c56be968e1d75185644cc7cc3655a41/lib/img/takwizard_prompt06.png -------------------------------------------------------------------------------- /lib/img/takwizard_prompt07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myTeckNet/installTAK/b26a2ceb0c56be968e1d75185644cc7cc3655a41/lib/img/takwizard_prompt07.png -------------------------------------------------------------------------------- /lib/img/takwizard_prompt08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myTeckNet/installTAK/b26a2ceb0c56be968e1d75185644cc7cc3655a41/lib/img/takwizard_prompt08.png -------------------------------------------------------------------------------- /lib/img/webtak_options01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myTeckNet/installTAK/b26a2ceb0c56be968e1d75185644cc7cc3655a41/lib/img/webtak_options01.png --------------------------------------------------------------------------------