Mercurial Hosting > luan
comparison src/goodjava/lucene/backup/BackupServer.java @ 1506:d80395468b4e
ssl security in code
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 15 May 2020 18:29:47 -0600 |
parents | 8a7b6b32c691 |
children | 0ba144491a42 |
comparison
equal
deleted
inserted
replaced
1505:01e38174d580 | 1506:d80395468b4e |
---|---|
5 import java.util.Map; | 5 import java.util.Map; |
6 import java.net.Socket; | 6 import java.net.Socket; |
7 import java.net.ServerSocket; | 7 import java.net.ServerSocket; |
8 import java.util.concurrent.Executors; | 8 import java.util.concurrent.Executors; |
9 import java.util.concurrent.ExecutorService; | 9 import java.util.concurrent.ExecutorService; |
10 import javax.net.ssl.SSLServerSocketFactory; | |
11 import javax.net.ssl.SSLServerSocket; | 10 import javax.net.ssl.SSLServerSocket; |
12 import goodjava.util.SoftCacheMap; | 11 import goodjava.util.SoftCacheMap; |
13 import goodjava.io.IoUtils; | 12 import goodjava.io.IoUtils; |
14 import goodjava.rpc.RpcServer; | 13 import goodjava.rpc.RpcServer; |
15 import goodjava.rpc.RpcCall; | 14 import goodjava.rpc.RpcCall; |
32 "SSL_DH_anon_WITH_RC4_128_MD5", | 31 "SSL_DH_anon_WITH_RC4_128_MD5", |
33 "SSL_DH_anon_WITH_DES_CBC_SHA", | 32 "SSL_DH_anon_WITH_DES_CBC_SHA", |
34 "SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA", | 33 "SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA", |
35 "SSL_DH_anon_EXPORT_WITH_RC4_40_MD5", | 34 "SSL_DH_anon_EXPORT_WITH_RC4_40_MD5", |
36 }; | 35 }; |
37 static { | |
38 cipherSuites = null; // for now, until I figure out disgusting java security | |
39 } | |
40 | 36 |
41 private final File backupDir; | 37 private final File backupDir; |
42 private static final ExecutorService threadPool = Executors.newCachedThreadPool(); | 38 private static final ExecutorService threadPool = Executors.newCachedThreadPool(); |
43 private static final Map<String,Backup> backups = new SoftCacheMap<String,Backup>(); | 39 private static final Map<String,Backup> backups = new SoftCacheMap<String,Backup>(); |
44 | 40 |
50 public synchronized void start() throws IOException { | 46 public synchronized void start() throws IOException { |
51 final ServerSocket ss; | 47 final ServerSocket ss; |
52 if( cipherSuites == null ) { | 48 if( cipherSuites == null ) { |
53 ss = new ServerSocket(port); | 49 ss = new ServerSocket(port); |
54 } else { | 50 } else { |
55 ss = SSLServerSocketFactory.getDefault().createServerSocket(port); | 51 ss = IoUtils.getSSLServerSocketFactory().createServerSocket(port); |
56 ((SSLServerSocket)ss).setEnabledCipherSuites(cipherSuites); | 52 ((SSLServerSocket)ss).setEnabledCipherSuites(cipherSuites); |
57 } | 53 } |
58 threadPool.execute(new Runnable(){public void run() { | 54 threadPool.execute(new Runnable(){public void run() { |
59 try { | 55 try { |
60 while(!threadPool.isShutdown()) { | 56 while(!threadPool.isShutdown()) { |