├── AUTHORS.rst ├── CONTRIBUTING.rst ├── LICENSE ├── README.md ├── README.rst ├── config ├── config.info ├── default_java.cgi ├── delete_war.cgi ├── docs ├── Makefile ├── authors.rst ├── conf.py ├── contributing.rst ├── index.rst ├── installation.rst ├── make.bat ├── readme.rst └── usage.rst ├── edit_java.cgi ├── edit_libs.cgi ├── edit_manual.cgi ├── edit_proxy.cgi ├── edit_war.cgi ├── help └── intro.html ├── images ├── edit-file.png ├── icon.gif ├── jar.png ├── java.png ├── manual.gif ├── mapping.png └── war.png ├── index.cgi ├── install_check.sh ├── install_java.cgi ├── install_libs.cgi ├── install_war.cgi ├── java-lib.pl ├── lang └── en ├── module.info ├── restart.cgi ├── save_manual.cgi ├── scripts ├── alma-rocky.sh ├── index.rst ├── pre-install.sh ├── rocky-linux.sh ├── tomcat.wbm.gz └── ubuntu.sh ├── setup.cgi ├── start.cgi ├── stop.cgi ├── tomcat-lib.pl ├── tomcat.init ├── tomcat.service ├── tomcat_upgrade.cgi ├── uninstall_java.cgi └── uninstall_libs.cgi /AUTHORS.rst: -------------------------------------------------------------------------------- 1 | Authors 2 | ------- 3 | * `David Ghedini`_ 4 | * `Kaloyan Petrov`_ 5 | * `Cited, Inc`_ 6 | 7 | .. _`David Ghedini`: https://github.com/DavidGhedini 8 | .. _`Kaloyan Petrov`: https://github.com/kaloyan13 9 | .. _`Cited, Inc`: https://www.citedcorp.com 10 | 11 | -------------------------------------------------------------------------------- /CONTRIBUTING.rst: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | ## Issues 4 | 5 | If you've found a bug, let us know about it. 6 | 7 | ## Pull Requests 8 | 9 | For all cases, you should have your own fork of the repo. 10 | 11 | To submit a pull request for a **new feature**: 12 | 13 | 1. Run the tests. Every pull request for a new feature should have an accompanying unit test and docs changes. See the `README.md` in the `tests/` and `docs/` directories for details. 14 | 2. Create a new branch off of the `master` branch for your feature. This is particularly helpful when you want to submit multiple pull requests. 15 | 3. Add a test (or multiple tests) for your feature. Again, see `tests/README.md`. 16 | 4. Add your new feature, making the test pass. 17 | 5. Push to your fork and submit the pull request! 18 | 19 | To submit a **bug fix**: 20 | 21 | 1. Create a new branch off of the `master` branch. 22 | 2. Add a test that demonstrates the bug. 23 | 3. Make the test pass. 24 | 4. Push to your fork and submit the pull request! 25 | 26 | To submit a **documentation fix**: 27 | 28 | 1. Create a new branch off of the `master` branch. 29 | 2. Add your documentation fixes (no tests required). 30 | 3. Push to your fork and submit the pull request! 31 | -------------------------------------------------------------------------------- /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 | Tomcat Module for Webmin 635 | Copyright (C) 2017 Cited, Inc. 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 | Tomcat-Webmin-Module Copyright (C) 2017 Cited, Inc. 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 | 2 | # Tomcat Webmin Module 3 | 4 | [![Documentation Status](https://readthedocs.org/projects/tomcat-webmin-module/badge/?version=latest)](https://tomcat-module.citedcorp.com/en/latest/?badge=latest) 5 | # Info 6 | 7 | Apache Tomcat Module for Webmin. 8 | 9 | Install and Manage Apache Tomcat or Manage Existing Installations. 10 | 11 | # Install via Webmin 12 | 13 | Webmin->Webmin Configuration->Webmin Modules->From ftp or http URL 14 | 15 | URL: http://github.com/cited/Tomcat-Webmin-Module/raw/master/scripts/tomcat.wbm.gz 16 | 17 | Go to Servers->Apache Tomcat to complete set up using the setup Wizard (you may need to refresh page). 18 | 19 | # Install via Script 20 | 21 | On Ubuntu, as Root: 22 | 23 | ```bash 24 | wget https://raw.githubusercontent.com/cited/Tomcat-Webmin-Module/master/scripts/ubuntu.sh 25 | chmod +x pre-install.sh 26 | ./pre-install.sh 27 | ``` 28 | 29 | On Rocky Linux or Alma Linux, as Root: 30 | 31 | ```bash 32 | wget https://raw.githubusercontent.com/cited/Tomcat-Webmin-Module/master/scripts/alma-rocky.sh 33 | chmod +x pre-install.sh 34 | ./pre-install.sh 35 | ``` 36 | 37 | Go to Servers->Apache Tomcat to complete set up using the setup Wizard. 38 | 39 | # Install via GIT 40 | 41 | As Root: 42 | 43 | ```bash 44 | git clone https://github.com/cited/Tomcat-Webmin-Module 45 | mv Tomcat-Webmin-Module-master tomcat 46 | tar -cvzf tomcat.wbm.gz tomcat/ 47 | ``` 48 | 49 | Upload from Webmin->Webmin Configuration->Webmin Modules 50 | 51 | Go to Servers->Apache Tomcat (you may need to refresh page) 52 | 53 | # Notes 54 | 55 | ## **Ubuntu** 56 | Tested on Ubuntu 20 and 22 57 | 58 | ## **Readhat/Fedora/CentOS** 59 | Tested on CentOS 6, 7, and 8 60 | 61 | ## **Rocky Linux** 62 | Tested on Rocky Linux 9 63 | 64 | ## **Alma Linux** 65 | Tested on Alma Linux 9 66 | 67 | ## **Arch** 68 | Install tomcat packages manually and then install module, because Webmin doesn't support pacman. Go to Existing Tomcat Installations below. 69 | 70 | pacman --noconfirm -S tomcat8 tomcat-native jre8-openjdk 71 | 72 | ## **OpenSuSe** 73 | Install tomcat packages manually and then install module. Go to Existing Tomcat Installations below. 74 | 75 | zypper -n install tomcat tomcat-webapps tomcat-admin-webapps 76 | 77 | ## **Slackware** 78 | Install Tomcat using one of our [scripts](https://github.com/AcuGIS)! 79 | 80 | ## **Existing Tomcat Installations** 81 | 82 | The module can also be installed on existing Tomcat installations. 83 | 84 | 1. Install from Webmin->Webmin Configuration->Webmin Modules 85 | 2. Go to Servers > Apache Tomcat 86 | 3. Click config icon in top left corner 87 | 4. Set the paths to those used on your installation 88 | 89 | Once you have updated the /etc/webmin/tomcat/config file to your installation paths, you should be able to use all functionality. 90 | 91 | ## **Issues** 92 | Please report issue here or at hello@acugis.com 93 | 94 | # Screen Shots 95 | 96 | Tomcat Module: 97 | 98 | ![tomcat webmin module](https://cdn.acugis.com/apache-tomcat-webmin-plugin/tomcat-module-plugin.gif) 99 | 100 | Tomcat Module WAR Manager: 101 | 102 | ![tomcat webmin module deploy wars](https://cdn.acugis.com/apache-tomcat-webmin-plugin/tomcat-module-war-deploy.gif) 103 | 104 | Tomcat Module Configuration Editor: 105 | 106 | ![tomcat webmin module edit configs](https://cdn.acugis.com/apache-tomcat-webmin-plugin/tomcat-module-edit-configs.gif) 107 | 108 | 109 | Copyright 110 | --------- 111 | 112 | * Copyright AcuGIS, 2020 113 | * Copyright Cited, Inc., 2020 114 | 115 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | Apache Tomcat Webmin Module 2 | =========================== 3 | 4 | Apache Tomcat Module for Webmin. 5 | 6 | Install and Manage Apache Tomcat or Manage Existing Installations. 7 | 8 | Features 9 | -------- 10 | 11 | - Install Tomcat 12 | - Install JDK 13 | - Stop, Start, and Restart Tomcat 14 | - Edit Main Config Files 15 | - Deploy WARS 16 | 17 | Installation 18 | ------------ 19 | 20 | The preferred method is installing via GIT. 21 | 22 | $ git clone https://github.com/cited/Tomcat-Webmin-Module 23 | 24 | $ mv Tomcat-Webmin-Module tomcat 25 | 26 | $ tar -cvzf tomcat.wbm.gz tomcat/ 27 | 28 | 29 | Upload from Webmin->Webmin Configuration->Webmin Modules 30 | 31 | Go to Servers->Apache Tomcat (you may need to refresh page) 32 | 33 | Contribute 34 | ---------- 35 | 36 | - Issue Tracker: github.com/cited/Tomcat-Webmin-Module/issues 37 | - Source Code: github.com/cited/Tomcat-Webmin-Module 38 | 39 | Support 40 | ------- 41 | 42 | If you are having issues, please let us know. 43 | We have a mailing list located at: project@google-groups.com 44 | 45 | License 46 | ------- 47 | 48 | The project is licensed under the BSD license. 49 | -------------------------------------------------------------------------------- /config: -------------------------------------------------------------------------------- 1 | tomcat_config=/etc/webmin/tomcat/config 2 | always_show_upgrade_btn=0 3 | -------------------------------------------------------------------------------- /config.info: -------------------------------------------------------------------------------- 1 | tomcat_config=Path to the Webmin Tomcat module config file,8 2 | always_show_upgrade_btn=Show upgrade button,1,1-Yes,0-No 3 | -------------------------------------------------------------------------------- /default_java.cgi: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | require './tomcat-lib.pl'; 4 | require './java-lib.pl'; 5 | require '../webmin/webmin-lib.pl'; #require 6 | 7 | use File::Basename; 8 | 9 | &ReadParse(); 10 | &error_setup($text{'install_err'}); 11 | 12 | &ui_print_header(undef, $text{'java_title'}, ""); 13 | 14 | my $jdk_name = $in{'inst_jdk2'}; 15 | $jdk_name || &error($text{'delete_enone'}); 16 | 17 | my $jdk_dir = get_jdk_dir_by_name($jdk_name); 18 | 19 | if(is_default_jdk($jdk_dir) == 1){ 20 | print "$jdk_dir is already set as default JDK.
"; 21 | }else{ 22 | set_default_java($jdk_dir); 23 | } 24 | 25 | print "
Done
"; 26 | &ui_print_footer("", $text{'index_return'}); 27 | -------------------------------------------------------------------------------- /delete_war.cgi: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | require './tomcat-lib.pl'; 4 | use File::Path 'rmtree'; 5 | 6 | &ReadParse(); 7 | 8 | &error_setup($text{'delete_err'}); 9 | &ui_print_header(undef, $text{'delete_title'}, ""); 10 | 11 | @mods = split(/\0/, $in{'mod'}); 12 | @mods || &error($text{'delete_enone'}); 13 | 14 | tomcat_service_ctl('stop'); 15 | 16 | #delete each of the specified directories 17 | my $catalina_home = get_catalina_home(); 18 | foreach $d (@mods) { 19 | print "Removing $catalina_home/$d
"; 20 | if(rmtree("$catalina_home/webapps/$d") == 0){ 21 | &error("Failed to remove application"); 22 | &ui_print_footer("", $text{'index_return'}); 23 | exit; 24 | } 25 | 26 | if($in{'rmwar'}){ 27 | $war = "$catalina_home/webapps/$d.war"; 28 | if( -f $war){ 29 | unlink($war); 30 | print "Removed $war
"; 31 | } 32 | } 33 | } 34 | print "Uninstall successful
"; 35 | 36 | tomcat_service_ctl('start'); 37 | 38 | &ui_print_footer("", $text{'index_return'}); 39 | 40 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | PAPER = 8 | BUILDDIR = _build 9 | 10 | # User-friendly check for sphinx-build 11 | ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) 12 | $(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) 13 | endif 14 | 15 | # Internal variables. 16 | PAPEROPT_a4 = -D latex_paper_size=a4 17 | PAPEROPT_letter = -D latex_paper_size=letter 18 | ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . 19 | # the i18n builder cannot share the environment and doctrees with the others 20 | I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . 21 | 22 | .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext 23 | 24 | help: 25 | @echo "Please use \`make ' where is one of" 26 | @echo " html to make standalone HTML files" 27 | @echo " dirhtml to make HTML files named index.html in directories" 28 | @echo " singlehtml to make a single large HTML file" 29 | @echo " pickle to make pickle files" 30 | @echo " json to make JSON files" 31 | @echo " htmlhelp to make HTML files and a HTML help project" 32 | @echo " qthelp to make HTML files and a qthelp project" 33 | @echo " devhelp to make HTML files and a Devhelp project" 34 | @echo " epub to make an epub" 35 | @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" 36 | @echo " latexpdf to make LaTeX files and run them through pdflatex" 37 | @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" 38 | @echo " text to make text files" 39 | @echo " man to make manual pages" 40 | @echo " texinfo to make Texinfo files" 41 | @echo " info to make Texinfo files and run them through makeinfo" 42 | @echo " gettext to make PO message catalogs" 43 | @echo " changes to make an overview of all changed/added/deprecated items" 44 | @echo " xml to make Docutils-native XML files" 45 | @echo " pseudoxml to make pseudoxml-XML files for display purposes" 46 | @echo " linkcheck to check all external links for integrity" 47 | @echo " doctest to run all doctests embedded in the documentation (if enabled)" 48 | 49 | clean: 50 | rm -rf $(BUILDDIR)/* 51 | 52 | html: 53 | $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html 54 | @echo 55 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." 56 | 57 | dirhtml: 58 | $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml 59 | @echo 60 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." 61 | 62 | singlehtml: 63 | $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml 64 | @echo 65 | @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." 66 | 67 | pickle: 68 | $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle 69 | @echo 70 | @echo "Build finished; now you can process the pickle files." 71 | 72 | json: 73 | $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json 74 | @echo 75 | @echo "Build finished; now you can process the JSON files." 76 | 77 | htmlhelp: 78 | $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp 79 | @echo 80 | @echo "Build finished; now you can run HTML Help Workshop with the" \ 81 | ".hhp project file in $(BUILDDIR)/htmlhelp." 82 | 83 | qthelp: 84 | $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp 85 | @echo 86 | @echo "Build finished; now you can run "qcollectiongenerator" with the" \ 87 | ".qhcp project file in $(BUILDDIR)/qthelp, like this:" 88 | @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/ReadtheDocsTemplate.qhcp" 89 | @echo "To view the help file:" 90 | @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/ReadtheDocsTemplate.qhc" 91 | 92 | devhelp: 93 | $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp 94 | @echo 95 | @echo "Build finished." 96 | @echo "To view the help file:" 97 | @echo "# mkdir -p $$HOME/.local/share/devhelp/ReadtheDocsTemplate" 98 | @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/ReadtheDocsTemplate" 99 | @echo "# devhelp" 100 | 101 | epub: 102 | $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub 103 | @echo 104 | @echo "Build finished. The epub file is in $(BUILDDIR)/epub." 105 | 106 | latex: 107 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 108 | @echo 109 | @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." 110 | @echo "Run \`make' in that directory to run these through (pdf)latex" \ 111 | "(use \`make latexpdf' here to do that automatically)." 112 | 113 | latexpdf: 114 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 115 | @echo "Running LaTeX files through pdflatex..." 116 | $(MAKE) -C $(BUILDDIR)/latex all-pdf 117 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 118 | 119 | latexpdfja: 120 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 121 | @echo "Running LaTeX files through platex and dvipdfmx..." 122 | $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja 123 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 124 | 125 | text: 126 | $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text 127 | @echo 128 | @echo "Build finished. The text files are in $(BUILDDIR)/text." 129 | 130 | man: 131 | $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man 132 | @echo 133 | @echo "Build finished. The manual pages are in $(BUILDDIR)/man." 134 | 135 | texinfo: 136 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo 137 | @echo 138 | @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." 139 | @echo "Run \`make' in that directory to run these through makeinfo" \ 140 | "(use \`make info' here to do that automatically)." 141 | 142 | info: 143 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo 144 | @echo "Running Texinfo files through makeinfo..." 145 | make -C $(BUILDDIR)/texinfo info 146 | @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." 147 | 148 | gettext: 149 | $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale 150 | @echo 151 | @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." 152 | 153 | changes: 154 | $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes 155 | @echo 156 | @echo "The overview file is in $(BUILDDIR)/changes." 157 | 158 | linkcheck: 159 | $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck 160 | @echo 161 | @echo "Link check complete; look for any errors in the above output " \ 162 | "or in $(BUILDDIR)/linkcheck/output.txt." 163 | 164 | doctest: 165 | $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest 166 | @echo "Testing of doctests in the sources finished, look at the " \ 167 | "results in $(BUILDDIR)/doctest/output.txt." 168 | 169 | xml: 170 | $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml 171 | @echo 172 | @echo "Build finished. The XML files are in $(BUILDDIR)/xml." 173 | 174 | pseudoxml: 175 | $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml 176 | @echo 177 | @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." 178 | -------------------------------------------------------------------------------- /docs/authors.rst: -------------------------------------------------------------------------------- 1 | .. include:: ../AUTHORS.rst 2 | -------------------------------------------------------------------------------- /docs/conf.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Read the Docs Template documentation build configuration file, created by 4 | # sphinx-quickstart on Tue Aug 26 14:19:49 2014. 5 | # 6 | # This file is execfile()d with the current directory set to its 7 | # containing dir. 8 | # 9 | # Note that not all possible configuration values are present in this 10 | # autogenerated file. 11 | # 12 | # All configuration values have a default; values that are commented out 13 | # serve to show the default. 14 | 15 | import sys 16 | import os 17 | 18 | # If extensions (or modules to document with autodoc) are in another directory, 19 | # add these directories to sys.path here. If the directory is relative to the 20 | # documentation root, use os.path.abspath to make it absolute, like shown here. 21 | #sys.path.insert(0, os.path.abspath('.')) 22 | 23 | # -- General configuration ------------------------------------------------ 24 | 25 | # If your documentation needs a minimal Sphinx version, state it here. 26 | #needs_sphinx = '1.0' 27 | 28 | # Add any Sphinx extension module names here, as strings. They can be 29 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 30 | # ones. 31 | extensions = [] 32 | 33 | # Add any paths that contain templates here, relative to this directory. 34 | templates_path = ['_templates'] 35 | 36 | # The suffix of source filenames. 37 | source_suffix = '.rst' 38 | 39 | # The encoding of source files. 40 | #source_encoding = 'utf-8-sig' 41 | 42 | # The master toctree document. 43 | master_doc = 'index' 44 | 45 | # General information about the project. 46 | project = u'Tomcat Webmin Module' 47 | copyright = u'2020, Cited, Inc.' 48 | 49 | # The version info for the project you're documenting, acts as replacement for 50 | # |version| and |release|, also used in various other places throughout the 51 | # built documents. 52 | # 53 | # The short X.Y version. 54 | version = '1.0' 55 | # The full version, including alpha/beta/rc tags. 56 | release = '1.0' 57 | 58 | # The language for content autogenerated by Sphinx. Refer to documentation 59 | # for a list of supported languages. 60 | #language = None 61 | 62 | # There are two options for replacing |today|: either, you set today to some 63 | # non-false value, then it is used: 64 | #today = '' 65 | # Else, today_fmt is used as the format for a strftime call. 66 | #today_fmt = '%B %d, %Y' 67 | 68 | # List of patterns, relative to source directory, that match files and 69 | # directories to ignore when looking for source files. 70 | exclude_patterns = ['_build'] 71 | 72 | # The reST default role (used for this markup: `text`) to use for all 73 | # documents. 74 | #default_role = None 75 | 76 | # If true, '()' will be appended to :func: etc. cross-reference text. 77 | #add_function_parentheses = True 78 | 79 | # If true, the current module name will be prepended to all description 80 | # unit titles (such as .. function::). 81 | #add_module_names = True 82 | 83 | # If true, sectionauthor and moduleauthor directives will be shown in the 84 | # output. They are ignored by default. 85 | #show_authors = False 86 | 87 | # The name of the Pygments (syntax highlighting) style to use. 88 | pygments_style = 'sphinx' 89 | 90 | # A list of ignored prefixes for module index sorting. 91 | #modindex_common_prefix = [] 92 | 93 | # If true, keep warnings as "system message" paragraphs in the built documents. 94 | #keep_warnings = False 95 | 96 | 97 | # -- Options for HTML output ---------------------------------------------- 98 | 99 | # The theme to use for HTML and HTML Help pages. See the documentation for 100 | # a list of builtin themes. 101 | html_theme = 'default' 102 | 103 | # Theme options are theme-specific and customize the look and feel of a theme 104 | # further. For a list of options available for each theme, see the 105 | # documentation. 106 | #html_theme_options = {} 107 | 108 | # Add any paths that contain custom themes here, relative to this directory. 109 | #html_theme_path = [] 110 | 111 | # The name for this set of Sphinx documents. If None, it defaults to 112 | # " v documentation". 113 | #html_title = None 114 | 115 | # A shorter title for the navigation bar. Default is the same as html_title. 116 | #html_short_title = None 117 | 118 | # The name of an image file (relative to this directory) to place at the top 119 | # of the sidebar. 120 | #html_logo = None 121 | 122 | # The name of an image file (within the static path) to use as favicon of the 123 | # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 124 | # pixels large. 125 | #html_favicon = None 126 | 127 | # Add any paths that contain custom static files (such as style sheets) here, 128 | # relative to this directory. They are copied after the builtin static files, 129 | # so a file named "default.css" will overwrite the builtin "default.css". 130 | html_static_path = ['_static'] 131 | 132 | # Add any extra paths that contain custom files (such as robots.txt or 133 | # .htaccess) here, relative to this directory. These files are copied 134 | # directly to the root of the documentation. 135 | #html_extra_path = [] 136 | 137 | # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, 138 | # using the given strftime format. 139 | #html_last_updated_fmt = '%b %d, %Y' 140 | 141 | # If true, SmartyPants will be used to convert quotes and dashes to 142 | # typographically correct entities. 143 | #html_use_smartypants = True 144 | 145 | # Custom sidebar templates, maps document names to template names. 146 | #html_sidebars = {} 147 | 148 | # Additional templates that should be rendered to pages, maps page names to 149 | # template names. 150 | #html_additional_pages = {} 151 | 152 | # If false, no module index is generated. 153 | #html_domain_indices = True 154 | 155 | # If false, no index is generated. 156 | #html_use_index = True 157 | 158 | # If true, the index is split into individual pages for each letter. 159 | #html_split_index = False 160 | 161 | # If true, links to the reST sources are added to the pages. 162 | #html_show_sourcelink = True 163 | 164 | # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. 165 | #html_show_sphinx = True 166 | 167 | # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. 168 | #html_show_copyright = True 169 | 170 | # If true, an OpenSearch description file will be output, and all pages will 171 | # contain a tag referring to it. The value of this option must be the 172 | # base URL from which the finished HTML is served. 173 | #html_use_opensearch = '' 174 | 175 | # This is the file name suffix for HTML files (e.g. ".xhtml"). 176 | #html_file_suffix = None 177 | 178 | # Output file base name for HTML help builder. 179 | htmlhelp_basename = 'ReadtheDocsTemplatedoc' 180 | 181 | 182 | # -- Options for LaTeX output --------------------------------------------- 183 | 184 | latex_elements = { 185 | # The paper size ('letterpaper' or 'a4paper'). 186 | #'papersize': 'letterpaper', 187 | 188 | # The font size ('10pt', '11pt' or '12pt'). 189 | #'pointsize': '10pt', 190 | 191 | # Additional stuff for the LaTeX preamble. 192 | #'preamble': '', 193 | } 194 | 195 | # Grouping the document tree into LaTeX files. List of tuples 196 | # (source start file, target name, title, 197 | # author, documentclass [howto, manual, or own class]). 198 | latex_documents = [ 199 | ('index', 'ReadtheDocsTemplate.tex', u'Read the Docs Template Documentation', 200 | u'Read the Docs', 'manual'), 201 | ] 202 | 203 | # The name of an image file (relative to this directory) to place at the top of 204 | # the title page. 205 | #latex_logo = None 206 | 207 | # For "manual" documents, if this is true, then toplevel headings are parts, 208 | # not chapters. 209 | #latex_use_parts = False 210 | 211 | # If true, show page references after internal links. 212 | #latex_show_pagerefs = False 213 | 214 | # If true, show URL addresses after external links. 215 | #latex_show_urls = False 216 | 217 | # Documents to append as an appendix to all manuals. 218 | #latex_appendices = [] 219 | 220 | # If false, no module index is generated. 221 | #latex_domain_indices = True 222 | 223 | 224 | # -- Options for manual page output --------------------------------------- 225 | 226 | # One entry per manual page. List of tuples 227 | # (source start file, name, description, authors, manual section). 228 | man_pages = [ 229 | ('index', 'readthedocstemplate', u'Read the Docs Template Documentation', 230 | [u'Read the Docs'], 1) 231 | ] 232 | 233 | # If true, show URL addresses after external links. 234 | #man_show_urls = False 235 | 236 | 237 | # -- Options for Texinfo output ------------------------------------------- 238 | 239 | # Grouping the document tree into Texinfo files. List of tuples 240 | # (source start file, target name, title, author, 241 | # dir menu entry, description, category) 242 | texinfo_documents = [ 243 | ('index', 'ReadtheDocsTemplate', u'Read the Docs Template Documentation', 244 | u'Read the Docs', 'ReadtheDocsTemplate', 'One line description of project.', 245 | 'Miscellaneous'), 246 | ] 247 | 248 | # Documents to append as an appendix to all manuals. 249 | #texinfo_appendices = [] 250 | 251 | # If false, no module index is generated. 252 | #texinfo_domain_indices = True 253 | 254 | # How to display URL addresses: 'footnote', 'no', or 'inline'. 255 | #texinfo_show_urls = 'footnote' 256 | 257 | # If true, do not generate a @detailmenu in the "Top" node's menu. 258 | #texinfo_no_detailmenu = False 259 | -------------------------------------------------------------------------------- /docs/contributing.rst: -------------------------------------------------------------------------------- 1 | .. include:: ../CONTRIBUTING.rst 2 | -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | .. Read the Docs Template documentation master file, created by 2 | sphinx-quickstart on Tue Aug 26 14:19:49 2014. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | 7 | Tomcat Webmin Module Docs 8 | ================================================== 9 | 10 | Contents: 11 | 12 | .. toctree:: 13 | :maxdepth: 2 14 | :glob: 15 | 16 | * 17 | 18 | 19 | 20 | Cited, Inc. 21 | ================== 22 | 23 | `Cited, Inc. `_ 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /docs/installation.rst: -------------------------------------------------------------------------------- 1 | ============ 2 | Installation 3 | ============ 4 | 5 | The preferred method is installing via GIT. 6 | 7 | Install the package with GIT:: 8 | 9 | $ git clone https://github.com/cited/Tomcat-Webmin-Module 10 | 11 | $ mv Tomcat-Webmin-Module tomcat 12 | 13 | $ tar -cvzf tomcat.wbm.gz tomcat/ 14 | 15 | 16 | Upload from Webmin->Webmin Configuration->Webmin Modules 17 | 18 | Go to Servers->Apache Tomcat (you may need to refresh page) 19 | -------------------------------------------------------------------------------- /docs/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | REM Command file for Sphinx documentation 4 | 5 | if "%SPHINXBUILD%" == "" ( 6 | set SPHINXBUILD=sphinx-build 7 | ) 8 | set BUILDDIR=_build 9 | set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% . 10 | set I18NSPHINXOPTS=%SPHINXOPTS% . 11 | if NOT "%PAPER%" == "" ( 12 | set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% 13 | set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% 14 | ) 15 | 16 | if "%1" == "" goto help 17 | 18 | if "%1" == "help" ( 19 | :help 20 | echo.Please use `make ^` where ^ is one of 21 | echo. html to make standalone HTML files 22 | echo. dirhtml to make HTML files named index.html in directories 23 | echo. singlehtml to make a single large HTML file 24 | echo. pickle to make pickle files 25 | echo. json to make JSON files 26 | echo. htmlhelp to make HTML files and a HTML help project 27 | echo. qthelp to make HTML files and a qthelp project 28 | echo. devhelp to make HTML files and a Devhelp project 29 | echo. epub to make an epub 30 | echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter 31 | echo. text to make text files 32 | echo. man to make manual pages 33 | echo. texinfo to make Texinfo files 34 | echo. gettext to make PO message catalogs 35 | echo. changes to make an overview over all changed/added/deprecated items 36 | echo. xml to make Docutils-native XML files 37 | echo. pseudoxml to make pseudoxml-XML files for display purposes 38 | echo. linkcheck to check all external links for integrity 39 | echo. doctest to run all doctests embedded in the documentation if enabled 40 | goto end 41 | ) 42 | 43 | if "%1" == "clean" ( 44 | for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i 45 | del /q /s %BUILDDIR%\* 46 | goto end 47 | ) 48 | 49 | 50 | %SPHINXBUILD% 2> nul 51 | if errorlevel 9009 ( 52 | echo. 53 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 54 | echo.installed, then set the SPHINXBUILD environment variable to point 55 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 56 | echo.may add the Sphinx directory to PATH. 57 | echo. 58 | echo.If you don't have Sphinx installed, grab it from 59 | echo.http://sphinx-doc.org/ 60 | exit /b 1 61 | ) 62 | 63 | if "%1" == "html" ( 64 | %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html 65 | if errorlevel 1 exit /b 1 66 | echo. 67 | echo.Build finished. The HTML pages are in %BUILDDIR%/html. 68 | goto end 69 | ) 70 | 71 | if "%1" == "dirhtml" ( 72 | %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml 73 | if errorlevel 1 exit /b 1 74 | echo. 75 | echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. 76 | goto end 77 | ) 78 | 79 | if "%1" == "singlehtml" ( 80 | %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml 81 | if errorlevel 1 exit /b 1 82 | echo. 83 | echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. 84 | goto end 85 | ) 86 | 87 | if "%1" == "pickle" ( 88 | %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle 89 | if errorlevel 1 exit /b 1 90 | echo. 91 | echo.Build finished; now you can process the pickle files. 92 | goto end 93 | ) 94 | 95 | if "%1" == "json" ( 96 | %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json 97 | if errorlevel 1 exit /b 1 98 | echo. 99 | echo.Build finished; now you can process the JSON files. 100 | goto end 101 | ) 102 | 103 | if "%1" == "htmlhelp" ( 104 | %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp 105 | if errorlevel 1 exit /b 1 106 | echo. 107 | echo.Build finished; now you can run HTML Help Workshop with the ^ 108 | .hhp project file in %BUILDDIR%/htmlhelp. 109 | goto end 110 | ) 111 | 112 | if "%1" == "qthelp" ( 113 | %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp 114 | if errorlevel 1 exit /b 1 115 | echo. 116 | echo.Build finished; now you can run "qcollectiongenerator" with the ^ 117 | .qhcp project file in %BUILDDIR%/qthelp, like this: 118 | echo.^> qcollectiongenerator %BUILDDIR%\qthelp\complexity.qhcp 119 | echo.To view the help file: 120 | echo.^> assistant -collectionFile %BUILDDIR%\qthelp\complexity.ghc 121 | goto end 122 | ) 123 | 124 | if "%1" == "devhelp" ( 125 | %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp 126 | if errorlevel 1 exit /b 1 127 | echo. 128 | echo.Build finished. 129 | goto end 130 | ) 131 | 132 | if "%1" == "epub" ( 133 | %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub 134 | if errorlevel 1 exit /b 1 135 | echo. 136 | echo.Build finished. The epub file is in %BUILDDIR%/epub. 137 | goto end 138 | ) 139 | 140 | if "%1" == "latex" ( 141 | %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex 142 | if errorlevel 1 exit /b 1 143 | echo. 144 | echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. 145 | goto end 146 | ) 147 | 148 | if "%1" == "latexpdf" ( 149 | %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex 150 | cd %BUILDDIR%/latex 151 | make all-pdf 152 | cd %BUILDDIR%/.. 153 | echo. 154 | echo.Build finished; the PDF files are in %BUILDDIR%/latex. 155 | goto end 156 | ) 157 | 158 | if "%1" == "latexpdfja" ( 159 | %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex 160 | cd %BUILDDIR%/latex 161 | make all-pdf-ja 162 | cd %BUILDDIR%/.. 163 | echo. 164 | echo.Build finished; the PDF files are in %BUILDDIR%/latex. 165 | goto end 166 | ) 167 | 168 | if "%1" == "text" ( 169 | %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text 170 | if errorlevel 1 exit /b 1 171 | echo. 172 | echo.Build finished. The text files are in %BUILDDIR%/text. 173 | goto end 174 | ) 175 | 176 | if "%1" == "man" ( 177 | %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man 178 | if errorlevel 1 exit /b 1 179 | echo. 180 | echo.Build finished. The manual pages are in %BUILDDIR%/man. 181 | goto end 182 | ) 183 | 184 | if "%1" == "texinfo" ( 185 | %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo 186 | if errorlevel 1 exit /b 1 187 | echo. 188 | echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo. 189 | goto end 190 | ) 191 | 192 | if "%1" == "gettext" ( 193 | %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale 194 | if errorlevel 1 exit /b 1 195 | echo. 196 | echo.Build finished. The message catalogs are in %BUILDDIR%/locale. 197 | goto end 198 | ) 199 | 200 | if "%1" == "changes" ( 201 | %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes 202 | if errorlevel 1 exit /b 1 203 | echo. 204 | echo.The overview file is in %BUILDDIR%/changes. 205 | goto end 206 | ) 207 | 208 | if "%1" == "linkcheck" ( 209 | %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck 210 | if errorlevel 1 exit /b 1 211 | echo. 212 | echo.Link check complete; look for any errors in the above output ^ 213 | or in %BUILDDIR%/linkcheck/output.txt. 214 | goto end 215 | ) 216 | 217 | if "%1" == "doctest" ( 218 | %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest 219 | if errorlevel 1 exit /b 1 220 | echo. 221 | echo.Testing of doctests in the sources finished, look at the ^ 222 | results in %BUILDDIR%/doctest/output.txt. 223 | goto end 224 | ) 225 | 226 | if "%1" == "xml" ( 227 | %SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml 228 | if errorlevel 1 exit /b 1 229 | echo. 230 | echo.Build finished. The XML files are in %BUILDDIR%/xml. 231 | goto end 232 | ) 233 | 234 | if "%1" == "pseudoxml" ( 235 | %SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml 236 | if errorlevel 1 exit /b 1 237 | echo. 238 | echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml. 239 | goto end 240 | ) 241 | 242 | :end 243 | -------------------------------------------------------------------------------- /docs/readme.rst: -------------------------------------------------------------------------------- 1 | .. include:: ../README.rst 2 | -------------------------------------------------------------------------------- /docs/usage.rst: -------------------------------------------------------------------------------- 1 | ======== 2 | Usage 3 | ======== 4 | 5 | Tomcat Module: 6 | 7 | .. image:: https://cdn.acugis.com/apache-tomcat-webmin-plugin/tomcat-module-plugin.gif 8 | 9 | Tomcat Module WAR Manager: 10 | 11 | .. image:: https://cdn.acugis.com/apache-tomcat-webmin-plugin/tomcat-module-war-deploy.gif 12 | 13 | Tomcat Module Configuration Editor: 14 | 15 | .. image:: https://cdn.acugis.com/apache-tomcat-webmin-plugin/tomcat-module-edit-configs.gif 16 | -------------------------------------------------------------------------------- /edit_java.cgi: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | require './tomcat-lib.pl'; 4 | require './java-lib.pl'; 5 | require '../webmin/webmin-lib.pl'; #for OS detection 6 | 7 | &ReadParse(); 8 | 9 | &ui_print_header(undef, $text{'java_title'}, ""); 10 | 11 | # Show tabs 12 | @tabs = ( [ "install", $text{'java_tabinstall'}, "edit_java.cgi?mode=install" ], 13 | [ "uninstall", $text{'java_tabuninstall'}, "edit_java.cgi?mode=uninstall" ], 14 | [ "default", $text{'java_tabdefault'}, "edit_java.cgi?mode=default" ] 15 | ); 16 | 17 | print &ui_tabs_start(\@tabs, "mode", $in{'mode'} || "install", 1); 18 | 19 | 20 | print &ui_tabs_start_tab("mode", "install"); 21 | print "$text{'java_desc1'}

\n"; 22 | 23 | print &ui_form_start("install_java.cgi", "form-data"); 24 | print &ui_table_start($text{'java_install'}, undef, 2); 25 | 26 | my %jdk_version = &get_latest_jdk_version(); 27 | @opt_avail_jdk = (); 28 | foreach $ver (keys %jdk_version) { 29 | push(@opt_avail_jdk, [ "$ver=$jdk_version{$ver}", $ver]); 30 | } 31 | 32 | my %openjdk_version = &get_openjdk_versions(); 33 | @opt_avail_openjdk = (); 34 | foreach $ver (reverse sort { $a <=> $b } keys %openjdk_version) { 35 | push(@opt_avail_openjdk, [ "$ver=$openjdk_version{$ver}", $ver]); 36 | } 37 | 38 | print &ui_table_row($text{'jdk_installsource'}, 39 | &ui_radio_table("source", 200, 40 | [ [ 200, $text{'openjdk_latest'}, &ui_select("openjdk_ver", undef, \@opt_avail_openjdk, 1, 0). 41 | '
'. 42 | &ui_checkbox("openjdk_headless", 1,undef, 1).$text{'openjdk_headless'}. 43 | &ui_hr()], 44 | [ 100, $text{'jdk_latest'}, &ui_select("jdk_ver", undef, \@opt_avail_jdk, 1, 0)], 45 | [ 0, $text{'source_local'}, &ui_textbox("file", undef, 40)." ". &file_chooser_button("file", 0) ], 46 | [ 1, $text{'source_uploaded'},&ui_upload("upload", 40) ], 47 | [ 2, $text{'source_ftp'}, &ui_textbox("url", undef, 40) ] 48 | ]), 2); 49 | print &ui_table_row($text{'java_def_jdk'}, 50 | &ui_checkbox("def_jdk", 1,undef, 1).$text{'java_def_jdk_desc'} 51 | ,2); 52 | 53 | 54 | print &ui_table_end(); 55 | print &ui_form_end([ [ "", $text{'java_installok'} ] ]); 56 | print &ui_tabs_end_tab(); 57 | 58 | 59 | print &ui_tabs_start_tab("mode", "uninstall"); 60 | print "$text{'java_desc2'}

\n"; 61 | 62 | print &ui_form_start("uninstall_java.cgi", "post"); 63 | print &ui_table_start($text{'java_uninstall'}, undef, 2); 64 | 65 | @jdk_vlist = &get_installed_jdk_versions(); 66 | @opts_inst_jdk = ( ); 67 | foreach $jdk_ver (@jdk_vlist) { 68 | push(@opts_inst_jdk, [ $jdk_ver, $jdk_ver ]); 69 | } 70 | print &ui_table_row($text{'java_installed'}, &ui_select("inst_jdk", undef, \@opts_inst_jdk, 1, 0)."
\n", 2); 71 | print &ui_table_row($text{'java_rm_def_jdk'}, &ui_checkbox("rm_def_jdk", 1,undef, 1), 2); 72 | 73 | print &ui_table_end(); 74 | print &ui_form_end([ [ "", $text{'java_deleteok'} ] ]); 75 | print &ui_tabs_end_tab(); 76 | 77 | print &ui_tabs_start_tab("mode", "default"); 78 | print "$text{'java_desc3'}

\n"; 79 | 80 | print &ui_form_start("default_java.cgi", "post"); 81 | print &ui_table_start($text{'java_default'}, undef, 2); 82 | 83 | print &ui_table_row($text{'java_installed'}, &ui_select("inst_jdk2", undef, \@opts_inst_jdk, 1, 0)."
\n", 2); 84 | 85 | print &ui_table_end(); 86 | print &ui_form_end([ [ "", $text{'java_defaultok'} ] ]); 87 | print &ui_tabs_end_tab(); 88 | 89 | print &ui_tabs_end(1); 90 | 91 | &ui_print_footer("", $text{'index_return'}); 92 | -------------------------------------------------------------------------------- /edit_libs.cgi: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | require './tomcat-lib.pl'; 4 | &ReadParse(); 5 | 6 | &ui_print_header(undef, $text{'libs_title'}, ""); 7 | 8 | # Show tabs 9 | @tabs = ( [ "install", $text{'libs_tabinstall'}, "edit_libs.cgi?mode=install" ], 10 | [ "uninstall", $text{'libs_tabuninstall'}, "edit_libs.cgi?mode=uninstall" ] 11 | ); 12 | 13 | print &ui_tabs_start(\@tabs, "mode", $in{'mode'} || "install", 1); 14 | 15 | # Display installation form 16 | print &ui_tabs_start_tab("mode", "install"); 17 | print "$text{'libs_desc1'}

\n"; 18 | 19 | print &ui_form_start("install_libs.cgi", "form-data"); 20 | print &ui_table_start($text{'libs_install'}, undef, 2); 21 | 22 | print &ui_table_row($text{'libs_installsource'}, 23 | &ui_radio_table("source", 0, 24 | [ [ 0, $text{'source_local'}, &ui_textbox("file", undef, 40)." ". &file_chooser_button("file", 0) ], 25 | [ 1, $text{'source_uploaded'},&ui_upload("upload", 40) ], 26 | [ 2, $text{'source_ftp'}, &ui_textbox("url", undef, 40) ] 27 | ])); 28 | 29 | print &ui_table_end(); 30 | print &ui_form_end([ [ "", $text{'libs_installok'} ] ]); 31 | print &ui_tabs_end_tab(); 32 | 33 | 34 | # Display deletion form 35 | print &ui_tabs_start_tab("mode", "uninstall"); 36 | print "$text{'libs_desc2'}

\n"; 37 | 38 | print &ui_form_start("uninstall_libs.cgi", "post"); 39 | print &ui_table_start($text{'libs_delete'}, undef, 2); 40 | 41 | @libs_lists = &get_installed_libs(); 42 | @opts_inst_libs = ( ); 43 | foreach $lib_file (@libs_lists) { 44 | $lib_file =~ /^lib_([a-z0-9\.\-_\s]+)\.list$/i; 45 | push(@opts_inst_libs, [ $1, $1 ]); 46 | } 47 | print &ui_table_row($text{'libs_installed'}, &ui_select("inst_lib", undef, \@opts_inst_libs, 10, 1), 2); 48 | 49 | print &ui_table_end(); 50 | print &ui_form_end([ [ "", $text{'libs_deleteok'} ] ]); 51 | print &ui_tabs_end_tab(); 52 | 53 | 54 | print &ui_tabs_end(1); 55 | 56 | &ui_print_footer("", $text{'index_return'}); 57 | -------------------------------------------------------------------------------- /edit_manual.cgi: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # Show a page for manually editing an Tomcat server.xml config file 3 | 4 | require './tomcat-lib.pl'; 5 | &ReadParse(); 6 | &ui_print_header(undef, $text{'manual_title'}, ""); 7 | 8 | my $catalina_home = get_catalina_home(); 9 | 10 | # Work out and show the files 11 | @files = ( "$catalina_home/bin/setenv.sh", 12 | "$catalina_home/conf/context.xml", 13 | "$catalina_home/conf/server.xml", 14 | "$catalina_home/conf/tomcat-users.xml", 15 | "$catalina_home/conf/web.xml"); 16 | $in{'file'} ||= $files[0]; 17 | &indexof($in{'file'}, @files) >= 0 || &error($text{'manual_efile'}); 18 | 19 | print &ui_form_start("edit_manual.cgi"); 20 | print "$text{'manual_file'}\n"; 21 | print &ui_select("file", $in{'file'}, [ map { [ $_ ] } @files ], 1, 0); 22 | print &ui_submit($text{'manual_ok'}); 23 | print &ui_form_end(); 24 | 25 | # Show the file contents 26 | print &ui_form_start("save_manual.cgi", "form-data"); 27 | print &ui_hidden("file", $in{'file'}),"\n"; 28 | $data = &read_file_contents($in{'file'}); 29 | print &ui_textarea("data", $data, 20, 80),"\n"; 30 | print &ui_form_end([ [ "save", $text{'save'} ] ]); 31 | 32 | &ui_print_footer("", $text{'index_return'}); 33 | 34 | -------------------------------------------------------------------------------- /edit_proxy.cgi: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | require './tomcat-lib.pl'; 4 | foreign_require('apache', 'apache-lib.pl'); 5 | 6 | sub get_proxy_file{ 7 | my $domain_user = $_[0]; 8 | my $proxy_file = ''; 9 | 10 | if( -d '/etc/httpd/conf.d' ){ 11 | $proxy_file = '/etc/httpd/conf.d/tomcat.conf'; 12 | }elsif( -d '/etc/apache2/conf-enabled/'){ #ubuntu or debian 13 | $proxy_file = '/etc/apache2/conf-enabled/tomcat.conf'; 14 | } 15 | return $proxy_file; 16 | } 17 | 18 | sub load_proxy_maps{ 19 | my $proxy_file = $_[0]; 20 | 21 | my %maps; 22 | open(my $fh, '<', $proxy_file) or return %maps; 23 | while(my $line = <$fh>){ 24 | if($line =~ /^ProxyPass ([\/a-z0-9_\-\.]+) ([a-z:\/0-9\.\-]+)/i){ 25 | $maps{$2} = $1; 26 | } 27 | } 28 | close $fh; 29 | 30 | return %maps; 31 | } 32 | 33 | sub add_proxy{ 34 | my $proxy_file = $_[0]; 35 | my $app_name = $_[1]; 36 | my $default = $_[2]; 37 | my $ssl_port = $_[3]; 38 | my $wildcard = $_[4]; 39 | 40 | my %idata = ('port_http'=>'8080', 'port_https'=>'8443'); 41 | 42 | my $app_path = '/'; 43 | if($default == 0){ #if app is not default 44 | $app_path .= $app_name; 45 | } 46 | 47 | if($wildcard == 1){ 48 | $app_name = ''; 49 | } 50 | 51 | my $lref = &read_file_lines($proxy_file); 52 | my $lnum = 0; 53 | my $proxy_header_section = 0; 54 | my $user_domain = 'localhost'; 55 | foreach my $line (@$lref) { 56 | if($line =~ /^ProxyPass \/ |^ProxyPassReverse \/ /){ #another default app 57 | if($default == 1){ #if new app is default 58 | delete @{$lref}[$lnum]; #remove old default app 59 | } 60 | }elsif($line =~ /^ProxyPass.*\/$app_name$/){ #if its a line with our app 61 | delete @{$lref}[$lnum]; 62 | }elsif($line =~ /^ProxyRequests Off$/){ 63 | $proxy_header_section = 1; #proxy settings are found 64 | }elsif($line =~ /^ServerName (.*)$/){ 65 | $user_domain = $1; 66 | } 67 | $lnum++; 68 | } 69 | 70 | 71 | my $conf_tail; 72 | if(@$lref[$lnum] eq ''){ 73 | $conf_tail = pop @{$lref}; 74 | } 75 | if($proxy_header_section == 0){ 76 | my $line = "ProxyRequests Off 77 | ProxyPreserveHost On 78 | 79 | Order allow,deny 80 | Allow from all 81 | "; 82 | push(@$lref, $line); 83 | } 84 | 85 | my $proto = ''; 86 | if($ssl_port == 1){ 87 | $proto = 's'; 88 | } 89 | 90 | push(@$lref, "ProxyPass $app_path http".$proto."://$user_domain:".$idata{'port_http'.$proto}."/$app_name"); 91 | push(@$lref, "ProxyPassReverse $app_path http".$proto."://$user_domain:".$idata{'port_http'.$proto}."/$app_name"); 92 | if($conf_tail){ 93 | push(@$lref, $conf_tail); #Restore conf end 94 | } 95 | 96 | flush_file_lines($proxy_file); 97 | } 98 | 99 | sub remove_proxy{ 100 | my ($proxy_file, $app_path) = @_; 101 | 102 | my $lref = &read_file_lines($proxy_file); 103 | my $lnum = 0; 104 | foreach my $line (@$lref) { 105 | if($line =~ /^ProxyPass $app_path |^ProxyPassReverse $app_path /){ #if its a line with our app 106 | delete @{$lref}[$lnum]; 107 | } 108 | $lnum++; 109 | } 110 | flush_file_lines($proxy_file); 111 | } 112 | 113 | &ReadParse(); 114 | 115 | my $form_submit = 0; 116 | if ($in{'submit_flag'}) { 117 | $form_submit = 1; 118 | } 119 | 120 | &ui_print_header(undef, $text{'proxy_title'}, ""); 121 | 122 | 123 | my $proxy_file = get_proxy_file($remote_user); 124 | if($proxy_file eq ''){ 125 | print "Error: Failed to find proxy file for user $remote_user" 126 | } 127 | 128 | if($form_submit == 1){ 129 | if($in{'app_path'}){ 130 | remove_proxy($proxy_file, $in{'app_path'}); 131 | }else{ 132 | add_proxy($proxy_file, $in{'app_name'}, $in{'app_default'}, $in{'proxy_ssl'}, $in{'app_wildcard'}); 133 | } 134 | apache::restart_apache(); 135 | } 136 | 137 | my %maps = load_proxy_maps($proxy_file); 138 | my @tds = (); 139 | print &ui_columns_start(['Path','URL'], undef, 0, \@tds, 'Apps with proxy ('.$proxy_file.')'); 140 | foreach my $url (keys %maps) { 141 | 142 | my @cols; 143 | push(@cols, $maps{$url}); 144 | push(@cols, "$url"); 145 | 146 | print &ui_columns_row(\@cols, \@tds); 147 | } 148 | print &ui_columns_end(); 149 | 150 | 151 | print &ui_form_start("edit_proxy.cgi", "post"); 152 | print &ui_hidden('submit_flag', 1); 153 | print &ui_table_start($text{'proxy_add_options'}, undef, 2); 154 | 155 | my @apps = get_all_war_infos(); 156 | @opt_apps = ( ); 157 | foreach $app (@apps) { 158 | push(@opt_apps, [ $app, $app ]); 159 | } 160 | print &ui_table_row($text{'proxy_wildcard'}, 161 | &ui_checkbox("app_wildcard", 1, $text{'proxy_wildcard_info'}, 0), 2); 162 | print &ui_table_hr(); 163 | print &ui_table_row($text{'wars_installed'}, &ui_select("app_name", undef, \@opt_apps, 10, 1), 2); 164 | print &ui_table_row($text{'proxy_default_app'}, 165 | &ui_checkbox("app_default", 1, $text{'proxy_app_default_warning'}, 0), 2); 166 | print &ui_table_row($text{'proxy_ssl'}, 167 | &ui_checkbox("proxy_ssl", 1, $text{'proxy_ssl_info'}, 0), 2); 168 | 169 | print &ui_table_end(); 170 | print &ui_form_end([ [ "", $text{'proxy_installok'} ] ]); 171 | 172 | 173 | print &ui_form_start("edit_proxy.cgi", "post"); 174 | print &ui_hidden('submit_flag', 1); 175 | print &ui_table_start($text{'proxy_remove_options'}, undef, 2); 176 | 177 | 178 | @opt_paths = ( ); 179 | foreach $path (keys %maps) { 180 | my $val = $maps{$path}; 181 | push(@opt_paths, [ $val, $val ]); 182 | } 183 | print &ui_table_row($text{'proxy_list'}, &ui_select("app_path", undef, \@opt_paths, 10, 1), 2); 184 | 185 | print &ui_table_end(); 186 | print &ui_form_end([ [ "", $text{'proxy_removeok'} ] ]); 187 | 188 | &ui_print_footer("", $text{'index_return'}); 189 | -------------------------------------------------------------------------------- /edit_war.cgi: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | require './tomcat-lib.pl'; 4 | &ReadParse(); 5 | 6 | &ui_print_header(undef, $text{'wars_title'}, ""); 7 | 8 | # Show tabs 9 | @tabs = ( [ "install", $text{'wars_tabinstall'}, "edit_wars.cgi?mode=install" ], 10 | [ "delete", $text{'wars_tabdelete'}, "edit_wars.cgi?mode=delete" ] 11 | ); 12 | 13 | print &ui_tabs_start(\@tabs, "mode", $in{'mode'} || "install", 1); 14 | 15 | # Display installation form 16 | print &ui_tabs_start_tab("mode", "install"); 17 | print "$text{'wars_desc1'}

\n"; 18 | 19 | print &ui_form_start("install_war.cgi", "form-data"); 20 | print &ui_table_start($text{'war_install'}, undef, 2); 21 | 22 | print &ui_table_row($text{'war_installsource'}, 23 | &ui_radio_table("source", 0, 24 | [ [ 0, $text{'source_local'}, &ui_textbox("file", undef, 40)." ". &file_chooser_button("file", 0) ], 25 | [ 1, $text{'source_uploaded'}, &ui_upload("upload", 40) ], 26 | [ 2, $text{'source_ftp'},&ui_textbox("url", undef, 40) ] 27 | ])); 28 | 29 | print &ui_table_end(); 30 | print &ui_form_end([ [ "", $text{'war_installok'} ] ]); 31 | print &ui_tabs_end_tab(); 32 | 33 | 34 | # Display deletion form 35 | print &ui_tabs_start_tab("mode", "delete"); 36 | print "$text{'wars_desc2'}

\n"; 37 | 38 | print &ui_form_start("delete_war.cgi", "post"); 39 | print &ui_table_start($text{'wars_delete'}, undef, 2); 40 | 41 | @wlist = &get_all_war_infos(); 42 | @opts = ( ); 43 | foreach $d (@wlist) { 44 | push(@opts, [ $d, $d ]); 45 | } 46 | print &ui_table_row($text{'wars_installed'}, 47 | &ui_select("mod", undef, \@opts, 10, 1)."
\n". 48 | &ui_checkbox("rmwar", 1, $text{'wars_rmwar'}, 0), 2); 49 | 50 | print &ui_table_end(); 51 | print &ui_form_end([ [ "", $text{'wars_deleteok'} ] ]); 52 | print &ui_tabs_end_tab(); 53 | 54 | 55 | print &ui_tabs_end(1); 56 | 57 | &ui_print_footer("", $text{'index_return'}); 58 | -------------------------------------------------------------------------------- /help/intro.html: -------------------------------------------------------------------------------- 1 |

Apache_Tomcat">Apache Tomcat
2 | 3 |

Module produced by Cited, Inc. © 2019 AcuGIS, Cited, Inc.

4 | 5 |

The Apache Tomcat® software is an open source implementation 6 | of the Java Servlet, JavaServer Pages, Java Expression Language and Java 7 | WebSocket technologies. The Java Servlet, JavaServer Pages, Java Expression 8 | Language and Java WebSocket specifications are developed under the 9 | Java Community 10 | Process. 11 |

12 | 13 |

The Apache Tomcat software is developed in an open and participatory 14 | environment and released under the 15 | Apache License version 2. The 16 | Apache Tomcat project is intended to be a collaboration of the best-of-breed 17 | developers from around the world. We invite you to participate in this open 18 | development project. To learn more about getting involved, 19 | click here.

20 | 21 |

Apache Tomcat software powers numerous large-scale, mission-critical web 22 | applications across a diverse range of industries and organizations. Some of 23 | these users and their stories are listed on the 24 | PoweredBy wiki page.

25 | 26 |

Apache Tomcat, Tomcat, Apache, the Apache feather, and the Apache Tomcat 27 | project logo are trademarks of the Apache Software Foundation.

28 | 29 |
30 | -------------------------------------------------------------------------------- /images/edit-file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cited/Tomcat-Webmin-Module/bb2fcedb75ad55abe9b5a8fde3de8836b3886a32/images/edit-file.png -------------------------------------------------------------------------------- /images/icon.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cited/Tomcat-Webmin-Module/bb2fcedb75ad55abe9b5a8fde3de8836b3886a32/images/icon.gif -------------------------------------------------------------------------------- /images/jar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cited/Tomcat-Webmin-Module/bb2fcedb75ad55abe9b5a8fde3de8836b3886a32/images/jar.png -------------------------------------------------------------------------------- /images/java.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cited/Tomcat-Webmin-Module/bb2fcedb75ad55abe9b5a8fde3de8836b3886a32/images/java.png -------------------------------------------------------------------------------- /images/manual.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cited/Tomcat-Webmin-Module/bb2fcedb75ad55abe9b5a8fde3de8836b3886a32/images/manual.gif -------------------------------------------------------------------------------- /images/mapping.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cited/Tomcat-Webmin-Module/bb2fcedb75ad55abe9b5a8fde3de8836b3886a32/images/mapping.png -------------------------------------------------------------------------------- /images/war.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cited/Tomcat-Webmin-Module/bb2fcedb75ad55abe9b5a8fde3de8836b3886a32/images/war.png -------------------------------------------------------------------------------- /index.cgi: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # index.cgi 3 | 4 | require './tomcat-lib.pl'; 5 | require '../webmin/webmin-lib.pl'; #for OS detection 6 | 7 | # Check if config file exists 8 | if (! -r $config{'tomcat_config'}) { 9 | &ui_print_header(undef, $text{'index_title'}, "", "intro", 1, 1); 10 | print &text('index_econfig', "$config{'tomcat_config'}", 11 | "$gconfig{'webprefix'}/config.cgi?$module_name"),"

\n"; 12 | &ui_print_footer("/", $text{"index"}); 13 | exit; 14 | } 15 | 16 | if(-f "$module_root_directory/setup.cgi"){ 17 | &redirect("setup.cgi?mode=checks"); 18 | exit; 19 | } 20 | 21 | my %version = get_catalina_version(); 22 | 23 | &ui_print_header(undef, $text{'index_title'}, "", "intro", 1, 1, 0, 24 | &help_search_link("tomcat", "man", "doc", "google"), undef, undef, 25 | "Tomcat $version{'number'} / Java $version{'jvm'}"); 26 | 27 | push(@links, "edit_manual.cgi"); 28 | push(@titles, $text{'manual_title'}); 29 | push(@icons, "images/edit-file.png"); 30 | 31 | push(@links, "edit_war.cgi"); 32 | push(@titles, $text{'wars_title'}); 33 | push(@icons, "images/war.png"); 34 | 35 | push(@links, "edit_libs.cgi"); 36 | push(@titles, $text{'libs_title'}); 37 | push(@icons, "images/jar.png"); 38 | 39 | push(@links, "edit_java.cgi"); 40 | push(@titles, $text{'java_title'}); 41 | push(@icons, "images/java.png"); 42 | 43 | push(@links, "edit_proxy.cgi"); 44 | push(@titles, $text{'proxy_title'}); 45 | push(@icons, "images/mapping.png"); 46 | 47 | &icons_table(\@links, \@titles, \@icons, 2); 48 | 49 | # Check if tomcat is running 50 | print &ui_hr().&ui_buttons_start(); 51 | my ($running, $status) = &tomcat_service_ctl('status'); 52 | print "$status
"; 53 | if ($running == 1) { 54 | # Running .. offer to apply changes and stop 55 | print &ui_buttons_row("stop.cgi", $text{'index_stop'}, "$text{'index_stopmsg'}"); 56 | print &ui_buttons_row("restart.cgi", $text{'index_restart'}, "$text{'index_restartmsg'}"); 57 | }else { 58 | # Not running .. offer to start 59 | print &ui_buttons_row("start.cgi", $text{'index_start'}, $text{'index_startmsg'}); 60 | } 61 | 62 | 63 | #Check for an update of tomcat, once a day 64 | my $latest_ver = upgrade_available(); 65 | if($latest_ver){ 66 | print &ui_buttons_row("tomcat_upgrade.cgi?mode=select_version", $text{'index_upgrade'}, "Tomcat can be updated to $latest_ver."); 67 | }elsif($config{'always_show_upgrade_btn'}){ 68 | print &ui_buttons_row("tomcat_upgrade.cgi?mode=select_version", $text{'index_upgrade'}, "Upgrade Tomcat server"); 69 | } 70 | print &ui_buttons_end(); 71 | 72 | 73 | &ui_print_footer("/", $text{"index"}); 74 | -------------------------------------------------------------------------------- /install_check.sh: -------------------------------------------------------------------------------- 1 | # install_check.pl 2 | 3 | do 'tomcat-lib.pl'; 4 | 5 | # is_installed(mode) 6 | # For mode 1, returns 2 if the server is installed and configured for use by 7 | # Webmin, 1 if installed but not configured, or 0 otherwise. 8 | # For mode 0, returns 1 if installed, 0 if not 9 | sub is_installed 10 | { 11 | return 0 if (!-r $config{'tomcat_config'} || !&has_command($config{'tomcat_path'})); 12 | return $_[0] ? 2 : 1; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /install_java.cgi: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | require './tomcat-lib.pl'; 4 | require './java-lib.pl'; 5 | require '../webmin/webmin-lib.pl'; #require 6 | foreign_require('software', 'software-lib.pl'); 7 | 8 | use File::Basename; 9 | 10 | sub extract_java_archive{ 11 | my $jdk_archive = $_[0]; 12 | 13 | my $java_dir = '/usr/java'; 14 | if( ! -d $java_dir){ 15 | &make_dir($java_dir, 0755, 1); 16 | } 17 | 18 | $cmd_out=''; 19 | $cmd_err=''; 20 | print "


Extracting $jdk_archive to $java_dir...
"; 21 | local $out = &execute_command("tar -x -v --overwrite -f \"$jdk_archive\" -C/usr/java", undef, \$cmd_out, \$cmd_err, 0, 0); 22 | 23 | my $jdk_tar_first_line = ( split /\n/, $cmd_out )[0]; 24 | my $jdk_dir = $java_dir."/".(split /\//, $jdk_tar_first_line)[0]; 25 | 26 | if($cmd_err){ 27 | $cmd_err = s/\n/
/g; 28 | &error("Error: tar: $cmd_err"); 29 | }else{ 30 | $cmd_out = s/\n/
/g; 31 | print &html_escape($cmd_out); 32 | } 33 | 34 | &set_ownership_permissions('root','root', 0755, $jdk_dir); 35 | &execute_command("chown -R root:root $jdk_dir", undef, \$cmd_out, \$cmd_err, 0, 0); 36 | if($cmd_err){ 37 | $cmd_err = s/\n/
/g; 38 | &error("Error: chown: $cmd_err"); 39 | } 40 | 41 | return $jdk_dir; 42 | } 43 | 44 | #$| = 1; 45 | 46 | if ($ENV{REQUEST_METHOD} eq "POST") { 47 | &ReadParse(\%getin, "GET"); 48 | &ReadParseMime(undef, \&read_parse_mime_callback, [ $getin{'id'} ]); 49 | } 50 | else { 51 | &ReadParse(); 52 | $no_upload = 1; 53 | } 54 | &error_setup($text{'install_err'}); 55 | &ui_print_header(undef, $text{'java_title'}, ""); 56 | 57 | my $jdk_path = ''; 58 | if($in{'source'} == 200){ 59 | 60 | my $jdk_name = (split /=/, $in{'openjdk_ver'})[1]; 61 | my $openjdk_pkg = $jdk_name; 62 | if($in{'openjdk_headless'} == 1){ 63 | $openjdk_pkg .= '-headless'; 64 | } 65 | 66 | software::update_system_install($openjdk_pkg, undef); 67 | $jdk_path = get_jdk_dir_by_name($jdk_name); 68 | 69 | } else { 70 | if ($in{'source'} == 100) { 71 | 72 | my ($jdk_name, $url) = split /=/, $in{'jdk_ver'}; 73 | $in{'url'} = $url; 74 | $in{'source'} = 2; 75 | } 76 | my $jdk_archive = process_file_source(); 77 | $jdk_path = extract_java_archive($jdk_archive); 78 | } 79 | 80 | if($in{'def_jdk'} == 1){ 81 | set_default_java($jdk_path); 82 | } 83 | 84 | print "
Done
"; 85 | &ui_print_footer("", $text{'index_return'}); 86 | -------------------------------------------------------------------------------- /install_libs.cgi: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | require './tomcat-lib.pl'; 4 | 5 | use File::Basename; 6 | use File::Path 'rmtree'; 7 | 8 | sub inst_error{ 9 | print "$main::whatfailed : $_[0]

\n"; 10 | &ui_print_footer("", $text{'index_return'}); 11 | exit; 12 | } 13 | 14 | if($ENV{'CONTENT_TYPE'} =~ /boundary=(.*)$/) { 15 | &ReadParseMime(); 16 | }else { 17 | &ReadParse(); 18 | $no_upload = 1; 19 | } 20 | 21 | $| = 1; 22 | &ui_print_header(undef, $text{'libs_install_title'}, ""); 23 | 24 | my $lib_file = process_file_source(); 25 | my @suffixlist = ('\.zip', '\.jar'); 26 | ($lib_name,$path,$lib_suffix) = fileparse($lib_file,@suffixlist); 27 | 28 | my $unzip_dir = ''; 29 | my @lib_jars; 30 | 31 | #Check if its a .zip or .jar 32 | print "Source: $lib_file
"; 33 | if($lib_suffix eq ".zip"){ 34 | $unzip_dir = unzip_file($lib_file); 35 | 36 | #make a list of extension jars 37 | opendir(DIR, $unzip_dir) or die $!; 38 | @lib_jars = grep { $_ = $unzip_dir.'/'.$_ ; -f && /\.jar$/ } readdir(DIR); 39 | closedir(DIR); 40 | 41 | }elsif($lib_suffix eq ".jar"){ 42 | push(@lib_jars, $lib_file); 43 | }else{ 44 | &error("Error: Unsupported file type $lib_suffix"); 45 | &ui_print_footer("", $text{'index_return'}); 46 | } 47 | 48 | print "


Installing $lib_name files...
"; 49 | my $catalina_home = get_catalina_home(); 50 | 51 | #move jars to Tomcat lib and save list of installed jars to lib file 52 | open(my $fh, '>', "$module_config_directory/lib_$lib_name.list") or die "open:$!"; 53 | foreach $j (@lib_jars) { 54 | #move jars to Tomcat lib 55 | if(!move("$j", "$catalina_home/lib/")){ 56 | &error("Error: Can't move file: $!"); 57 | } 58 | my $j_name = basename($j); 59 | &set_ownership_permissions('tomcat','tomcat', 0444, "$catalina_home/lib/$j_name"); 60 | 61 | print "$catalina_home/lib/$j_name
"; 62 | print $fh "$j_name=$catalina_home/lib/$j_name\n"; 63 | } 64 | close $fh; 65 | 66 | print "
Done.
"; 67 | 68 | if($unzip_dir ne ''){ 69 | &rmtree($unzip_dir); #remove temp dir 70 | } 71 | 72 | &ui_print_footer("", $text{'index_return'}); 73 | -------------------------------------------------------------------------------- /install_war.cgi: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | require './tomcat-lib.pl'; 4 | use File::Basename; 5 | use File::Path 'rmtree'; 6 | 7 | sub inst_error{ 8 | print "$main::whatfailed : $_[0]

\n"; 9 | &ui_print_footer("", $text{'index_return'}); 10 | exit; 11 | } 12 | 13 | if($ENV{'CONTENT_TYPE'} =~ /boundary=(.*)$/) { &ReadParseMime(); } 14 | else { &ReadParse(); $no_upload = 1; } 15 | 16 | $| = 1; 17 | $theme_no_table = 1 if ($in{'source'} == 2 || $in{'source'} == 4); 18 | &ui_print_header(undef, $text{'install_title'}, ""); 19 | 20 | my $file = process_file_source(); 21 | 22 | my @suffixlist = ('\.zip', '\.war'); 23 | ($file_name,$path,$file_suffix) = fileparse($file,@suffixlist); 24 | 25 | my $unzip_dir = ''; 26 | my @wars; 27 | 28 | #Check if its a .zip or .jar 29 | print "Source: $file
"; 30 | if($file_suffix eq ".zip"){ 31 | $unzip_dir = unzip_file($file); 32 | 33 | #make a list of extension jars 34 | opendir(DIR, $unzip_dir) or die $!; 35 | @wars = grep { $_ = $unzip_dir.'/'.$_ ; -f && /\.war$/ } readdir(DIR); 36 | closedir(DIR); 37 | 38 | }elsif($file_suffix eq ".war"){ 39 | push(@wars, $file); 40 | }else{ 41 | &error("Error: Unsupported file type $file_suffix"); 42 | &ui_print_footer("", $text{'index_return'}); 43 | } 44 | 45 | $catalina_home = get_catalina_home(); 46 | 47 | foreach $war (@wars) { 48 | my $war_name = basename($war); 49 | if(!move($war, "$catalina_home/webapps/")){ 50 | &error("Error: Can't move file: $!"); 51 | }else{ 52 | print "Install of $war_name is successful
"; 53 | } 54 | &set_ownership_permissions('tomcat','tomcat', 0444, "$catalina_home/webapps/$war_name"); 55 | } 56 | 57 | if($unzip_dir ne ''){ 58 | &rmtree($unzip_dir); #remove temp dir 59 | } 60 | 61 | #tomcat_service_ctl('restart'); 62 | 63 | &ui_print_footer("", $text{'index_return'}); 64 | -------------------------------------------------------------------------------- /java-lib.pl: -------------------------------------------------------------------------------- 1 | =head1 java-lib.pl 2 | 3 | Functions for managing Oracle JDK installations. 4 | 5 | foreign_require("tomcat", "tomcat-lib.pl"); 6 | @sites = tomcat::list_tomcat_websites() 7 | 8 | =cut 9 | 10 | BEGIN { push(@INC, ".."); }; 11 | use warnings; 12 | use WebminCore; 13 | 14 | foreign_require('software', 'software-lib.pl'); 15 | 16 | sub search_pkg{ 17 | my $pattern = $_[0]; 18 | 19 | my @avail = (); 20 | if (defined(&software::update_system_search)) { 21 | # Call the search function 22 | @avail = &software::update_system_search($pattern); 23 | } else { 24 | # Scan through list manually 25 | @avail = &software::update_system_available(); 26 | @avail = grep { $_->{'name'} =~ /\Q$pattern\E/i } @avail; 27 | } 28 | return sort @avail; 29 | } 30 | 31 | sub get_openjdk_patterns(){ 32 | my %osinfo = &detect_operating_system(); 33 | 34 | my %rv; 35 | if( ($osinfo{'real_os_type'} =~ /centos/i) or #CentOS 36 | ($osinfo{'real_os_type'} =~ /fedora/i) or #Fedora 37 | ($osinfo{'real_os_type'} =~ /rocky/i) or # Rocky 38 | ($osinfo{'real_os_type'} =~ /alma/i) or # Alma 39 | ($osinfo{'real_os_type'} =~ /scientific/i) ){ 40 | 41 | $rv{'search'} = 'openjdk'; 42 | $rv{'version'} = '^java-([0-9\.]+)-openjdk$'; 43 | 44 | }elsif( $osinfo{'os_type'} =~ /debian/i){ #ubuntu 45 | $rv{'search'} = 'openjdk-[0-9]+-jdk$'; 46 | $rv{'version'} = 'openjdk-([0-9]+)-jdk'; 47 | } 48 | return %rv; 49 | } 50 | 51 | sub get_openjdk_versions(){ 52 | my $cache_file = "$module_config_directory/openjdk_version_cache"; 53 | my %openjdk_versions; 54 | 55 | if(-f $cache_file){ 56 | read_file_cached($cache_file, \%openjdk_versions); 57 | 58 | if($openjdk_versions{'updated'} >= (time() - 86400)){ #if last update was less than a day ago 59 | delete $openjdk_versions{'updated'}; #remove the cache mtime key 60 | return %openjdk_versions; 61 | } 62 | } 63 | 64 | my %patterns = get_openjdk_patterns(); 65 | my @avail = search_pkg($patterns{'search'}); 66 | foreach $a (@avail) { 67 | if($a->{'name'} =~ /$patterns{'version'}/){ 68 | $openjdk_versions{$1} = $a->{'name'}; 69 | } 70 | } 71 | 72 | #cache the results 73 | $openjdk_versions{'updated'} = time(); 74 | &write_file($cache_file, \%openjdk_versions); 75 | delete $openjdk_versions{'updated'}; #remove the cache mtime key 76 | 77 | return %openjdk_versions; 78 | } 79 | 80 | sub get_latest_jdk_version(){ 81 | 82 | my %java_tar_gz; 83 | my $cache_file = "$module_config_directory/oracle_version_cache"; 84 | if(-f $cache_file){ 85 | read_file_cached($cache_file, \%java_tar_gz); 86 | if($java_tar_gz{'updated'} >= (time() - 86400)){ #if last update was less than a day ago 87 | delete $java_tar_gz{'updated'}; #remove the cache mtime key 88 | return %java_tar_gz; 89 | } 90 | } 91 | 92 | my $error; 93 | my $url = 'https://www.oracle.com/java/technologies/downloads/'; 94 | $tmpfile = &transname("javase.html"); 95 | &error_setup(&text('install_err3', $url)); 96 | &http_download("www.oracle.com", 443, "/java/technologies/downloads/", $tmpfile, \$error, 97 | undef, 1, undef, 0, 0, 1); 98 | 99 | open($fh, '<', $tmpfile) or die "open:$!"; 100 | while(my $line = <$fh>){ 101 | #https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.tar.gz 102 | if($line =~ /(https:\/\/download.oracle.com\/java\/([0-9]+)\/latest\/jdk-[0-9]+_linux-x64_bin.tar.gz)/){ 103 | #if($line =~ /"filepath":"(https:\/\/download.oracle.com\/otn-pub\/java\/jdk\/([a-z0-9-\.+]+)\/[a-z0-9]+\/jdk-[a-z0-9-\.]+_linux-x64_bin.tar.gz)/){ 104 | $java_tar_gz{$2} = $1; 105 | #last; 106 | } 107 | } 108 | close $fh; 109 | 110 | #cache the results 111 | $java_tar_gz{'updated'} = time(); 112 | &write_file($cache_file, \%java_tar_gz); 113 | delete $java_tar_gz{'updated'}; #remove the cache mtime key 114 | 115 | return %java_tar_gz; 116 | } 117 | 118 | sub get_installed_jdk_versions(){ 119 | my @jdks = get_installed_oracle_jdk_versions(); 120 | 121 | push(@jdks, get_installed_openjdk_versions()); 122 | return @jdks; 123 | } 124 | 125 | sub get_installed_openjdk_versions{ 126 | 127 | my @pkgs = (); 128 | my %patterns = get_openjdk_patterns(); 129 | 130 | my $cmd_out=''; 131 | my $cmd_err=''; 132 | if(has_command('rpm')){ 133 | local $out = &execute_command("rpm -qa --queryformat \"%{NAME}\n\" \"*$patterns['search']*\"", undef, \$cmd_out, \$cmd_err, 0, 0); 134 | 135 | my @lines = split /\n/, $cmd_out; 136 | foreach my $line (@lines){ 137 | if($line =~ /^(java-[0-9\.]+-openjdk).*/i){ #package pgdg96-centos is not installed 138 | push(@pkgs, $1); 139 | } 140 | } 141 | }elsif(has_command('dpkg')){ 142 | local $out = &execute_command("dpkg -l \"*openjdk*\"", undef, \$cmd_out, \$cmd_err, 0, 0); 143 | 144 | my %all_pkgs; 145 | my @lines = split /\n/, $cmd_out; 146 | foreach my $line (@lines){ 147 | if($line =~ /^(..)\s+(openjdk-[0-9\.]*)-.*:.*/i){ 148 | my $pkg = $2; 149 | if($1 =~ /[uirph]i/){ 150 | $all_pkgs{$pkg} = 1; 151 | } 152 | } 153 | } 154 | @pkgs = keys %all_pkgs; 155 | }else{ 156 | my @dirs; 157 | opendir(DIR, '/usr/java/') or return @dirs; 158 | @dirs 159 | = grep { 160 | /^jdk-[0-9\.]+/ 161 | && -d "/usr/java/$_" 162 | } readdir(DIR); 163 | closedir(DIR); 164 | } 165 | 166 | return sort @pkgs; 167 | } 168 | 169 | sub get_installed_oracle_jdk_versions{ 170 | my @dirs; 171 | opendir(DIR, '/usr/java/') or return @dirs; 172 | @dirs 173 | = grep { 174 | /^jdk[0-9\.\-_]+/ 175 | && -d "/usr/java/$_" 176 | } readdir(DIR); 177 | closedir(DIR); 178 | 179 | return sort @dirs; 180 | } 181 | 182 | sub is_default_jdk{ 183 | my $jdk_dir = $_[0]; 184 | 185 | my %os_env; 186 | if(-f '/etc/profile.d/jdk.sh'){ 187 | read_env_file('/etc/profile.d/jdk.sh', \%os_env); 188 | }elsif(-f '/etc/environment'){ 189 | read_env_file('/etc/environment', \%os_env); 190 | } 191 | 192 | if($os_env{'JAVA_HOME'} eq $jdk_dir){ 193 | return 1; 194 | }else{ 195 | return 0; 196 | } 197 | } 198 | 199 | sub get_java_version(){ 200 | local %version; 201 | local $out = &backquote_command('java \-version 2>&1'); 202 | 203 | #Oracle Java <= 8 204 | if ($out =~ /Java\(TM\)\sSE\sRuntime\sEnvironment\s\(build\s([0-9]\.([0-9]+)\.[0-9]_([0-9]+)\-([a-z0-9]+))\)/) { 205 | $version{'full'} = $1; 206 | $version{'major'} = $2; 207 | $version{'release'} = $3; 208 | $version{'build'} = $4; 209 | $version{'vendor'} = 'oracle'; 210 | 211 | #Oracle Java >=12 - Java(TM) SE Runtime Environment (build 12.0.1+12) 212 | }elsif ($out =~ /Java\(TM\)\sSE\sRuntime\sEnvironment\s\(build\s((\d+)\.\d+\.\d+\+(\d+))\)/) { 213 | $version{'full'} = $1; 214 | $version{'major'} = $2; 215 | $version{'release'} = 0; 216 | $version{'build'} = $3; 217 | $version{'vendor'} = 'oracle'; 218 | 219 | # OpenJDK Runtime Environment (build 11.0.7+10-post-Ubuntu-2ubuntu218.04) 220 | # OpenJDK Runtime Environment (build 11.0.9+11-Ubuntu-0ubuntu1.20.04) 221 | # OpenJDK Runtime Environment (build 1.8.0_252-8u252-b09-1~18.04-b09) 222 | }elsif ($out =~ /Runtime\sEnvironment\s\(build\s((\d+)\.(\d+)\.\d+[\+_](\d+))/) { 223 | if($2 eq '1'){ #1.8.x 224 | $version{'major'} = $3; 225 | $version{'release'} = $4; 226 | $version{'build'} = $5; 227 | }else{ #11.0.x 228 | $version{'major'} = $2; 229 | $version{'release'} = $3; 230 | $version{'build'} = $4; 231 | } 232 | $version{'full'} = $1; 233 | 234 | $version{'vendor'} = 'openjdk'; 235 | }else { 236 | $version{'major'} = 0; 237 | $version{'full'} = $out; 238 | $version{'release'} = 0; 239 | $version{'build'} = 0; 240 | } 241 | return %version; 242 | } 243 | 244 | sub get_java_home(){ 245 | my $java_path = &resolve_links('/usr/bin/java'); 246 | $java_path =~ s/\/bin\/java//; 247 | return $java_path; 248 | } 249 | 250 | sub set_default_java{ 251 | my $jdk_dir = $_[0]; 252 | 253 | my $alt_cmd = ""; 254 | if(has_command('alternatives')){ #CentOS 255 | $alt_cmd = 'alternatives'; 256 | }elsif(has_command('update-alternatives')){ #ubuntu 257 | $alt_cmd = 'update-alternatives'; 258 | }else{ 259 | print "Warning: No alternatives command found
"; 260 | } 261 | 262 | if($alt_cmd ne ""){ 263 | print "Updating Java using $alt_cmd
"; 264 | my @jdk_progs = ('java', 'jar', 'javac'); 265 | foreach my $prog (@jdk_progs){ 266 | 267 | $cmd_out=''; 268 | $cmd_err=''; 269 | local $out = &execute_command("$alt_cmd --install /usr/bin/$prog $prog $jdk_dir/bin/$prog 1", undef, \$cmd_out, \$cmd_err, 0, 0); 270 | $out.= &execute_command("$alt_cmd --set $prog $jdk_dir/bin/$prog", undef, \$cmd_out, \$cmd_err, 0, 0); 271 | 272 | if($cmd_err){ 273 | $cmd_err = s/\n/
/g; 274 | &error("Error: $alt_cmd: $cmd_err"); 275 | }elsif($cmd_out){ 276 | $cmd_out = s/\n/
/g; 277 | print &html_escape($cmd_out); 278 | } 279 | } 280 | } 281 | 282 | print "


Setting Java environment variables...
"; 283 | my %os_env; 284 | $os_env{'J2SDKDIR'} = $jdk_dir; 285 | $os_env{'JAVA_HOME'} = $jdk_dir; 286 | $os_env{'DERBY_HOME'}= "$jdk_dir/db"; 287 | $os_env{'J2REDIR'} = "$jdk_dir/jre"; 288 | 289 | if(-e '/etc/profile.d/'){ 290 | $os_env{'PATH'} = "\$PATH:$jdk_dir/bin:$jdk_dir/db/bin:$jdk_dir/jre/bin"; 291 | write_env_file('/etc/profile.d/jdk.sh', \%os_env, 1); 292 | }elsif(-e '/etc/environment'){ 293 | read_env_file('/etc/environment', \%os_env); 294 | $os_env{'PATH'} = "$os_env{'PATH'}:$jdk_dir/bin:$jdk_dir/db/bin:$jdk_dir/jre/bin"; 295 | write_env_file('/etc/environment', \%os_env, 0); 296 | } 297 | } 298 | 299 | sub unset_default_java{ 300 | my $jdk_dir = $_[0]; 301 | print "Removing Java environment variables ...
"; 302 | if(-f '/etc/profile.d/jdk.sh'){ 303 | unlink_file('/etc/profile.d/jdk.sh'); 304 | }elsif(-f '/etc/environment'){ 305 | my %os_env; 306 | read_env_file('/etc/environment', \%os_env); 307 | delete $os_env{'J2SDKDIR'}; 308 | delete $os_env{'JAVA_HOME'}; 309 | delete $os_env{'DERBY_HOME'}; 310 | delete $os_env{'J2REDIR'}; 311 | write_env_file('/etc/environment', \%os_env, 0); 312 | } 313 | 314 | my $alt_cmd = ""; 315 | if(has_command('alternatives')){ #CentOS 316 | $alt_cmd = 'alternatives'; 317 | }elsif(has_command('update-alternatives')){ #ubuntu 318 | $alt_cmd = 'update-alternatives'; 319 | }else{ 320 | print "Warning: No alternatives command found
"; 321 | } 322 | 323 | if($alt_cmd ne ""){ 324 | print "Removing Java using $alt_cmd
"; 325 | my @jdk_progs = ('java', 'jar', 'javac'); 326 | foreach my $prog (@jdk_progs){ 327 | 328 | $cmd_out=''; 329 | $cmd_err=''; 330 | local $out = &execute_command("$alt_cmd --remove $prog $jdk_dir/bin/$prog", undef, \$cmd_out, \$cmd_err, 0, 0); 331 | if($cmd_err){ 332 | &error("Error: $alt_cmd: $cmd_err"); 333 | }else{ 334 | $cmd_out = s/\r\n/
/g; 335 | print &html_escape($cmd_out); 336 | } 337 | } 338 | } 339 | } 340 | 341 | sub get_jdk_dir_by_name{ 342 | my $jdk_name = $_[0]; 343 | my $jdk_dir = ''; 344 | 345 | if($jdk_name =~ /.*openjdk.*/){ 346 | 347 | my $jdk_ver = (split /-/, $jdk_name)[1]; #get version from name 348 | my @known_dirs = ('java-'.$jdk_ver.'-openjdk', 'java-'.$jdk_ver.'-openjdk-amd64', 'jre-'.$jdk_ver.'-openjdk'); 349 | 350 | foreach $jvm_name (@known_dirs){ 351 | if(-d '/usr/lib/jvm/'.$jvm_name){ 352 | $jdk_dir = '/usr/lib/jvm/'.$jvm_name; 353 | last; 354 | } 355 | } 356 | 357 | }else{ 358 | $jdk_dir = '/usr/java/'.$jdk_name; 359 | } 360 | return $jdk_dir; 361 | } 362 | 363 | 1; 364 | -------------------------------------------------------------------------------- /lang/en: -------------------------------------------------------------------------------- 1 | index_title=Tomcat Server 2 | index_title_upgrade=Tomcat Server Upgrade 3 | index_root=The root directory is $1. 4 | 5 | index_start=Start Server 6 | index_startmsg=Click this button to start the Tomcat server 7 | index_stop=Stop Server 8 | index_stopmsg=Click this button to stop the running Tomcat server 9 | index_restart=Restart Server 10 | index_restartmsg=Click this button to restart the running Tomcat server 11 | index_return=Tomcat 12 | index_install=Install Tomcat 13 | index_upgrade=Upgrade Tomcat 14 | 15 | users_title=Users 16 | 17 | wars_title=WARs 18 | manual_title=Edit config 19 | manual_ecannot=You are not allowed to edit the Tomcat server.xml config file 20 | manual_ok=Edit 21 | manual_efile=Selected file is not part of the Tomcat server configuration 22 | manual_file=Edit config file: 23 | manual_edata=Nothing entered! 24 | manual_err=Failed to save config file 25 | 26 | war_install=Install Application 27 | war_installsource=Install source (.war or .zip) 28 | war_installok=Deploy 29 | wars_tabinstall=Deploy 30 | wars_tabdelete=Undeploy 31 | wars_tablist=List 32 | wars_desc1=Tomcat applications can be installed using .war files from local or remote locations. 33 | wars_desc2=After deleting an application, Tomcat server will be restarted. If you keep, the war file, application will be redeployed! 34 | wars_delete=Delete Application 35 | wars_deleteok=Undeploy 36 | wars_rmwar=Remove war file too 37 | wars_installed=Installed Apps 38 | 39 | install_title=Install WAR 40 | install_err1=Invalid URL 41 | install_err2=Failed to install uploaded module 42 | install_err3=Failed to install module from $1 43 | install_efile=File does not exist 44 | install_ebrowser=Your browser does not support file uploads 45 | 46 | delete_title=Uninstall WAR 47 | delete_err=Failed to delete modules 48 | delete_enone=No modules selected 49 | 50 | start_err=Failed to start Tomcat 51 | stop_err=Failed to stop Tomcat 52 | restart_err=Failed to restart Tomcat 53 | 54 | java_title=Java 55 | java_tabinstall=Install 56 | java_tabuninstall=Uninstall 57 | java_tabdefault=Default 58 | java_desc1=Install Java Development Kit(JDK) from distribution repository or from Oracle .tar.gz archive 59 | java_desc2=Uninstall Oracle Java 8 files from /usr/share 60 | java_desc3=Set default Java, using update-alternatives and /etc/profile.d/jdk.sh 61 | java_install=Install Options 62 | java_uninstall=Uninstall Options 63 | java_default=update-alternatives Options 64 | jdk_installsource=JDK source 65 | jdk_latest=Oracle JDK 66 | java_installok=Install 67 | java_deleteok=Uninstall 68 | java_defaultok=Update 69 | java_def_jdk=Set as system default Java 70 | java_def_jdk_desc= ( using alternatives ) 71 | java_rm_def_jdk=Remove, if default Java 72 | java_installed=JDK versions 73 | openjdk_latest=OpenJDK 74 | openjdk_headless=Headless package 75 | openjdk_headless_desc=only for OpenJDK 76 | 77 | libs_title=Libraries 78 | libs_desc1=Install libraries into Tomcat's lib/ directory 79 | libs_desc2=Uninstall librarues from Tomcat's lib/ directory 80 | libs_install=Libraries to be installed 81 | libs_delete=Libraries to be uninstalled 82 | libs_installsource=Library source(.zip or .jar) 83 | libs_tabinstall=Install 84 | libs_tabuninstall=Uninstall 85 | libs_installok=Install 86 | libs_deleteok=Uninstall 87 | libs_installed=Libraries found 88 | libs_install_title=Installing Tomcat library 89 | libs_uninstall_title=Uninstalling Tomcat libraries 90 | 91 | source_local=Local file 92 | source_uploaded=Uploaded file 93 | source_ftp=FTP or HTTP URL 94 | source_archive=Apache Archive 95 | 96 | source_err0=File Error 97 | source_err1=Upload Error 98 | source_err1.2=No upload file 99 | source_err2=Download error 100 | source_err3=Invalid URL 101 | 102 | setup_title=Setup 103 | 104 | base_options=Options 105 | base_major=Tomcat Major Version 106 | base_archive=Release 107 | base_installok=Download 108 | base_upgradeok=Upgrade 109 | base_installsource=Install source 110 | base_desc1=Download an archive of Apache Tomcat Server from Apache website and install it 111 | base_desc2=Select major and minor versions for upgrade/downgrade. All WARs will be moved and config will be copied to new install! 112 | 113 | proxy_title=Proxy 114 | proxy_add_options=Add proxy 115 | proxy_remove_options=Remove proxy 116 | proxy_default_app=Make this the default (/) 117 | proxy_app_default_warning=Will remove previous default path! 118 | proxy_ssl=Use SSL port 119 | proxy_ssl_info=Use Tomcat HTTPs port 120 | proxy_list=Available proxies 121 | proxy_installok=Add 122 | proxy_removeok=Remove 123 | proxy_wildcard=Add Wildcard map 124 | proxy_wildcard_info=Proxy Apache:80 to Tomcat:8080 125 | -------------------------------------------------------------------------------- /module.info: -------------------------------------------------------------------------------- 1 | desc=Apache Tomcat 2 | os_support=*-linux freebsd archlinux 3 | category=servers 4 | -------------------------------------------------------------------------------- /restart.cgi: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # restart.cgi 3 | # Restart the tomcat daemon 4 | 5 | require './tomcat-lib.pl'; 6 | &ReadParse(); 7 | &error_setup($text{'restart_err'}); 8 | my ($rc, $err) = tomcat_service_ctl('restart'); 9 | if ($rc != 0){ 10 | &ui_print_header(undef, $text{'index_title'}, ""); 11 | &error($err); 12 | &ui_print_footer("", $text{'index_return'}); 13 | exit; 14 | } 15 | &redirect(""); 16 | -------------------------------------------------------------------------------- /save_manual.cgi: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # Update a manually edited config file 3 | 4 | require './tomcat-lib.pl'; 5 | &error_setup($text{'manual_err'}); 6 | &ReadParseMime(); 7 | 8 | my $catalina_home = get_catalina_home(); 9 | 10 | # Work out the file 11 | @files = ( "$catalina_home/bin/setenv.sh", 12 | "$catalina_home/conf/context.xml", 13 | "$catalina_home/conf/server.xml", 14 | "$catalina_home/conf/tomcat-users.xml", 15 | "$catalina_home/conf/web.xml"); 16 | &indexof($in{'file'}, @files) >= 0 || &error($text{'manual_efile'}); 17 | $in{'data'} =~ s/\r//g; 18 | $in{'data'} =~ /\S/ || &error($text{'manual_edata'}); 19 | 20 | # Write to it 21 | &open_lock_tempfile(DATA, ">$in{'file'}"); 22 | &print_tempfile(DATA, $in{'data'}); 23 | &close_tempfile(DATA); 24 | 25 | &webmin_log("manual", undef, $in{'file'}); 26 | &redirect(""); 27 | 28 | -------------------------------------------------------------------------------- /scripts/alma-rocky.sh: -------------------------------------------------------------------------------- 1 | # !/bin/bash -e 2 | # Tomcat Module Script for Rocky Linux 3 | # Usage: 4 | # wget https://raw.githubusercontent.com/cited/Tomcat-Webmin-Module/master/scripts/rocky-linux.sh 5 | # chmod +x pre-installer 6 | # ./pre-installer.sh 7 | 8 | function get_deps(){ 9 | 10 | yum -y install wget unzip bzip2 11 | 12 | } 13 | 14 | function setup_selinux(){ 15 | 16 | #allow apache port for django app 17 | semanage port -a -t http_port_t -p tcp 7800 18 | semanage port -m -t http_port_t -p tcp 9000 19 | 20 | setsebool -P httpd_can_network_connect 1 21 | } 22 | 23 | 24 | function install_apache(){ 25 | 26 | yum -y install httpd 27 | 28 | } 29 | 30 | function install_webmin(){ 31 | wget -P/tmp 'https://download.webmin.com/developers-key.asc' 32 | rpm --import /tmp/developers-key.asc || true 33 | cp -f /tmp/developers-key.asc /etc/pki/rpm-gpg/RPM-GPG-KEY-webmin-developers 34 | 35 | cat >/etc/yum.repos.d/webmin.repo < Tomcat to complete installation" 85 | 86 | } 87 | 88 | get_deps; 89 | #install_apache; 90 | #install_webmin; 91 | #download_certbot_module; 92 | setup_selinux; 93 | #install_certbot_module; 94 | download_tomcat_module; 95 | install_tomcat_module; 96 | -------------------------------------------------------------------------------- /scripts/index.rst: -------------------------------------------------------------------------------- 1 | 1 2 | -------------------------------------------------------------------------------- /scripts/pre-install.sh: -------------------------------------------------------------------------------- 1 | # !/bin/bash -e 2 | # Tomcat Module Script for CentOS and Ubuntu 3 | # For use on clean CentOS or Ubuntu box only 4 | # Usage: 5 | # wget https://raw.githubusercontent.com/cited/Tomcat-Webmin-Module/master/scripts/pre-install.sh 6 | # chmod +x pre-installer 7 | # ./pre-installer.sh 8 | 9 | function get_repo(){ 10 | if [ -f /etc/centos-release ]; then 11 | REPO='rpm' 12 | 13 | elif [ -f /etc/debian_version ]; then 14 | REPO='apt' 15 | fi 16 | } 17 | 18 | function install_webmin(){ 19 | 20 | if [ "${REPO}" == 'apt' ]; then 21 | 22 | echo "deb http://download.webmin.com/download/repository sarge contrib" > /etc/apt/sources.list.d/webmin.list 23 | wget -qO - http://www.webmin.com/jcameron-key.asc | apt-key add - 24 | apt-get -y update 25 | apt-get -y install webmin 26 | 27 | elif [ "${REPO}" == 'rpm' ]; then 28 | 29 | 30 | 31 | 32 | 33 | wget -P/tmp 'https://download.webmin.com/developers-key.asc' 34 | rpm --import /tmp/developers-key.asc || true 35 | cp -f /tmp/developers-key.asc /etc/pki/rpm-gpg/RPM-GPG-KEY-webmin-developers 36 | 37 | cat >/etc/yum.repos.d/webmin.repo < Tomcat to complete installation" 73 | 74 | } 75 | 76 | 77 | 78 | function download_certbot_module(){ 79 | pushd /tmp/ 80 | wget https://github.com/cited/Certbot-Webmin-Module/archive/master.zip 81 | unzip master.zip 82 | mv Certbot-Webmin-Module-master certbot 83 | tar -czf /opt/certbot.wbm.gz certbot 84 | rm -rf certbot master.zip 85 | popd 86 | } 87 | 88 | function install_apache(){ 89 | if [ "${REPO}" == 'apt' ]; then 90 | apt-get -y install apache2 91 | elif [ "${REPO}" == 'rpm' ]; then 92 | yum -y install httpd 93 | fi 94 | } 95 | 96 | function install_certbot_module(){ 97 | pushd /opt/ 98 | if [ "${REPO}" == 'apt' ]; then 99 | /usr/share/webmin/install-module.pl certbot.wbm.gz 100 | elif [ "${REPO}" == 'rpm' ]; then 101 | /usr/libexec/webmin/install-module.pl certbot.wbm.gz 102 | fi 103 | popd 104 | echo -e "Certbot is now installed. Go to Servers > Certbot to complete installation" 105 | 106 | } 107 | 108 | function get_deps(){ 109 | if [ "${REPO}" == 'apt' ]; then 110 | apt-get -y install wget unzip 111 | elif [ "${REPO}" == 'rpm' ]; then 112 | yum -y install wget unzip bzip2 113 | fi 114 | } 115 | 116 | get_repo; 117 | get_deps; 118 | # Uncomment line(s) below if you wish to install Webmin, Apache HTTP Server, and Certbot as well. 119 | #install_webmin; 120 | #install_apache; 121 | #download_certbot_module; 122 | #install_certbot_module; 123 | download_tomcat_module; 124 | install_tomcat_module; 125 | -------------------------------------------------------------------------------- /scripts/rocky-linux.sh: -------------------------------------------------------------------------------- 1 | # !/bin/bash -e 2 | # Tomcat Module Script for Rocky Linux 3 | # Usage: 4 | # wget https://raw.githubusercontent.com/cited/Tomcat-Webmin-Module/master/scripts/rocky-linux.sh 5 | # chmod +x pre-installer 6 | # ./pre-installer.sh 7 | 8 | function get_deps(){ 9 | 10 | yum -y install wget unzip bzip2 11 | 12 | } 13 | 14 | function setup_selinux(){ 15 | 16 | #allow apache port for django app 17 | semanage port -a -t http_port_t -p tcp 7800 18 | semanage port -m -t http_port_t -p tcp 9000 19 | 20 | setsebool -P httpd_can_network_connect 1 21 | } 22 | 23 | 24 | function install_apache(){ 25 | 26 | yum -y install httpd 27 | 28 | } 29 | 30 | function install_webmin(){ 31 | wget -P/tmp 'https://download.webmin.com/developers-key.asc' 32 | rpm --import /tmp/developers-key.asc || true 33 | cp -f /tmp/developers-key.asc /etc/pki/rpm-gpg/RPM-GPG-KEY-webmin-developers 34 | 35 | cat >/etc/yum.repos.d/webmin.repo < Tomcat to complete installation" 85 | 86 | } 87 | 88 | get_deps; 89 | #install_apache; 90 | #install_webmin; 91 | #download_certbot_module; 92 | setup_selinux; 93 | #install_certbot_module; 94 | download_tomcat_module; 95 | install_tomcat_module; 96 | -------------------------------------------------------------------------------- /scripts/tomcat.wbm.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cited/Tomcat-Webmin-Module/bb2fcedb75ad55abe9b5a8fde3de8836b3886a32/scripts/tomcat.wbm.gz -------------------------------------------------------------------------------- /scripts/ubuntu.sh: -------------------------------------------------------------------------------- 1 | # !/bin/bash -e 2 | # Tomcat Module Script for CentOS and Ubuntu 3 | # For use on clean CentOS or Ubuntu box only 4 | # Usage: 5 | # wget https://raw.githubusercontent.com/cited/Tomcat-Webmin-Module/master/scripts/pre-install.sh 6 | # chmod +x pre-installer 7 | # ./pre-installer.sh 8 | 9 | function get_repo(){ 10 | if [ -f /etc/centos-release ]; then 11 | REPO='rpm' 12 | 13 | elif [ -f /etc/debian_version ]; then 14 | REPO='apt' 15 | fi 16 | } 17 | 18 | function install_webmin(){ 19 | 20 | if [ "${REPO}" == 'apt' ]; then 21 | 22 | echo "deb http://download.webmin.com/download/repository sarge contrib" > /etc/apt/sources.list.d/webmin.list 23 | wget -qO - http://www.webmin.com/jcameron-key.asc | apt-key add - 24 | apt-get -y update 25 | apt-get -y install webmin 26 | 27 | elif [ "${REPO}" == 'rpm' ]; then 28 | 29 | 30 | 31 | 32 | 33 | wget -P/tmp 'https://download.webmin.com/developers-key.asc' 34 | rpm --import /tmp/developers-key.asc || true 35 | cp -f /tmp/developers-key.asc /etc/pki/rpm-gpg/RPM-GPG-KEY-webmin-developers 36 | 37 | cat >/etc/yum.repos.d/webmin.repo < Tomcat to complete installation" 73 | 74 | } 75 | 76 | 77 | 78 | function download_certbot_module(){ 79 | pushd /tmp/ 80 | wget https://github.com/cited/Certbot-Webmin-Module/archive/master.zip 81 | unzip master.zip 82 | mv Certbot-Webmin-Module-master certbot 83 | tar -czf /opt/certbot.wbm.gz certbot 84 | rm -rf certbot master.zip 85 | popd 86 | } 87 | 88 | function install_apache(){ 89 | if [ "${REPO}" == 'apt' ]; then 90 | apt-get -y install apache2 91 | elif [ "${REPO}" == 'rpm' ]; then 92 | yum -y install httpd 93 | fi 94 | } 95 | 96 | function install_certbot_module(){ 97 | pushd /opt/ 98 | if [ "${REPO}" == 'apt' ]; then 99 | /usr/share/webmin/install-module.pl certbot.wbm.gz 100 | elif [ "${REPO}" == 'rpm' ]; then 101 | /usr/libexec/webmin/install-module.pl certbot.wbm.gz 102 | fi 103 | popd 104 | echo -e "Certbot is now installed. Go to Servers > Certbot to complete installation" 105 | 106 | } 107 | 108 | function get_deps(){ 109 | if [ "${REPO}" == 'apt' ]; then 110 | apt-get -y install wget unzip 111 | elif [ "${REPO}" == 'rpm' ]; then 112 | yum -y install wget unzip bzip2 113 | fi 114 | } 115 | 116 | get_repo; 117 | get_deps; 118 | # Uncomment line(s) below if you wish to install Webmin, Apache HTTP Server, and Certbot as well. 119 | #install_webmin; 120 | #install_apache; 121 | #download_certbot_module; 122 | #install_certbot_module; 123 | download_tomcat_module; 124 | install_tomcat_module; 125 | -------------------------------------------------------------------------------- /setup.cgi: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | require './tomcat-lib.pl'; 4 | require '../webmin/webmin-lib.pl'; #for OS detection 5 | foreign_require('software', 'software-lib.pl'); 6 | 7 | sub add_tomcat_user{ 8 | #check if tomcat user exists 9 | if(read_file_contents('/etc/passwd') !~ /\ntomcat:/){ 10 | #add tomcat user 11 | local $out = &backquote_command('useradd -m tomcat', 0); 12 | }elsif(! -d '/home/tomcat'){ 13 | &make_dir("/home/tomcat", 0755, 1); 14 | &set_ownership_permissions('tomcat','tomcat', undef, '/home/tomcat'); 15 | } 16 | } 17 | 18 | sub setup_catalina_env{ 19 | my $tomcat_ver = $_[0]; 20 | 21 | my %os_env; 22 | 23 | print "
Setting CATALINA environment..."; 24 | 25 | read_env_file('/etc/environment', \%os_env); 26 | $os_env{'CATALINA_HOME'} = "/home/tomcat/apache-tomcat-$tomcat_ver/"; 27 | $os_env{'CATALINA_BASE'} = "/home/tomcat/apache-tomcat-$tomcat_ver/"; 28 | write_env_file('/etc/environment', \%os_env, 0); 29 | 30 | open(my $fh, '>>', "/home/tomcat/apache-tomcat-$tomcat_ver/bin/setenv.sh") or die "open:$!"; 31 | print $fh "CATALINA_PID=\"/home/tomcat/apache-tomcat-$tomcat_ver/temp/tomcat.pid\"\n"; 32 | close $fh; 33 | } 34 | 35 | sub setup_tomcat_users{ 36 | my $tomcat_ver = $_[0]; 37 | my @pw_chars = ("A".."Z", "a".."z", "0".."9", "_", "-"); 38 | my $manager_pass; 39 | my $admin_pass; 40 | 41 | $manager_pass .= $pw_chars[rand @pw_chars] for 1..32; 42 | $admin_pass .= $pw_chars[rand @pw_chars] for 1..32; 43 | 44 | #Save tomcat-users.xml 45 | open(my $fh, '>', "/home/tomcat/apache-tomcat-$tomcat_ver/conf/tomcat-users.xml") or die "open:$!"; 46 | print $fh < 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | EOF 56 | close $fh; 57 | print "
Setting Tomcat users..."; 58 | } 59 | 60 | sub install_tomcat_from_archive{ 61 | 62 | add_tomcat_user(); 63 | my $tomcat_ver = download_and_install($in{'source_archive'}); 64 | 65 | setup_catalina_env($tomcat_ver); 66 | setup_tomcat_users($tomcat_ver); 67 | setup_tomcat_service($tomcat_ver); 68 | } 69 | 70 | sub get_apache_proxy_file(){ 71 | my $proxy_file; 72 | my %osinfo = &detect_operating_system(); 73 | if( ( $osinfo{'real_os_type'} =~ /centos/i) or #CentOS 74 | ( $osinfo{'real_os_type'} =~ /rocky/i) or #rocky 75 | ( $osinfo{'real_os_type'} =~ /alma/i) or #alma 76 | ($osinfo{'real_os_type'} =~ /fedora/i) ){ #Fedora 77 | if( ! -d '/etc/httpd/'){ 78 | return 0; 79 | } 80 | $proxy_file = '/etc/httpd/conf.d/tomcat.conf'; 81 | 82 | }elsif( ($osinfo{'real_os_type'} =~ /ubuntu/i) or 83 | ($osinfo{'real_os_type'} =~ /debian/i) ){ #ubuntu or debian 84 | if( ! -d '/etc/apache2/'){ 85 | return 0; 86 | } 87 | $proxy_file = '/etc/apache2/conf-enabled/tomcat.conf'; 88 | } 89 | return $proxy_file; 90 | } 91 | 92 | sub setup_default_apache_proxy(){ 93 | my $proxy_file = get_apache_proxy_file(); 94 | my %osinfo = &detect_operating_system(); 95 | 96 | if(-f $proxy_file){ 97 | return 0; 98 | } 99 | 100 | open(my $fh, '>', $proxy_file) or die "open:$!"; 101 | 102 | if( ($osinfo{'real_os_type'} =~ /centos/i) or #CentOS 103 | ($osinfo{'real_os_type'} =~ /fedora/i) ){ #Fedora 104 | 105 | &execute_command('setsebool httpd_can_network_connect 1'); 106 | 107 | print $fh "LoadModule proxy_module modules/mod_proxy.so\n"; 108 | print $fh "LoadModule proxy_http_module modules/mod_proxy_http.so\n"; 109 | print $fh "LoadModule rewrite_module modules/mod_rewrite.so\n"; 110 | 111 | }elsif( $osinfo{'os_type'} =~ /debian/i){ #ubuntu or debian 112 | 113 | print $fh "LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so\n"; 114 | print $fh "LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so\n"; 115 | print $fh "LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so\n"; 116 | } 117 | 118 | print $fh "ProxyRequests Off\n"; 119 | print $fh "ProxyPreserveHost On\n"; 120 | print $fh " \n"; 121 | print $fh " Order allow,deny\n"; 122 | print $fh " Allow from all\n"; 123 | print $fh " \n"; 124 | print $fh "ProxyPass / http://localhost:8080/\n"; 125 | print $fh "ProxyPassReverse / http://localhost:8080/\n"; 126 | 127 | close $fh; 128 | 129 | print "Added proxy configuration / -> 8080 in $proxy_file\n"; 130 | } 131 | 132 | sub select_tomcat_archive{ 133 | print "$text{'base_desc1'}

\n"; 134 | print &ui_form_start("setup.cgi", "form-data"); 135 | print ui_hidden('mode', 'tomcat_install'); 136 | print &ui_table_start($text{'base_options'}, undef, 2); 137 | 138 | my @tmver = &get_tomcat_major_versions(); 139 | my $sel_tmver = $in{'tmver'} || $tmver[0]; 140 | my @tm_opts = ( ); 141 | foreach my $v (@tmver) { 142 | push(@tm_opts, [ $v, $v ]); 143 | } 144 | 145 | print < 147 | function update_select(){ 148 | var majorSel = document.getElementById('base_major'); 149 | var major = majorSel.options[majorSel.selectedIndex].value; 150 | 151 | get_pjax_content('/tomcat/setup.cgi?mode=tomcat_install_form&tmver='+major); 152 | } 153 | 154 | EOF 155 | 156 | print &ui_table_row($text{'base_major'}, 157 | &ui_select("base_major", $sel_tmver, \@tm_opts, 1, 0, undef, undef, 'id="base_major" onchange="update_select()"')); 158 | 159 | my @tver = &major_tomcat_versions($sel_tmver); 160 | my @tver_opts = ( ); 161 | foreach my $v (reverse @tver) { 162 | push(@tver_opts, [ $v, $v ]); 163 | } 164 | 165 | print &ui_table_row($text{'base_installsource'}, 166 | &ui_radio_table("source", 100, 167 | [ [ 100, $text{'source_archive'}, &ui_select("source_archive", undef, \@tver_opts,1, 0)], 168 | [ 0, $text{'source_local'}, &ui_textbox("file", undef, 40)." ". &file_chooser_button("file", 0) ], 169 | [ 1, $text{'source_uploaded'}, &ui_upload("upload", 40) ], 170 | [ 2, $text{'source_ftp'},&ui_textbox("url", undef, 40) ] 171 | ])); 172 | 173 | print &ui_table_end(); 174 | print &ui_form_end([ [ "", $text{'base_installok'} ] ]); 175 | } 176 | 177 | sub setup_selinux{ 178 | my $tomcat_home = get_catalina_home(); 179 | 180 | local $out = &execute_command("semanage fcontext -a -t bin_t \"$tomcat_home/bin(/.*)?\"", undef, \$cmd_out, \$cmd_err, 0, 0); 181 | print &html_escape($cmd_out.$cmd_err); 182 | 183 | local $out = &execute_command("restorecon -r -v \"$tomcat_home/bin\"", undef, \$cmd_out, \$cmd_err, 0, 0); 184 | print &html_escape($cmd_out.$cmd_err); 185 | } 186 | 187 | sub setup_checks{ 188 | 189 | my %osinfo = &detect_operating_system(); 190 | 191 | #Check for commands 192 | if (!&has_command('java')) { 193 | print '

Warning: Java is not found. Install it manually or from the '. 194 | "Java tab

"; 195 | } 196 | 197 | my @pinfo = software::package_info('haveged', undef, ); 198 | if(!@pinfo){ 199 | if( ($osinfo{'real_os_type'} =~ /centos/i) or #CentOS 200 | ($osinfo{'real_os_type'} =~ /alma/i) or #Alma 201 | ($osinfo{'real_os_type'} =~ /rocky/i) ){ #Rocky 202 | @pinfo = software::package_info('epel-release', undef, ); 203 | if(!@pinfo){ 204 | print "

Warning: haveged needs epel-release. Install it manually or ". 205 | "click here to have it downloaded and installed.

"; 206 | } 207 | } 208 | print "

Warning: haveged package is not installed. Install it manually or ". 209 | "click here to have it downloaded and installed.

"; 210 | } 211 | 212 | my $tomcat_ver = installed_tomcat_version(); 213 | if(!$tomcat_ver){ 214 | print "

Click here to install Tomcat from Apache site.

"; 215 | } 216 | 217 | if (!&has_command('unzip')) { 218 | print '

Warning: unzip command is not found. Install it manually or '. 219 | "click here to have it downloaded and installed.

"; 220 | } 221 | 222 | my $proxy_file = get_apache_proxy_file(); 223 | my $www_name = ''; 224 | 225 | if( ( $osinfo{'real_os_type'} =~ /centos/i) or #CentOS 226 | ( $osinfo{'real_os_type'} =~ /rocky/i) or #Rocky 227 | ( $osinfo{'real_os_type'} =~ /alma/i) or #Alma 228 | ($osinfo{'real_os_type'} =~ /fedora/i) ){ #Fedora 229 | $www_name = 'httpd'; 230 | 231 | }elsif( ($osinfo{'real_os_type'} =~ /ubuntu/i) or 232 | ($osinfo{'real_os_type'} =~ /debian/i) ){ #ubuntu or debian 233 | $www_name = 'apache2'; 234 | } 235 | 236 | @pinfo = software::package_info($www_name, undef, ); 237 | if(!@pinfo){ 238 | print "

Warning: $www_name is not installed. Install it manually or ". 239 | "click here to have it downloaded and installed.

"; 240 | } 241 | 242 | if(! -f $proxy_file){ 243 | print "

Apache default proxy is not configured. ". 244 | "click here

"; 245 | } 246 | 247 | if(@pinfo){ 248 | if( ($osinfo{'real_os_type'} =~ /alma/i) or #Alma 249 | ($osinfo{'real_os_type'} =~ /rocky/i) ){ #Rocky 250 | 251 | local $out = &execute_command("sestatus", undef, \$cmd_out, \$cmd_err, 0, 0); 252 | if($cmd_out =~ /SELinux status:\s+enabled/i){ 253 | my $se_utils_pkg = 'policycoreutils-python-utils'; 254 | @pinfo = software::package_info($se_utils_pkg, undef, ); 255 | if(!@pinfo){ 256 | print "

Warning: $se_utils_pkg is not installed. Install it manually or ". 257 | "click here to have it downloaded and installed.

"; 258 | }else{ 259 | my $tomcat_home = get_catalina_home(); 260 | local $out = &execute_command("ls -lZ $tomcat_home/bin/startup.sh", undef, \$cmd_out, \$cmd_err, 0, 0); 261 | if($cmd_out !~ /:bin_t:/i){ 262 | printf "

SELinux is enabled. Configured it from ". 263 | "here.

"; 264 | } 265 | } 266 | } 267 | } 268 | } 269 | print '

If you don\'t see any warning above, you can complete setup from '. 270 | "here

"; 271 | } 272 | 273 | #Remove all setup files 274 | sub setup_cleanup{ 275 | my $file = $module_root_directory.'/setup.cgi'; 276 | print "Completing Installation
"; 277 | &unlink_file($file); 278 | print &js_redirect("index.cgi"); 279 | } 280 | 281 | 282 | &ui_print_header(undef, $text{'setup_title'}, ""); 283 | 284 | if($ENV{'CONTENT_TYPE'} =~ /boundary=(.*)$/) { 285 | &ReadParseMime(); 286 | }else { 287 | &ReadParse(); $no_upload = 1; 288 | } 289 | 290 | my $mode = $in{'mode'} || "checks"; 291 | 292 | if($mode eq "checks"){ setup_checks(); 293 | &ui_print_footer('', $text{'index_return'}); 294 | exit 0; 295 | }elsif($mode eq "cleanup"){ setup_cleanup(); 296 | &ui_print_footer('', $text{'index_return'}); 297 | exit 0; 298 | }elsif($mode eq "tomcat_install_form"){ select_tomcat_archive(); 299 | }elsif($mode eq "tomcat_install"){ install_tomcat_from_archive(); 300 | }elsif($mode eq "setup_apache_proxy"){ setup_default_apache_proxy(); 301 | }elsif($mode eq "setup_selinux"){ setup_selinux(); 302 | }else{ 303 | print "Error: Invalid setup mode\n"; 304 | } 305 | 306 | &ui_print_footer('setup.cgi', $text{'setup_title'}); 307 | -------------------------------------------------------------------------------- /start.cgi: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # start.cgi 3 | # Start the tomcat daemon 4 | 5 | require './tomcat-lib.pl'; 6 | &ReadParse(); 7 | &error_setup($text{'start_err'}); 8 | my ($rc, $err) = tomcat_service_ctl('start'); 9 | if ($rc != 0){ 10 | &ui_print_header(undef, $text{'index_title'}, ""); 11 | &error($err); 12 | &ui_print_footer("", $text{'index_return'}); 13 | exit; 14 | } 15 | &redirect(""); 16 | -------------------------------------------------------------------------------- /stop.cgi: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | require './tomcat-lib.pl'; 4 | &ReadParse(); 5 | &error_setup($text{'stop_err'}); 6 | my ($rc, $err) = tomcat_service_ctl('stop'); 7 | if ($rc != 0){ 8 | &ui_print_header(undef, $text{'index_title'}, ""); 9 | &error($err); 10 | &ui_print_footer("", $text{'index_return'}); 11 | exit; 12 | } 13 | &redirect(""); 14 | 15 | -------------------------------------------------------------------------------- /tomcat-lib.pl: -------------------------------------------------------------------------------- 1 | =head1 tomcat-lib.pl 2 | 3 | Functions for managing Tomcat server configuration files. 4 | 5 | foreign_require("tomcat", "tomcat-lib.pl"); 6 | @sites = tomcat::list_tomcat_websites() 7 | 8 | =cut 9 | 10 | BEGIN { push(@INC, ".."); }; 11 | use WebminCore; 12 | use File::Copy; 13 | init_config(); 14 | 15 | sub get_tomcat_config 16 | { 17 | my $lref = &read_file_lines($config{'foobar_conf'}); 18 | my @rv; 19 | my $lnum = 0; 20 | foreach my $line (@$lref) { 21 | my ($n, $v) = split(/\s+/, $line, 2); 22 | if ($n) { 23 | push(@rv, { 'name' => $n, 'value' => $v, 'line' => $lnum }); 24 | } 25 | $lnum++; 26 | } 27 | return @rv; 28 | } 29 | 30 | # Returns a hash containing the version type, number and full version 31 | sub get_catalina_version 32 | { 33 | local %version; 34 | local $catalina_home = get_catalina_home(); 35 | local $out = &backquote_command($catalina_home."/bin/catalina.sh version 2>&1 : '.$1."
"; 69 | } 70 | } 71 | } 72 | 73 | $running = $out >> 8; 74 | if($ctl eq 'status'){ 75 | # swap running values, to match init.d logic 76 | if($running == 0){ 77 | $running = 1; 78 | }elsif($running > 0){ 79 | $running = 0; 80 | } 81 | } 82 | 83 | }else{ 84 | local $out = &execute_command("/etc/init.d/tomcat $ctl", undef, \$cmd_out, \$cmd_err, 0, 0); 85 | 86 | $running = $out >> 8; 87 | if($cmd_err ne ""){ 88 | $status = $cmd_err; 89 | }else{ 90 | $status = $cmd_out; 91 | } 92 | } 93 | 94 | return ($running, $status); 95 | } 96 | 97 | sub get_all_war_infos(){ 98 | my $catalina_home = get_catalina_home(); 99 | opendir(DIR, $catalina_home.'/webapps') or die $!; 100 | my @dirs 101 | = grep { 102 | ! /^\./ # Doesn't begins with a period 103 | && -d "$catalina_home/webapps/$_" # and is a directory 104 | } readdir(DIR); 105 | closedir(DIR); 106 | 107 | return sort @dirs; 108 | } 109 | 110 | sub file_basename 111 | { 112 | my $rv = $_[0]; 113 | $rv =~ s/^.*[\/\\]//; 114 | return $rv; 115 | } 116 | 117 | sub sort_version { 118 | my @A = split(/\./, $a); 119 | my @B = split(/\./, $b); 120 | # a sort subroutine, expect $a and $b 121 | for(my $i=0; $i < 3; $i++){ 122 | if ($A[$i] < $B[$i]) { return -1 } elsif ($A[$i] > $B[$i]) { return 1 } 123 | } 124 | return 0; 125 | } 126 | 127 | sub latest_tomcat_version{ 128 | my $tomcat_ver = $_[0]; 129 | my %version; 130 | if(-f "$module_config_directory/version"){ 131 | read_file_cached("$module_config_directory/version", \%version); 132 | 133 | if( $version{'updated'} >= (time() - 86400)){ #if last update was less than a day ago 134 | return $version{'latest'} if ($version{'latest'} ne '0.0.0'); 135 | } 136 | } 137 | 138 | my $major = (split /\./, $tomcat_ver)[0]; 139 | my @all_ver = &major_tomcat_versions($major); 140 | my $latest_ver = $all_ver[-1]; 141 | 142 | #renew the updated timestamp and latest version 143 | $version{'updated'} = time(); 144 | $version{'latest'} = $latest_ver; 145 | &write_file("$module_config_directory/version", \%version); 146 | 147 | return $latest_ver; 148 | } 149 | 150 | sub installed_tomcat_version(){ 151 | my %os_env; 152 | read_env_file('/etc/environment', \%os_env); 153 | 154 | if($os_env{'CATALINA_HOME'}){ 155 | $os_env{'CATALINA_HOME'} =~ /\/home\/tomcat\/apache-tomcat-([0-9\.]+)/; 156 | return $1; 157 | }else{ 158 | return undef; 159 | } 160 | } 161 | 162 | sub get_catalina_home(){ 163 | my $tomcat_ver = installed_tomcat_version(); 164 | return "/home/tomcat/apache-tomcat-$tomcat_ver"; 165 | } 166 | 167 | sub download_and_install{ 168 | my $tomcat_ver = $_[0]; 169 | my $major = (split /\./, $tomcat_ver)[0]; 170 | 171 | #download tomcat archive 172 | $in{'url'} = "https://archive.apache.org/dist/tomcat/tomcat-$major/v$tomcat_ver/bin/apache-tomcat-$tomcat_ver.tar.gz"; 173 | $in{'source'} = 2; 174 | 175 | my $tmpfile = process_file_source(); 176 | 177 | #extract tomcat archive 178 | my $cmd_out=''; 179 | my $cmd_err=''; 180 | print "
Extracting to /home/tomcat/apache-tomcat-$tomcat_ver/ ...
"; 181 | local $out = &execute_command("tar -x -v --overwrite -f \"$tmpfile\" -C/home/tomcat/", undef, \$cmd_out, \$cmd_err, 0, 0); 182 | 183 | if($cmd_err ne ""){ 184 | &error("Error: tar: $cmd_err"); 185 | }else{ 186 | $cmd_out = s/\n/
/g; 187 | print &html_escape($cmd_out); 188 | print "Done
"; 189 | } 190 | 191 | #folder is created after tomcat is started, but we need it now 192 | &make_dir("/home/tomcat/apache-tomcat-$tomcat_ver/conf/Catalina/localhost/", 0755, 1); 193 | 194 | open(my $fh, '>', "/home/tomcat/apache-tomcat-$tomcat_ver/conf/Catalina/localhost/manager.xml") or die "open:$!"; 195 | print $fh < 197 | 198 | 199 | EOF 200 | close $fh; 201 | 202 | #&set_ownership_permissions('tomcat','tomcat', undef, "/home/tomcat/apache-tomcat-$tomcat_ver/"); 203 | &execute_command("chown -R tomcat:tomcat /home/tomcat/apache-tomcat-$tomcat_ver"); 204 | 205 | return $tomcat_ver; 206 | } 207 | 208 | sub setup_catalina_env{ 209 | my $tomcat_ver = $_[0]; 210 | 211 | my %os_env; 212 | 213 | print "
Setting CATALINA environment..."; 214 | 215 | read_env_file('/etc/environment', \%os_env); 216 | $os_env{'CATALINA_HOME'} = "/home/tomcat/apache-tomcat-$tomcat_ver/"; 217 | $os_env{'CATALINA_BASE'} = "/home/tomcat/apache-tomcat-$tomcat_ver/"; 218 | write_env_file('/etc/environment', \%os_env, 0); 219 | 220 | open(my $fh, '>>', "/home/tomcat/apache-tomcat-$tomcat_ver/bin/setenv.sh") or die "open:$!"; 221 | print $fh "CATALINA_PID=\"/home/tomcat/apache-tomcat-$tomcat_ver/temp/tomcat.pid\"\n"; 222 | close $fh; 223 | } 224 | 225 | sub get_installed_libs{ 226 | opendir(DIR, $module_config_directory) or die $!; 227 | my @lib_lists 228 | = grep { 229 | /^lib_[a-z0-9\.\-_\s]+\.list$/i # 230 | && -f "$module_config_directory/$_" # and is a file 231 | } readdir(DIR); 232 | closedir(DIR); 233 | 234 | return sort @lib_lists; 235 | } 236 | 237 | sub process_file_source{ 238 | my $file = ''; 239 | 240 | if (($in{'source'} == 0) && ($in{'file'} ne "")) { # from local file 241 | &error_setup(&text('source_err0', $in{'file'})); 242 | $file = $in{'file'}; 243 | if (!(-r $file)){ 244 | &error($text{'source_err0'}); 245 | } 246 | 247 | }elsif (($in{'source'} == 1) && ($in{'upload_filename'} ne "")) { # from uploaded file 248 | &error_setup($text{'source_err1'}); 249 | $need_unlink = 1; 250 | if ($no_upload) { 251 | &error($text{'source_err1.2'}); 252 | } 253 | $file = transname(file_basename($in{'upload_filename'})); 254 | open(MOD, ">$file"); 255 | binmode(MOD); 256 | print MOD $in{'upload'}; 257 | close(MOD); 258 | 259 | }elsif ($in{'source'} == 2 and $in{'url'} ne '') { # from ftp or http url (possible third-party) 260 | $url = $in{'url'}; 261 | &error_setup(&text('source_err2', $url)); 262 | $file = &transname(file_basename($url)); 263 | $need_unlink = 1; 264 | my $error; 265 | $progress_callback_url = $url; 266 | if ($url =~ /^(http|https):\/\/([^\/]+)(\/.*)$/) { 267 | $ssl = $1 eq 'https'; 268 | $host = $2; $page = $3; $port = $ssl ? 443 : 80; 269 | if ($host =~ /^(.*):(\d+)$/) { $host = $1; $port = $2; } 270 | my %cookie_headers = ('Cookie'=>'oraclelicense=accept-securebackup-cookie'); 271 | &http_download($host, $port, $page, $file, \$error, 272 | \&progress_callback, $ssl, undef, undef, 0, 0, 1, \%cookie_headers); 273 | } elsif ( 274 | $url =~ /^ftp:\/\/([^\/]+)(:21)?\/(.*)$/) { 275 | $host = $1; $ffile = $3; 276 | &ftp_download($host, $ffile, $file, \$error, \&progress_callback); 277 | }else { 278 | &error($text{'source_err3'}); 279 | } 280 | &error($error) if ($error); 281 | } 282 | return $file; 283 | } 284 | 285 | sub unzip_file{ 286 | my $file = $_[0]; 287 | my @suffixlist = ('.zip'); 288 | ($lib_name,$path,$lib_suffix) = fileparse($file,@suffixlist); 289 | 290 | my $unzip_dir = "/tmp/.webmin/$lib_name"; 291 | 292 | #if old temp extension dir exist, remove it 293 | #if( -d $unzip_dir and rmtree($unzip_dir) == 0){ 294 | # &error("Failed to remove temp extension dir"); 295 | # &ui_print_footer("", $text{'index_return'}); 296 | # exit; 297 | #} 298 | &make_dir($unzip_dir, 0754, 1); 299 | 300 | my $unzip_out; 301 | my $unzip_err; 302 | print "
Unzipping to $unzip_dir ...
"; 303 | local $out = &execute_command("unzip -u \"$file\" -d \"$unzip_dir\"", undef, \$unzip_out, \$unzip_err, 0, 0); 304 | 305 | if($unzip_err){ 306 | &error("Error: unzip: $unzip_err"); 307 | }else{ 308 | $unzip_out = s/\r\n/
/g; 309 | print &html_escape($unzip_out); 310 | } 311 | return $unzip_dir; 312 | } 313 | 314 | sub get_tomcat_major_versions(){ 315 | my @majors = (); 316 | my $url = "https://archive.apache.org/dist/tomcat/"; 317 | &error_setup(&text('install_err3', $url)); 318 | my $error = ''; 319 | my $tmpfile = &transname('tomcat.html'); 320 | 321 | 322 | &http_download('archive.apache.org', 80, "/dist/tomcat/", $tmpfile, \$error); 323 | if($error){ 324 | error($error); 325 | } 326 | 327 | my @latest_versions; 328 | open(my $fh, '<', $tmpfile) or die "open:$!"; 329 | while(my $line = <$fh>){ 330 | if($line =~ /tomcat\-[0-9\.]+\/<\/a>/){ 331 | push(@majors, $1); 332 | } 333 | } 334 | close $fh; 335 | 336 | return reverse sort sort_version @majors; 337 | } 338 | 339 | sub major_tomcat_versions{ 340 | my $major = $_[0]; #Tomcat major version 6,7,8,9 341 | 342 | my $url = "https://archive.apache.org/dist/tomcat/tomcat-$major/"; 343 | &error_setup(&text('install_err3', $url)); 344 | my $error = ''; 345 | my $tmpfile = &transname('tomcat.html'); 346 | 347 | 348 | &http_download('archive.apache.org', 80, "/dist/tomcat/tomcat-$major/", $tmpfile, \$error); 349 | if($error){ 350 | error($error); 351 | } 352 | 353 | my @latest_versions; 354 | open(my $fh, '<', $tmpfile) or die "open:$!"; 355 | while(my $line = <$fh>){ 356 | if($line =~ /v[0-9\.]+\/<\/a>/){ 357 | push(@latest_versions, $1); 358 | } 359 | } 360 | close $fh; 361 | 362 | return sort sort_version @latest_versions; 363 | } 364 | 365 | sub setup_tomcat_service{ 366 | my $tomcat_ver = $_[0]; 367 | if (&has_command('systemctl')) { 368 | 369 | copy_source_dest("$module_root_directory/tomcat.service", '/etc/systemd/system/tomcat.service'); 370 | 371 | my $ln = 0; 372 | $lref = read_file_lines('/etc/systemd/system/tomcat.service'); 373 | foreach $line (@$lref){ 374 | chomp $line; 375 | if($line =~ /\$TOMCAT_VER/){ #if its a section start 376 | $line =~ s/\$TOMCAT_VER/$tomcat_ver/; 377 | @{$lref}[$ln] = $line; 378 | }elsif($line =~ /\$CATALINA_HOME/){ 379 | $line =~ s/\$CATALINA_HOME/\/home\/tomcat\/apache-tomcat-$tomcat_ver/; 380 | @{$lref}[$ln] = $line; 381 | } 382 | $ln=$ln+1; 383 | } 384 | &flush_file_lines('/etc/systemd/system/tomcat.service'); 385 | 386 | &set_ownership_permissions('root','root', 0555, "/etc/systemd/system/tomcat.service"); 387 | 388 | &backquote_command("systemctl daemon-reload", undef, \$cmd_out, \$cmd_err, 0, 0); 389 | }else{ 390 | copy_source_dest("$module_root_directory/tomcat.init", '/etc/init.d/tomcat'); 391 | &set_ownership_permissions('root','root', 0555, "/etc/init.d/tomcat"); 392 | } 393 | print "
Setting Tomcat service ..."; 394 | } 395 | 396 | sub upgrade_available(){ 397 | my $tomcat_ver = installed_tomcat_version(); 398 | my $latest_ver = latest_tomcat_version($tomcat_ver); 399 | 400 | my @versions = ($tomcat_ver, $latest_ver); 401 | @versions = sort sort_version @versions; 402 | 403 | if($versions[1] eq $tomcat_ver){ 404 | return ''; 405 | }else { 406 | return $latest_ver; 407 | } 408 | } 409 | -------------------------------------------------------------------------------- /tomcat.init: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ### BEGIN INIT INFO 3 | # Provides: tomcat 4 | # Required-Start: $network 5 | # Required-Stop: $network 6 | # Default-Start: 2 3 4 5 7 | # Default-Stop: 0 1 6 8 | # Short-Description: Start/Stop Tomcat server 9 | ### END INIT INFO 10 | 11 | # Source function library. 12 | . /etc/environment; #Catalina variables 13 | . $CATALINA_HOME/bin/setenv.sh 14 | 15 | RETVAL=$? 16 | 17 | function start(){ 18 | echo "Starting Tomcat" 19 | /bin/su - tomcat $CATALINA_HOME/bin/startup.sh 20 | RETVAL=$? 21 | } 22 | 23 | function stop(){ 24 | echo "Stopping Tomcat" 25 | /bin/su - tomcat -c "$CATALINA_HOME/bin/shutdown.sh 60 -force" 26 | RETVAL=$? 27 | } 28 | 29 | case "$1" in 30 | start) 31 | start; 32 | ;; 33 | stop) 34 | stop; 35 | ;; 36 | restart) 37 | echo "Restarting Tomcat" 38 | stop; 39 | start; 40 | ;; 41 | status) 42 | 43 | if [ -f "${CATALINA_PID}" ]; then 44 | TOMCAT_PID=$(cat "${CATALINA_PID}") 45 | echo "Tomcat is running with PID ${TOMCAT_PID}"; 46 | RETVAL=1 47 | else 48 | echo "Tomcat is not running"; 49 | RETVAL=0 50 | fi 51 | ;; 52 | *) 53 | echo $"Usage: $0 {start|stop|restart|status}" 54 | exit 1 55 | ;; 56 | esac 57 | exit $RETVAL 58 | -------------------------------------------------------------------------------- /tomcat.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Tomcat $TOMCAT_VER 3 | After=multi-user.target 4 | 5 | [Service] 6 | User=tomcat 7 | Group=tomcat 8 | 9 | WorkingDirectory=$CATALINA_HOME 10 | Type=forking 11 | Restart=always 12 | 13 | EnvironmentFile=/etc/environment 14 | 15 | ExecStart=$CATALINA_HOME/bin/startup.sh 16 | ExecStop=$CATALINA_HOME/bin/shutdown.sh 60 -force 17 | 18 | [Install] 19 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /tomcat_upgrade.cgi: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | require './tomcat-lib.pl'; 4 | 5 | sub select_tomcat_archive{ 6 | print "$text{'base_desc2'}

\n"; 7 | print &ui_form_start("tomcat_upgrade.cgi", "form-data"); 8 | print ui_hidden('mode', 'tomcat_upgrade'); 9 | print &ui_table_start($text{'base_options'}, undef, 2); 10 | 11 | my $install_ver = installed_tomcat_version(); 12 | my $install_major = (split /\./, $install_ver)[0]; 13 | 14 | if($in{'tmver'}){ 15 | $install_major = $in{'tmver'}; 16 | } 17 | 18 | my @tmver = &get_tomcat_major_versions(); 19 | my $sel_tmver = $install_major; 20 | my @tm_opts = ( ); 21 | foreach my $v (@tmver) { 22 | push(@tm_opts, [ $v, $v ]); 23 | } 24 | 25 | print < 27 | function update_select(){ 28 | var majorSel = document.getElementById('base_major'); 29 | var major = majorSel.options[majorSel.selectedIndex].value; 30 | 31 | get_pjax_content('/tomcat/tomcat_upgrade.cgi?mode=select_version&tmver='+major); 32 | } 33 | 34 | EOF 35 | 36 | print &ui_table_row($text{'base_major'}, 37 | &ui_select("base_major", $sel_tmver, \@tm_opts, 1, 0, undef, undef, 'id="base_major" onchange="update_select()"')); 38 | 39 | my @tver = &major_tomcat_versions($sel_tmver); 40 | my @tver_opts = ( ); 41 | foreach my $v (reverse @tver) { 42 | push(@tver_opts, [ $v, $v ]); 43 | } 44 | 45 | print &ui_table_row($text{'base_installsource'}, 46 | &ui_radio_table("source", 100, 47 | [ [ 100, $text{'source_archive'}, &ui_select("source_archive", undef, \@tver_opts,1, 0)], 48 | ])); 49 | 50 | print &ui_table_end(); 51 | print &ui_form_end([ [ "", $text{'base_upgradeok'} ] ]); 52 | } 53 | 54 | sub migrate_settings_and_apps{ 55 | my $old_ver = $_[0]; 56 | my $new_ver = $_[1]; 57 | my $apps_ref = $_[2]; 58 | 59 | #Copy Settings 60 | my @files = ('bin/setenv.sh', 'conf/tomcat-users.xml'); 61 | foreach my $file (@files){ 62 | if( -f "/home/tomcat/apache-tomcat-$old_ver/$file"){ 63 | copy_source_dest("/home/tomcat/apache-tomcat-$old_ver/$file", 64 | "/home/tomcat/apache-tomcat-$new_ver/$file"); 65 | print "Copying $file to /home/tomcat/apache-tomcat-$new_ver/$file
"; 66 | } 67 | } 68 | 69 | #make a list of installed apps 70 | my @exclude_apps = ('docs', 'examples', 'host-manager', 'manager', 'ROOT'); 71 | 72 | #move apps 73 | print "Copying apps ...
"; 74 | foreach my $app (@$apps_ref){ 75 | 76 | next if grep( /^$app$/, @exclude_apps); 77 | 78 | if(!copy_source_dest( "/home/tomcat/apache-tomcat-$old_ver/webapps/$app", 79 | "/home/tomcat/apache-tomcat-$new_ver/webapps/$app")){ 80 | &error("Error: Can't copy $app: $!"); 81 | }else{ 82 | print "$app
"; 83 | } 84 | 85 | if(-f "/home/tomcat/apache-tomcat-$old_ver/webapps/$app.war"){ 86 | if(!copy_source_dest( "/home/tomcat/apache-tomcat-$old_ver/webapps/$app.war", 87 | "/home/tomcat/apache-tomcat-$new_ver/webapps/$app.war")){ 88 | &error("Error: Can't copy $app.war: $!"); 89 | }else{ 90 | print "$app.war
"; 91 | } 92 | } 93 | } 94 | } 95 | 96 | sub upgrade_tomcat_from_archive{ 97 | 98 | my $install_ver = installed_tomcat_version(); 99 | my $latest_ver = $_[0]; 100 | 101 | my @installed_apps = get_all_war_infos(); 102 | 103 | #add_tomcat_user(); 104 | download_and_install($latest_ver); 105 | 106 | tomcat_service_ctl('stop'); 107 | 108 | setup_catalina_env($latest_ver); 109 | #setup_tomcat_users($latest_ver); 110 | setup_tomcat_service($latest_ver); 111 | 112 | migrate_settings_and_apps($install_ver, $latest_ver, \@installed_apps); 113 | 114 | print("Update done, starting new Tomcat ".$latest_ver); 115 | tomcat_service_ctl('start'); 116 | } 117 | 118 | 119 | &ui_print_header(undef, $text{'index_title_upgrade'}, "", "intro", 1, 1); 120 | if($ENV{'CONTENT_TYPE'} =~ /boundary=(.*)$/) { 121 | &ReadParseMime(); 122 | }else { 123 | &ReadParse(); $no_upload = 1; 124 | } 125 | &error_setup($text{'start_err'}); 126 | 127 | my $mode = $in{'mode'} || "select_version"; 128 | 129 | if($mode eq "select_version"){ 130 | select_tomcat_archive(); 131 | }elsif($mode eq "tomcat_upgrade"){ 132 | $err = upgrade_tomcat_from_archive($in{'source_archive'}); 133 | } 134 | 135 | &ui_print_footer("", $text{'index_return'}); 136 | -------------------------------------------------------------------------------- /uninstall_java.cgi: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | use File::Path 'rmtree'; 4 | 5 | require './tomcat-lib.pl'; 6 | require './java-lib.pl'; 7 | require '../webmin/webmin-lib.pl'; #For OS Fetection 8 | &ReadParse(); 9 | 10 | &error_setup($text{'delete_err'}); 11 | 12 | my $jdk_name = $in{'inst_jdk'}; 13 | $jdk_name || &error($text{'delete_enone'}); 14 | 15 | my $jdk_dir = get_jdk_dir_by_name($jdk_name); 16 | my $def_jdk = is_default_jdk($jdk_dir); 17 | 18 | if(($def_jdk == 1) and ($in{'rm_def_jdk'} == 0)){ 19 | 20 | &ui_print_header(undef, $text{'java_tabuninstall'}, ""); 21 | print "Uninstall stopped, since $jdk_dir is default JDK.
"; 22 | 23 | }else{ 24 | 25 | if($jdk_name =~ /.*openjdk.*/){ 26 | &redirect("/software/search.cgi?search=$jdk_name"); 27 | return; 28 | } 29 | 30 | &ui_print_header(undef, $text{'delete_title'}, ""); 31 | 32 | print "Removing $jdk_dir...
"; 33 | 34 | if($def_jdk == 1){ 35 | unset_default_java($jdk_dir); 36 | } 37 | 38 | if( -d $jdk_dir){ 39 | rmtree($jdk_dir); 40 | } 41 | 42 | print "


Uninstall of $jdk_name is successful
"; 43 | } 44 | 45 | &ui_print_footer("", $text{'index_return'}); 46 | -------------------------------------------------------------------------------- /uninstall_libs.cgi: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | use File::Path 'rmtree'; 4 | 5 | require './tomcat-lib.pl'; 6 | &ReadParse(); 7 | 8 | sub uninstall_lib{ 9 | my $lib_name = $_[0]; 10 | 11 | #get extension files 12 | my $lib_list = "$module_config_directory/lib_$lib_name.list"; 13 | my %lib_files; 14 | &read_file($lib_list, \%lib_files); 15 | 16 | foreach $j (keys %lib_files){ 17 | if( -e $lib_files{$j} or -l $lib_files{$j}){ 18 | &unlink_file($lib_files{$j}); 19 | print "$lib_files{$j}
"; 20 | }elsif( -d $lib_files{$j}){ 21 | rmtree($lib_files{$j}); 22 | }else{ 23 | print "Listed jar $j doesn't exist!
"; 24 | } 25 | } 26 | &unlink_file($lib_list); 27 | 28 | print "
Uninstall of $lib_name is successful
"; 29 | } 30 | 31 | &error_setup($text{'delete_err'}); 32 | &ui_print_header(undef, $text{'libs_uninstall_title'}, ""); 33 | 34 | @libs = split(/\0/, $in{'inst_lib'}); 35 | @libs || &error($text{'delete_enone'}); 36 | 37 | tomcat_service_ctl('stop'); 38 | 39 | #delete each of the specified directories 40 | my $catalina_home = get_catalina_home(); 41 | foreach $lib (@libs) { 42 | print "Removing $lib
"; 43 | uninstall_lib($lib); 44 | } 45 | 46 | tomcat_service_ctl('start'); 47 | 48 | &ui_print_footer("", $text{'index_return'}); 49 | --------------------------------------------------------------------------------