Changeset 7472
- Timestamp:
- Apr 10, 2018, 8:50:42 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/core/net/sf/basedb/core/FileServer.java
r7471 r7472 663 663 @since 3.13 664 664 */ 665 public void setSshPrivateKeyFormat(String password)665 public void setSshPrivateKeyFormat(String format) 666 666 throws PermissionDeniedException, InvalidDataException 667 667 { 668 668 checkPermission(Permission.WRITE); 669 getData().setSshPrivateKeyFormat(StringUtil.setNullableString( password,669 getData().setSshPrivateKeyFormat(StringUtil.setNullableString(format, 670 670 "sshPrivateKeyFormat", MAX_FORMAT_LENGTH)); 671 671 } -
trunk/www/filemanager/fileservers/edit_fileserver.jsp
r7333 r7472 180 180 </table> 181 181 </t:tab> 182 <t:tab id="serverCertificate" title=" Certificates"182 <t:tab id="serverCertificate" title="HTTPS certificates" 183 183 helpid="fileserver.edit"> 184 184 … … 210 210 </td> 211 211 </tr> 212 <tr >212 <tr class="dynamic"> 213 213 <th class="subprompt"></th> 214 214 <td> … … 222 222 enter the password as well. 223 223 </div> 224 225 </td> 226 </tr> 224 </td> 225 </tr> 226 </table> 227 </t:tab> 228 <t:tab id="sshOptions" title="SSH options" 229 helpid="fileserver.edit"> 230 <table class="fullform input100"> 227 231 <tr> 228 232 <th>SSH fingerprint</th> … … 232 236 </td> 233 237 </tr> 234 <tr class="dynamic">238 <tr> 235 239 <th class="subprompt">(MD5 or SHA-256)</th> 236 240 <td> … … 240 244 heaxdecimal numbers with colon separator while SHA-256 is Base64-encoded. 241 245 </div> 242 243 </td> 244 </tr> 246 </td> 247 </tr> 248 <tr> 249 <th>SSH private key</th> 250 <td> 251 <input class="text" type="file" name="ssh_private_key" size="40"> 252 </td> 253 </tr> 254 <tr> 255 <th class="subprompt">Format</th> 256 <td> 257 <% 258 String currentFormat = server == null ? cc.getPropertyValue("sshPrivateKeyFormat") : server.getSshPrivateKeyFormat(); 259 String[] formats = { "OpenSSH", "OpenSSHv1", "PuTTY", "PKCS5", "PKCS8" }; 260 %> 261 <select name="ssh_private_key_format"> 262 <option value="">- auto - 263 <% 264 for (String f : formats) 265 { 266 %> 267 <option value="<%=f%>" <%=f.equals(currentFormat) ? "selected" : "" %>><%=f%> 268 <% 269 } 270 %> 271 </select> 272 </td> 273 <td></td> 274 </tr> 275 <tr> 276 <th class="subprompt">Password</th> 277 <td> 278 <input class="text" type="password" name="ssh_private_key_password"> 279 </td> 280 </tr> 281 <tr class="dynamic"> 282 <th class="subprompt"></th> 283 <td> 284 <input type="checkbox" name="remove_ssh_private_key" id="removeSshPrivateKey" value="1" 285 ><label for="removeSshPrivateKey">Remove existing private key</label> 286 287 <div class="messagecontainer help"> 288 A <b>private key</b> can be used instead of a password to connect to a server. 289 290 If the file is password-protected you must enter the password as well. 291 </div> 292 </td> 293 </tr> 294 245 295 </table> 246 296 -
trunk/www/filemanager/fileservers/fileservers.js
r7434 r7472 43 43 TabControl.addTabValidator('settings.info', fileServers.validateFileServer); 44 44 TabControl.addTabValidator('settings.serverCertificate', fileServers.validateCertificates); 45 TabControl.addTabValidator('settings.sshOptions', fileServers.validateSshOptions); 45 46 46 47 // Connection manager … … 112 113 113 114 fileServers.validateCertificates = function() 115 { 116 return true; 117 } 118 119 fileServers.validateSshOptions = function() 114 120 { 115 121 var frm = document.forms['server']; -
trunk/www/filemanager/fileservers/index.jsp
r6497 r7472 157 157 byte[] serverCertificate = null; 158 158 byte[] clientCertificate = null; 159 byte[] sshPrivateKey = null; 159 160 while (uploadedFile != null) 160 161 { … … 170 171 clientCertificate = fileData.toByteArray(); 171 172 } 173 else if ("ssh_private_key".equals(formName)) 174 { 175 sshPrivateKey = fileData.toByteArray(); 176 } 172 177 uploadedFile = upload.next(); 173 178 } … … 182 187 server.setRootPath(Values.getStringOrNull(upload.getParameter("rootPath"))); 183 188 server.setSshFingerprint(Values.getStringOrNull(upload.getParameter("sshFingerprint"))); 189 server.setSshPrivateKeyFormat(Values.getStringOrNull(upload.getParameter("ssh_private_key_format"))); 184 190 String certPassword = Values.getStringOrNull(upload.getParameter("client_certificate_password")); 185 191 if (certPassword != null) server.setClientCertificatePassword(certPassword); 192 String sshPrivateKeyPassword = Values.getStringOrNull(upload.getParameter("ssh_private_key_password")); 193 if (sshPrivateKeyPassword != null) server.setSshPrivateKeyPassword(sshPrivateKeyPassword); 186 194 if (Values.getBoolean(upload.getParameter("remove_server_certificate"))) 187 195 { … … 200 208 { 201 209 server.setClientCertificate(clientCertificate); 210 } 211 if (Values.getBoolean(upload.getParameter("remove_ssh_private_key"))) 212 { 213 server.setSshPrivateKey(null); 214 server.setSshPrivateKeyPassword(null); 215 } 216 else if (sshPrivateKey != null && sshPrivateKey.length > 0) 217 { 218 server.setSshPrivateKey(sshPrivateKey); 202 219 } 203 220 -
trunk/www/filemanager/fileservers/view_fileserver.jsp
r7333 r7472 413 413 } 414 414 %> 415 <tr> 416 <th>SSH private key</th> 417 <td><%=server.hasSshPrivateKey() ? "yes (" + Values.getString(server.getSshPrivateKeyFormat(), "<i>- auto -</i>") + ")" : "no"%></td> 418 </tr> 415 419 </table> 416 420 </div>
Note: See TracChangeset
for help on using the changeset viewer.