strelaysrv.1 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. .\" Man page generated from reStructuredText.
  2. .
  3. .TH "STRELAYSRV" "1" "July 24, 2016" "v0.14" "Syncthing"
  4. .SH NAME
  5. strelaysrv \- Syncthing Relay Server
  6. .
  7. .nr rst2man-indent-level 0
  8. .
  9. .de1 rstReportMargin
  10. \\$1 \\n[an-margin]
  11. level \\n[rst2man-indent-level]
  12. level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
  13. -
  14. \\n[rst2man-indent0]
  15. \\n[rst2man-indent1]
  16. \\n[rst2man-indent2]
  17. ..
  18. .de1 INDENT
  19. .\" .rstReportMargin pre:
  20. . RS \\$1
  21. . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
  22. . nr rst2man-indent-level +1
  23. .\" .rstReportMargin post:
  24. ..
  25. .de UNINDENT
  26. . RE
  27. .\" indent \\n[an-margin]
  28. .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
  29. .nr rst2man-indent-level -1
  30. .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
  31. .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
  32. ..
  33. .SH SYNOPSIS
  34. .INDENT 0.0
  35. .INDENT 3.5
  36. .sp
  37. .nf
  38. .ft C
  39. strelaysrv [\-debug] [\-ext\-address=<address>] [\-global\-rate=<bytes/s>] [\-keys=<dir>] [\-listen=<listen addr>]
  40. [\-message\-timeout=<duration>] [\-network\-timeout=<duration>] [\-per\-session\-rate=<bytes/s>]
  41. [\-ping\-interval=<duration>] [\-pools=<pool addresses>] [\-provided\-by=<string>] [\-status\-srv=<listen addr>]
  42. .ft P
  43. .fi
  44. .UNINDENT
  45. .UNINDENT
  46. .SH DESCRIPTION
  47. .sp
  48. Syncthing relies on a network of community\-contributed relay servers. Anyone
  49. can run a relay server, and it will automatically join the relay pool and be
  50. available to Syncthing users. The current list of relays can be found at
  51. \fI\%https://relays.syncthing.net\fP\&.
  52. .SH OPTIONS
  53. .INDENT 0.0
  54. .TP
  55. .B \-debug
  56. Enable debug output.
  57. .UNINDENT
  58. .INDENT 0.0
  59. .TP
  60. .B \-ext\-address=<address>
  61. An optional address to advertising as being available on. Allows listening
  62. on an unprivileged port with port forwarding from e.g. 443, and be
  63. connected to on port 443.
  64. .UNINDENT
  65. .INDENT 0.0
  66. .TP
  67. .B \-global\-rate=<bytes/s>
  68. Global rate limit, in bytes/s.
  69. .UNINDENT
  70. .INDENT 0.0
  71. .TP
  72. .B \-keys=<dir>
  73. Directory where cert.pem and key.pem is stored (default ".").
  74. .UNINDENT
  75. .INDENT 0.0
  76. .TP
  77. .B \-listen=<listen addr>
  78. Protocol listen address (default ":22067").
  79. .UNINDENT
  80. .INDENT 0.0
  81. .TP
  82. .B \-message\-timeout=<duration>
  83. Maximum amount of time we wait for relevant messages to arrive (default 1m0s).
  84. .UNINDENT
  85. .INDENT 0.0
  86. .TP
  87. .B \-network\-timeout=<duration>
  88. Timeout for network operations between the client and the relay. If no data
  89. is received between the client and the relay in this period of time, the
  90. connection is terminated. Furthermore, if no data is sent between either
  91. clients being relayed within this period of time, the session is also
  92. terminated. (default 2m0s)
  93. .UNINDENT
  94. .INDENT 0.0
  95. .TP
  96. .B \-per\-session\-rate=<bytes/s>
  97. Per session rate limit, in bytes/s.
  98. .UNINDENT
  99. .INDENT 0.0
  100. .TP
  101. .B \-ping\-interval=<duration>
  102. How often pings are sent (default 1m0s).
  103. .UNINDENT
  104. .INDENT 0.0
  105. .TP
  106. .B \-pools=<pool addresses>
  107. Comma separated list of relay pool addresses to join (default
  108. "\fI\%https://relays.syncthing.net/endpoint\fP"). Blank to disable announcement to
  109. a pool, thereby remaining a private relay.
  110. .UNINDENT
  111. .INDENT 0.0
  112. .TP
  113. .B \-provided\-by=<string>
  114. An optional description about who provides the relay.
  115. .UNINDENT
  116. .INDENT 0.0
  117. .TP
  118. .B \-status\-srv=<listen addr>
  119. Listen address for status service (blank to disable) (default ":22070").
  120. .UNINDENT
  121. .SH SETTING UP
  122. .sp
  123. Primarily, you need to decide on a directory to store the TLS key and
  124. certificate and a listen port. The default listen port of 22067 works, but for
  125. optimal compatibility a well known port for encrypted traffic such as 443 is
  126. recommended. This may require additional setup to work without running
  127. as root or a privileged user, see \fI\%Running on port 443 as an unprivileged user\fP
  128. below. In principle something similar to this should work on a Linux/Unix
  129. system:
  130. .INDENT 0.0
  131. .INDENT 3.5
  132. .sp
  133. .nf
  134. .ft C
  135. $ sudo useradd relaysrv
  136. $ sudo mkdir /etc/relaysrv
  137. $ sudo chown relaysrv /etc/relaysrv
  138. $ sudo \-u relaysrv /usr/local/bin/relaysrv \-keys /etc/relaysrv
  139. .ft P
  140. .fi
  141. .UNINDENT
  142. .UNINDENT
  143. .sp
  144. This creates a user \fBrelaysrv\fP and a directory \fB/etc/relaysrv\fP to store
  145. the keys. The keys are generated on first startup. The relay will join the
  146. global relay pool, unless a \fB\-pools=""\fP argument is given.
  147. .sp
  148. To make the relay server start automatically at boot, use the recommended
  149. procedure for your operating system.
  150. .SS Running on port 443 as an unprivileged user
  151. .sp
  152. It is recommended that you run the relay on port 443 (or another port which is
  153. commonly allowed through corporate firewalls), in order to maximise the chances
  154. that people are able to connect. However, binding to ports below 1024 requires
  155. root privileges, and running a relay as root is not recommended. Thankfully
  156. there are a couple of approaches available to you.
  157. .sp
  158. One option is to run the relay on port 22067, and use an \fBiptables\fP rule
  159. to forward traffic from port 443 to port 22067, for example:
  160. .INDENT 0.0
  161. .INDENT 3.5
  162. .sp
  163. .nf
  164. .ft C
  165. iptables \-t nat \-A PREROUTING \-i eth0 \-p tcp \-\-dport 443 \-j REDIRECT \-\-to\-port 22067
  166. .ft P
  167. .fi
  168. .UNINDENT
  169. .UNINDENT
  170. .sp
  171. Or, if you\(aqre using \fBufw\fP, add the following to \fB/etc/ufw/before.rules\fP:
  172. .INDENT 0.0
  173. .INDENT 3.5
  174. .sp
  175. .nf
  176. .ft C
  177. *nat
  178. :PREROUTING ACCEPT [0:0]
  179. :POSTROUTING ACCEPT [0:0]
  180. \-A PREROUTING \-i eth0 \-p tcp \-\-dport 443 \-j REDIRECT \-\-to\-port 22067
  181. COMMIT
  182. .ft P
  183. .fi
  184. .UNINDENT
  185. .UNINDENT
  186. .sp
  187. You will need to start \fBrelaysrv\fP with \fB\-ext\-address ":443"\fP\&. This tells
  188. \fBrelaysrv\fP that it can be contacted on port 443, even though it is listening
  189. on port 22067. You will also need to let both port 443 and 22067 through your
  190. firewall.
  191. .sp
  192. Another option is \fI\%described here\fP <\fBhttps://wiki.apache.org/httpd/NonRootPortBinding\fP>,
  193. although your milage may vary.
  194. .SH SEE ALSO
  195. .sp
  196. \fIsyncthing\-relay(7)\fP, \fIsyncthing\-faq(7)\fP,
  197. \fIsyncthing\-networking(7)\fP
  198. .SH AUTHOR
  199. The Syncthing Authors
  200. .SH COPYRIGHT
  201. 2015, The Syncthing Authors
  202. .\" Generated by docutils manpage writer.
  203. .