0139.html 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <!DOCTYPE html>
  2. <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <title>Creating and Applying SSL Certificate to Apache Guacamole</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  6. <meta charset="UTF-8">
  7. <meta name="keywords" content="Apache Tomcat,SSL,PKI,Configuration,Web Server,Guacamole,Web Based Tools,Debian,i12bretro,How To,Tutorial,Apache,Web Based RDP,Web Based VNC,Web Based SSH,System Administration">
  8. <meta name="author" content="i12bretro">
  9. <meta name="description" content="Creating and Applying SSL Certificate to Apache Guacamole">
  10. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  11. <script type="text/javascript" src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
  12. <script type="text/javascript" src="includes/js/steps.js"></script>
  13. <link href="css/steps.css" rel="stylesheet" type="text/css" />
  14. </head>
  15. <body>
  16. <div id="gridContainer">
  17. <div class="topMargin"></div>
  18. <div id="listName" class="topMargin">
  19. <h1>Creating and Applying SSL Certificate to Apache Guacamole</h1>
  20. </div>
  21. <div></div>
  22. <div id="content">
  23. <h2>Create Your SSL Certificate</h2>
  24. <ol>
  25. <li>Launch XCA</li>
  26. <li>Open the PKI database if it is not already (File &gt; Open DataBase), enter password</li>
  27. <li>Click on the Certificates tab, right click on your Intermediate CA certificate</li>
  28. <li>Select New</li>
  29. <li>On the Source tab, make sure Use this Certificate for signing is selected</li>
  30. <li>Verify your Intermediate CA certificate is selected from the drop down</li>
  31. <li>Click the Subject tab</li>
  32. <li>Complete the Distinguished Name section
  33. <p>internalName: Guacamole SSL<br />
  34. countryName: US<br />
  35. stateOrProvinceName: Virginia<br />
  36. localityName: Northern<br />
  37. organizationName: i12bretro<br />
  38. organizationUnitName: i12bretro Certificate Authority<br />
  39. commonName: remote.i12bretro.local</p>
  40. </li>
  41. <li>Click the Generate a New Key button</li>
  42. <li>Enter a name and set the key size to at least 2048</li>
  43. <li>Click Create</li>
  44. <li>Click on the Extensions tab</li>
  45. <li>Select End Entity from the type list</li>
  46. <li>Click Edit next to Subject Alternative Name</li>
  47. <li>Add any DNS or IP addresses that the certificate will identify</li>
  48. <li>Update the validity dates to fit your needs</li>
  49. <li>Click the Key Usage tab</li>
  50. <li>Under Key Usage select Digital Signature, Key Enchiperment</li>
  51. <li>Under Extended Key Usage select Web Server and Web Client Authentication</li>
  52. <li>Click the Netscape tab</li>
  53. <li>Select SSL Server</li>
  54. <li>Click OK to create the certificate</li>
  55. </ol>
  56. <h2>Exporting Required Files</h2>
  57. <ol>
  58. <li>In XCA, click on the Certificates tab</li>
  59. <li>Right click the Intermediate CA certificate &gt; Export &gt; File</li>
  60. <li>Set the file name with a .crt extension and verify the export format is PEM chain (*.pem)</li>
  61. <li>Click OK</li>
  62. <li>Right click the SSL certificate &gt; Export &gt; File</li>
  63. <li>Set the file name with a .crt extension and verify the export format is PEM (*.crt)</li>
  64. <li>Click OK</li>
  65. <li>Click the Private Keys tab</li>
  66. <li>Right click the private key generated for the SSL certificate &gt; Export &gt; File</li>
  67. <li>Set the file name with a .key extension and verify the export format is PEM private (*.pem)</li>
  68. <li>Click OK</li>
  69. </ol>
  70. <h2>Applying the Certificates</h2>
  71. <ol>
  72. <li>Download WinSCP <a href="https://winscp.net/eng/downloads.php" target="_blank">Download</a></li>
  73. <li>Extract WinSCP and run the executable</li>
  74. <li>Connect to the Apache Guacamole server via WinSCP</li>
  75. <li>Copy the created .crt, .key and .pem files to ~/</li>
  76. <li>On the Guacamole server, run the following command in a terminal
  77. <div class="codeBlock">sudo cp ~/remote.i12bretro.local.crt /var/lib/tomcat9/<br />
  78. sudo cp ~/remote.i12bretro.local.key /var/lib/tomcat9/<br />
  79. sudo cp ~/CA-Chain.pem /var/lib/tomcat9/<br />
  80. sudo chown :tomcat /var/lib/tomcat9/remote.i12bretro.local.crt<br />
  81. sudo chown :tomcat /var/lib/tomcat9/remote.i12bretro.local.key<br />
  82. sudo chown :tomcat /var/lib/tomcat9/CA-Chain.pem<br />
  83. sudo cp /var/lib/tomcat9/conf/server.xml /var/lib/tomcat9/conf/server.xml.bkup<br />
  84. sudo nano /var/lib/tomcat9/conf/server.xml</div>
  85. </li>
  86. <li>Edit the server.xml file adding the following connector block
  87. <p>&lt;connector port=&quot;8443&quot;<br />
  88. protocol=&quot;org.apache.coyote.http11.Http11NioProtocol&quot;<br />
  89. maxThreads=&quot;150&quot;<br />
  90. SSLEnabled=&quot;true&quot;<br />
  91. SSLProtocol=&quot;TLS&quot;<br />
  92. clientAuth=&quot;false&quot;<br />
  93. secure=&quot;true&quot;<br />
  94. scheme=&quot;https&quot;<br />
  95. SSLCertificateFile=&quot;/var/lib/tomcat9/remote.i12bretro.local.crt&quot;<br />
  96. SSLCertificateKeyFile=&quot;/var/lib/tomcat9/remote.key&quot;<br />
  97. SSLCertificateChainFile=&quot;/var/lib/tomcat9/CA-Chain.pem&quot;<br />
  98. keyAlias=&quot;remote.i12bretro.local&quot;<br />
  99. sslEnabledProtocols=&quot;TLSv1.1+TLSv1.2&quot;&gt;&lt;/connector&gt;</p>
  100. </li>
  101. <li>Press CTRL+O, Enter, CTRL+X</li>
  102. <li>Run the following command in terminal to restart the Gaucamole Tomcat server
  103. <div class="codeBlock">sudo systemctl restart tomcat9</div>
  104. </li>
  105. <li>Open a web browser and navigate to Apache Guacamole via https://</li>
  106. </ol>
  107. <h2>Optional Steps</h2>
  108. <ol>
  109. <li>To redirect all http traffic to communicate securely with https, run the following in a terminal
  110. <div class="codeBlock">sudo nano /var/lib/tomcat9/conf/web.xml</div>
  111. </li>
  112. <li>At the bottom of the file above the closing tag for web-app paste the following
  113. <p>&lt;security-constraint&gt;<br />
  114. &lt;web-resource-collection&gt;<br />
  115. &lt;web-resource-name&gt;Protected Context&lt;/web-resource-name&gt;<br />
  116. &lt;url-pattern&gt;/*&lt;/url-pattern&gt;<br />
  117. &lt;/web-resource-collection&gt;<br />
  118. &lt;user-data-constraint&gt;<br />
  119. &lt;transport-guarantee&gt;CONFIDENTIAL&lt;/transport-guarantee&gt;<br />
  120. &lt;/user-data-constraint&gt;<br />
  121. &lt;/security-constraint&gt;</p>
  122. </li>
  123. </ol>
  124. </div>
  125. </div>
  126. </body>
  127. </html>