0139.html 6.2 KB

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