You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

GitBlitServer.java 21KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594
  1. /*
  2. * Copyright 2011 gitblit.com.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package com.gitblit;
  17. import java.io.BufferedReader;
  18. import java.io.File;
  19. import java.io.IOException;
  20. import java.io.InputStreamReader;
  21. import java.io.OutputStream;
  22. import java.net.InetAddress;
  23. import java.net.ServerSocket;
  24. import java.net.Socket;
  25. import java.net.URI;
  26. import java.net.URL;
  27. import java.net.UnknownHostException;
  28. import java.security.ProtectionDomain;
  29. import java.text.MessageFormat;
  30. import java.util.ArrayList;
  31. import java.util.Date;
  32. import java.util.List;
  33. import java.util.Scanner;
  34. import org.eclipse.jetty.ajp.Ajp13SocketConnector;
  35. import org.eclipse.jetty.server.Connector;
  36. import org.eclipse.jetty.server.Server;
  37. import org.eclipse.jetty.server.bio.SocketConnector;
  38. import org.eclipse.jetty.server.nio.SelectChannelConnector;
  39. import org.eclipse.jetty.server.session.HashSessionManager;
  40. import org.eclipse.jetty.server.ssl.SslConnector;
  41. import org.eclipse.jetty.server.ssl.SslSelectChannelConnector;
  42. import org.eclipse.jetty.server.ssl.SslSocketConnector;
  43. import org.eclipse.jetty.util.ssl.SslContextFactory;
  44. import org.eclipse.jetty.util.thread.QueuedThreadPool;
  45. import org.eclipse.jetty.webapp.WebAppContext;
  46. import org.eclipse.jgit.storage.file.FileBasedConfig;
  47. import org.eclipse.jgit.util.FS;
  48. import org.eclipse.jgit.util.FileUtils;
  49. import org.slf4j.Logger;
  50. import org.slf4j.LoggerFactory;
  51. import com.beust.jcommander.JCommander;
  52. import com.beust.jcommander.Parameter;
  53. import com.beust.jcommander.ParameterException;
  54. import com.beust.jcommander.Parameters;
  55. import com.gitblit.authority.NewCertificateConfig;
  56. import com.gitblit.utils.StringUtils;
  57. import com.gitblit.utils.TimeUtils;
  58. import com.gitblit.utils.X509Utils;
  59. import com.gitblit.utils.X509Utils.X509Metadata;
  60. import com.unboundid.ldap.listener.InMemoryDirectoryServer;
  61. import com.unboundid.ldap.listener.InMemoryDirectoryServerConfig;
  62. import com.unboundid.ldap.listener.InMemoryListenerConfig;
  63. import com.unboundid.ldif.LDIFReader;
  64. /**
  65. * GitBlitServer is the embedded Jetty server for Gitblit GO. This class starts
  66. * and stops an instance of Jetty that is configured from a combination of the
  67. * gitblit.properties file and command line parameters. JCommander is used to
  68. * simplify command line parameter processing. This class also automatically
  69. * generates a self-signed certificate for localhost, if the keystore does not
  70. * already exist.
  71. *
  72. * @author James Moger
  73. *
  74. */
  75. public class GitBlitServer {
  76. private static Logger logger;
  77. public static void main(String... args) {
  78. Params params = new Params();
  79. JCommander jc = new JCommander(params);
  80. try {
  81. jc.parse(args);
  82. if (params.help) {
  83. usage(jc, null);
  84. }
  85. } catch (ParameterException t) {
  86. usage(jc, t);
  87. }
  88. if (params.stop) {
  89. stop(params);
  90. } else {
  91. start(params);
  92. }
  93. }
  94. /**
  95. * Display the command line usage of Gitblit GO.
  96. *
  97. * @param jc
  98. * @param t
  99. */
  100. private static void usage(JCommander jc, ParameterException t) {
  101. System.out.println(Constants.BORDER);
  102. System.out.println(Constants.getGitBlitVersion());
  103. System.out.println(Constants.BORDER);
  104. System.out.println();
  105. if (t != null) {
  106. System.out.println(t.getMessage());
  107. System.out.println();
  108. }
  109. if (jc != null) {
  110. jc.usage();
  111. System.out
  112. .println("\nExample:\n java -server -Xmx1024M -jar gitblit.jar --repositoriesFolder c:\\git --httpPort 80 --httpsPort 443");
  113. }
  114. System.exit(0);
  115. }
  116. /**
  117. * Stop Gitblt GO.
  118. */
  119. public static void stop(Params params) {
  120. try {
  121. Socket s = new Socket(InetAddress.getByName("127.0.0.1"), params.shutdownPort);
  122. OutputStream out = s.getOutputStream();
  123. System.out.println("Sending Shutdown Request to " + Constants.NAME);
  124. out.write("\r\n".getBytes());
  125. out.flush();
  126. s.close();
  127. } catch (UnknownHostException e) {
  128. e.printStackTrace();
  129. } catch (IOException e) {
  130. e.printStackTrace();
  131. }
  132. }
  133. /**
  134. * Start Gitblit GO.
  135. */
  136. private static void start(Params params) {
  137. FileSettings settings = Params.FILESETTINGS;
  138. if (!StringUtils.isEmpty(params.settingsfile)) {
  139. if (new File(params.settingsfile).exists()) {
  140. settings = new FileSettings(params.settingsfile);
  141. }
  142. }
  143. logger = LoggerFactory.getLogger(GitBlitServer.class);
  144. logger.info(Constants.BORDER);
  145. logger.info(" _____ _ _ _ _ _ _");
  146. logger.info(" | __ \\(_)| | | | | |(_)| |");
  147. logger.info(" | | \\/ _ | |_ | |__ | | _ | |_");
  148. logger.info(" | | __ | || __|| '_ \\ | || || __|");
  149. logger.info(" | |_\\ \\| || |_ | |_) || || || |_");
  150. logger.info(" \\____/|_| \\__||_.__/ |_||_| \\__|");
  151. int spacing = (Constants.BORDER.length() - Constants.getGitBlitVersion().length()) / 2;
  152. StringBuilder sb = new StringBuilder();
  153. while (spacing > 0) {
  154. spacing--;
  155. sb.append(' ');
  156. }
  157. logger.info(sb.toString() + Constants.getGitBlitVersion());
  158. logger.info("");
  159. logger.info(Constants.BORDER);
  160. System.setProperty("java.awt.headless", "true");
  161. String osname = System.getProperty("os.name");
  162. String osversion = System.getProperty("os.version");
  163. logger.info("Running on " + osname + " (" + osversion + ")");
  164. List<Connector> connectors = new ArrayList<Connector>();
  165. // conditionally configure the http connector
  166. if (params.port > 0) {
  167. Connector httpConnector = createConnector(params.useNIO, params.port);
  168. String bindInterface = settings.getString(Keys.server.httpBindInterface, null);
  169. if (!StringUtils.isEmpty(bindInterface)) {
  170. logger.warn(MessageFormat.format("Binding connector on port {0,number,0} to {1}",
  171. params.port, bindInterface));
  172. httpConnector.setHost(bindInterface);
  173. }
  174. if (params.port < 1024 && !isWindows()) {
  175. logger.warn("Gitblit needs to run with ROOT permissions for ports < 1024!");
  176. }
  177. connectors.add(httpConnector);
  178. }
  179. // conditionally configure the https connector
  180. if (params.securePort > 0) {
  181. File folder = new File(System.getProperty("user.dir"));
  182. File certificatesConf = new File(folder, X509Utils.CA_CONFIG);
  183. File serverKeyStore = new File(folder, X509Utils.SERVER_KEY_STORE);
  184. File serverTrustStore = new File(folder, X509Utils.SERVER_TRUST_STORE);
  185. File caRevocationList = new File(folder, X509Utils.CA_REVOCATION_LIST);
  186. // generate CA & web certificates, create certificate stores
  187. X509Metadata metadata = new X509Metadata("localhost", params.storePassword);
  188. // set default certificate values from config file
  189. if (certificatesConf.exists()) {
  190. FileBasedConfig config = new FileBasedConfig(certificatesConf, FS.detect());
  191. try {
  192. config.load();
  193. } catch (Exception e) {
  194. logger.error("Error parsing " + certificatesConf, e);
  195. }
  196. NewCertificateConfig certificateConfig = NewCertificateConfig.KEY.parse(config);
  197. certificateConfig.update(metadata);
  198. }
  199. metadata.notAfter = new Date(System.currentTimeMillis() + 10*TimeUtils.ONEYEAR);
  200. X509Utils.prepareX509Infrastructure(metadata, folder);
  201. if (serverKeyStore.exists()) {
  202. Connector secureConnector = createSSLConnector(serverKeyStore, serverTrustStore, params.storePassword,
  203. caRevocationList, params.useNIO, params.securePort, params.requireClientCertificates);
  204. String bindInterface = settings.getString(Keys.server.httpsBindInterface, null);
  205. if (!StringUtils.isEmpty(bindInterface)) {
  206. logger.warn(MessageFormat.format(
  207. "Binding ssl connector on port {0,number,0} to {1}", params.securePort,
  208. bindInterface));
  209. secureConnector.setHost(bindInterface);
  210. }
  211. if (params.securePort < 1024 && !isWindows()) {
  212. logger.warn("Gitblit needs to run with ROOT permissions for ports < 1024!");
  213. }
  214. connectors.add(secureConnector);
  215. } else {
  216. logger.warn("Failed to find or load Keystore?");
  217. logger.warn("SSL connector DISABLED.");
  218. }
  219. }
  220. // conditionally configure the ajp connector
  221. if (params.ajpPort > 0) {
  222. Connector ajpConnector = createAJPConnector(params.ajpPort);
  223. String bindInterface = settings.getString(Keys.server.ajpBindInterface, null);
  224. if (!StringUtils.isEmpty(bindInterface)) {
  225. logger.warn(MessageFormat.format("Binding connector on port {0,number,0} to {1}",
  226. params.ajpPort, bindInterface));
  227. ajpConnector.setHost(bindInterface);
  228. }
  229. if (params.ajpPort < 1024 && !isWindows()) {
  230. logger.warn("Gitblit needs to run with ROOT permissions for ports < 1024!");
  231. }
  232. connectors.add(ajpConnector);
  233. }
  234. // tempDir is where the embedded Gitblit web application is expanded and
  235. // where Jetty creates any necessary temporary files
  236. File tempDir = new File(params.temp);
  237. if (tempDir.exists()) {
  238. try {
  239. FileUtils.delete(tempDir, FileUtils.RECURSIVE | FileUtils.RETRY);
  240. } catch (IOException x) {
  241. logger.warn("Failed to delete temp dir " + tempDir.getAbsolutePath(), x);
  242. }
  243. }
  244. if (!tempDir.mkdirs()) {
  245. logger.warn("Failed to create temp dir " + tempDir.getAbsolutePath());
  246. }
  247. Server server = new Server();
  248. server.setStopAtShutdown(true);
  249. server.setConnectors(connectors.toArray(new Connector[connectors.size()]));
  250. // Get the execution path of this class
  251. // We use this to set the WAR path.
  252. ProtectionDomain protectionDomain = GitBlitServer.class.getProtectionDomain();
  253. URL location = protectionDomain.getCodeSource().getLocation();
  254. // Root WebApp Context
  255. WebAppContext rootContext = new WebAppContext();
  256. rootContext.setContextPath(settings.getString(Keys.server.contextPath, "/"));
  257. rootContext.setServer(server);
  258. rootContext.setWar(location.toExternalForm());
  259. rootContext.setTempDirectory(tempDir);
  260. // Set cookies HttpOnly so they are not accessible to JavaScript engines
  261. HashSessionManager sessionManager = new HashSessionManager();
  262. sessionManager.setHttpOnly(true);
  263. // Use secure cookies if only serving https
  264. sessionManager.setSecureCookies(params.port <= 0 && params.securePort > 0);
  265. rootContext.getSessionHandler().setSessionManager(sessionManager);
  266. // Ensure there is a defined User Service
  267. String realmUsers = params.userService;
  268. if (StringUtils.isEmpty(realmUsers)) {
  269. logger.error(MessageFormat.format("PLEASE SPECIFY {0}!!", Keys.realm.userService));
  270. return;
  271. }
  272. // Override settings from the command-line
  273. settings.overrideSetting(Keys.realm.userService, params.userService);
  274. settings.overrideSetting(Keys.git.repositoriesFolder, params.repositoriesFolder);
  275. // Start up an in-memory LDAP server, if configured
  276. try {
  277. if (StringUtils.isEmpty(params.ldapLdifFile) == false) {
  278. File ldifFile = new File(params.ldapLdifFile);
  279. if (ldifFile != null && ldifFile.exists()) {
  280. URI ldapUrl = new URI(settings.getRequiredString(Keys.realm.ldap.server));
  281. String firstLine = new Scanner(ldifFile).nextLine();
  282. String rootDN = firstLine.substring(4);
  283. String bindUserName = settings.getString(Keys.realm.ldap.username, "");
  284. String bindPassword = settings.getString(Keys.realm.ldap.password, "");
  285. // Get the port
  286. int port = ldapUrl.getPort();
  287. if (port == -1)
  288. port = 389;
  289. InMemoryDirectoryServerConfig config = new InMemoryDirectoryServerConfig(rootDN);
  290. config.addAdditionalBindCredentials(bindUserName, bindPassword);
  291. config.setListenerConfigs(InMemoryListenerConfig.createLDAPConfig("default", port));
  292. config.setSchema(null);
  293. InMemoryDirectoryServer ds = new InMemoryDirectoryServer(config);
  294. ds.importFromLDIF(true, new LDIFReader(ldifFile));
  295. ds.startListening();
  296. logger.info("LDAP Server started at ldap://localhost:" + port);
  297. }
  298. }
  299. } catch (Exception e) {
  300. // Completely optional, just show a warning
  301. logger.warn("Unable to start LDAP server", e);
  302. }
  303. // Set the server's contexts
  304. server.setHandler(rootContext);
  305. // Setup the GitBlit context
  306. GitBlit gitblit = GitBlit.self();
  307. gitblit.configureContext(settings, true);
  308. rootContext.addEventListener(gitblit);
  309. try {
  310. // start the shutdown monitor
  311. if (params.shutdownPort > 0) {
  312. Thread shutdownMonitor = new ShutdownMonitorThread(server, params);
  313. shutdownMonitor.start();
  314. }
  315. // start Jetty
  316. server.start();
  317. server.join();
  318. } catch (Exception e) {
  319. e.printStackTrace();
  320. System.exit(100);
  321. }
  322. }
  323. /**
  324. * Creates an http connector.
  325. *
  326. * @param useNIO
  327. * @param port
  328. * @return an http connector
  329. */
  330. private static Connector createConnector(boolean useNIO, int port) {
  331. Connector connector;
  332. if (useNIO) {
  333. logger.info("Setting up NIO SelectChannelConnector on port " + port);
  334. SelectChannelConnector nioconn = new SelectChannelConnector();
  335. nioconn.setSoLingerTime(-1);
  336. nioconn.setThreadPool(new QueuedThreadPool(20));
  337. connector = nioconn;
  338. } else {
  339. logger.info("Setting up SocketConnector on port " + port);
  340. SocketConnector sockconn = new SocketConnector();
  341. connector = sockconn;
  342. }
  343. connector.setPort(port);
  344. connector.setMaxIdleTime(30000);
  345. return connector;
  346. }
  347. /**
  348. * Creates an https connector.
  349. *
  350. * SSL renegotiation will be enabled if the JVM is 1.6.0_22 or later.
  351. * oracle.com/technetwork/java/javase/documentation/tlsreadme2-176330.html
  352. *
  353. * @param keyStore
  354. * @param clientTrustStore
  355. * @param storePassword
  356. * @param caRevocationList
  357. * @param useNIO
  358. * @param port
  359. * @param requireClientCertificates
  360. * @return an https connector
  361. */
  362. private static Connector createSSLConnector(File keyStore, File clientTrustStore,
  363. String storePassword, File caRevocationList, boolean useNIO, int port,
  364. boolean requireClientCertificates) {
  365. SslContextFactory sslContext = new SslContextFactory(SslContextFactory.DEFAULT_KEYSTORE_PATH);
  366. SslConnector connector;
  367. if (useNIO) {
  368. logger.info("Setting up NIO SslSelectChannelConnector on port " + port);
  369. SslSelectChannelConnector ssl = new SslSelectChannelConnector(sslContext);
  370. ssl.setSoLingerTime(-1);
  371. if (requireClientCertificates) {
  372. sslContext.setNeedClientAuth(true);
  373. } else {
  374. sslContext.setWantClientAuth(true);
  375. }
  376. ssl.setThreadPool(new QueuedThreadPool(20));
  377. connector = ssl;
  378. } else {
  379. logger.info("Setting up NIO SslSocketConnector on port " + port);
  380. SslSocketConnector ssl = new SslSocketConnector(sslContext);
  381. connector = ssl;
  382. }
  383. // disable renegotiation unless this is a patched JVM
  384. boolean allowRenegotiation = false;
  385. String v = System.getProperty("java.version");
  386. if (v.startsWith("1.7")) {
  387. allowRenegotiation = true;
  388. } else if (v.startsWith("1.6")) {
  389. // 1.6.0_22 was first release with RFC-5746 implemented fix.
  390. if (v.indexOf('_') > -1) {
  391. String b = v.substring(v.indexOf('_') + 1);
  392. if (Integer.parseInt(b) >= 22) {
  393. allowRenegotiation = true;
  394. }
  395. }
  396. }
  397. if (allowRenegotiation) {
  398. logger.info(" allowing SSL renegotiation on Java " + v);
  399. sslContext.setAllowRenegotiate(allowRenegotiation);
  400. }
  401. sslContext.setKeyStorePath(keyStore.getAbsolutePath());
  402. sslContext.setKeyStorePassword(storePassword);
  403. sslContext.setTrustStore(clientTrustStore.getAbsolutePath());
  404. sslContext.setTrustStorePassword(storePassword);
  405. sslContext.setCrlPath(caRevocationList.getAbsolutePath());
  406. connector.setPort(port);
  407. connector.setMaxIdleTime(30000);
  408. return connector;
  409. }
  410. /**
  411. * Creates an ajp connector.
  412. *
  413. * @param port
  414. * @return an ajp connector
  415. */
  416. private static Connector createAJPConnector(int port) {
  417. logger.info("Setting up AJP Connector on port " + port);
  418. Ajp13SocketConnector ajp = new Ajp13SocketConnector();
  419. ajp.setPort(port);
  420. if (port < 1024 && !isWindows()) {
  421. logger.warn("Gitblit needs to run with ROOT permissions for ports < 1024!");
  422. }
  423. return ajp;
  424. }
  425. /**
  426. * Tests to see if the operating system is Windows.
  427. *
  428. * @return true if this is a windows machine
  429. */
  430. private static boolean isWindows() {
  431. return System.getProperty("os.name").toLowerCase().indexOf("windows") > -1;
  432. }
  433. /**
  434. * The ShutdownMonitorThread opens a socket on a specified port and waits
  435. * for an incoming connection. When that connection is accepted a shutdown
  436. * message is issued to the running Jetty server.
  437. *
  438. * @author James Moger
  439. *
  440. */
  441. private static class ShutdownMonitorThread extends Thread {
  442. private final ServerSocket socket;
  443. private final Server server;
  444. private final Logger logger = LoggerFactory.getLogger(ShutdownMonitorThread.class);
  445. public ShutdownMonitorThread(Server server, Params params) {
  446. this.server = server;
  447. setDaemon(true);
  448. setName(Constants.NAME + " Shutdown Monitor");
  449. ServerSocket skt = null;
  450. try {
  451. skt = new ServerSocket(params.shutdownPort, 1, InetAddress.getByName("127.0.0.1"));
  452. } catch (Exception e) {
  453. logger.warn("Could not open shutdown monitor on port " + params.shutdownPort, e);
  454. }
  455. socket = skt;
  456. }
  457. @Override
  458. public void run() {
  459. logger.info("Shutdown Monitor listening on port " + socket.getLocalPort());
  460. Socket accept;
  461. try {
  462. accept = socket.accept();
  463. BufferedReader reader = new BufferedReader(new InputStreamReader(
  464. accept.getInputStream()));
  465. reader.readLine();
  466. logger.info(Constants.BORDER);
  467. logger.info("Stopping " + Constants.NAME);
  468. logger.info(Constants.BORDER);
  469. server.stop();
  470. server.setStopAtShutdown(false);
  471. accept.close();
  472. socket.close();
  473. } catch (Exception e) {
  474. logger.warn("Failed to shutdown Jetty", e);
  475. }
  476. }
  477. }
  478. /**
  479. * JCommander Parameters class for GitBlitServer.
  480. */
  481. @Parameters(separators = " ")
  482. private static class Params {
  483. private static final FileSettings FILESETTINGS = new FileSettings(Constants.PROPERTIES_FILE);
  484. /*
  485. * Server parameters
  486. */
  487. @Parameter(names = { "-h", "--help" }, description = "Show this help")
  488. public Boolean help = false;
  489. @Parameter(names = { "--stop" }, description = "Stop Server")
  490. public Boolean stop = false;
  491. @Parameter(names = { "--tempFolder" }, description = "Folder for server to extract built-in webapp")
  492. public String temp = FILESETTINGS.getString(Keys.server.tempFolder, "temp");
  493. /*
  494. * GIT Servlet Parameters
  495. */
  496. @Parameter(names = { "--repositoriesFolder" }, description = "Git Repositories Folder")
  497. public String repositoriesFolder = FILESETTINGS.getString(Keys.git.repositoriesFolder,
  498. "repos");
  499. /*
  500. * Authentication Parameters
  501. */
  502. @Parameter(names = { "--userService" }, description = "Authentication and Authorization Service (filename or fully qualified classname)")
  503. public String userService = FILESETTINGS.getString(Keys.realm.userService,
  504. "users.properties");
  505. /*
  506. * JETTY Parameters
  507. */
  508. @Parameter(names = { "--useNio" }, description = "Use NIO Connector else use Socket Connector.")
  509. public Boolean useNIO = FILESETTINGS.getBoolean(Keys.server.useNio, true);
  510. @Parameter(names = "--httpPort", description = "HTTP port for to serve. (port <= 0 will disable this connector)")
  511. public Integer port = FILESETTINGS.getInteger(Keys.server.httpPort, 80);
  512. @Parameter(names = "--httpsPort", description = "HTTPS port to serve. (port <= 0 will disable this connector)")
  513. public Integer securePort = FILESETTINGS.getInteger(Keys.server.httpsPort, 443);
  514. @Parameter(names = "--ajpPort", description = "AJP port to serve. (port <= 0 will disable this connector)")
  515. public Integer ajpPort = FILESETTINGS.getInteger(Keys.server.ajpPort, 0);
  516. @Parameter(names = "--storePassword", description = "Password for SSL (https) keystore.")
  517. public String storePassword = FILESETTINGS.getString(Keys.server.storePassword, "");
  518. @Parameter(names = "--shutdownPort", description = "Port for Shutdown Monitor to listen on. (port <= 0 will disable this monitor)")
  519. public Integer shutdownPort = FILESETTINGS.getInteger(Keys.server.shutdownPort, 8081);
  520. @Parameter(names = "--requireClientCertificates", description = "Require client X509 certificates for https connections.")
  521. public Boolean requireClientCertificates = FILESETTINGS.getBoolean(Keys.server.requireClientCertificates, false);
  522. /*
  523. * Setting overrides
  524. */
  525. @Parameter(names = { "--settings" }, description = "Path to alternative settings")
  526. public String settingsfile;
  527. @Parameter(names = { "--ldapLdifFile" }, description = "Path to LDIF file. This will cause an in-memory LDAP server to be started according to gitblit settings")
  528. public String ldapLdifFile;
  529. }
  530. }