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.

303 lines
11 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. about
  2. -----
  3. socat is a relay for bidirectional data transfer between two independent data
  4. channels. Each of these data channels may be a file, pipe, device (serial line
  5. etc. or a pseudo terminal), a socket (UNIX, IP4, IP6 - raw, UDP, TCP), an
  6. SSL socket, proxy CONNECT connection, a file descriptor (stdin etc.), the GNU
  7. line editor (readline), a program, or a combination of two of these.
  8. These modes include generation of "listening" sockets, named pipes, and pseudo
  9. terminals.
  10. socat can be used, e.g., as TCP port forwarder (one-shot or daemon), as an
  11. external socksifier, for attacking weak firewalls, as a shell interface to UNIX
  12. sockets, IP6 relay, for redirecting TCP oriented programs to a serial line, to
  13. logically connect serial lines on different computers, or to establish a
  14. relatively secure environment (su and chroot) for running client or server
  15. shell scripts with network connections.
  16. Many options are available to refine socats behaviour:
  17. terminal parameters, open() options, file permissions, file and process owners,
  18. basic socket options like bind address, advanced socket options like IP source
  19. routing, linger, TTL, TOS (type of service), or TCP performance tuning.
  20. More capabilities, like daemon mode with forking, client address check,
  21. "tail -f" mode, some stream data processing (line terminator conversion),
  22. choosing sockets, pipes, or ptys for interprocess communication, debug and
  23. trace options, logging to syslog, stderr or file, and last but not least
  24. precise error messages make it a versatile tool for many different purposes.
  25. In fact, many of these features already exist in specialized tools; but until
  26. now, there does not seem to exists another tool that provides such a generic,
  27. flexible, simple and almost comprehensive (UNIX) byte stream connector.
  28. packages
  29. --------
  30. before bothering with compilers, dependencies and include files, you might
  31. try to get a binary distribution that matches your platform. Have a look at
  32. the projects home page for actual information regarding socat binary
  33. distributions.
  34. platforms
  35. ---------
  36. socat 1.7.0 was compiled and more or less successfully tested under the
  37. following operating systems:
  38. Debian lenny/sid on x86, kernel 2.6.24
  39. FreeBSD 6.1 on x86
  40. NetBSD 4.0 on x86
  41. OpenBSD 4.3 on x86
  42. OpenSolaris 10 on x86 with gcc
  43. Mac OS X 10.5.5 on iMac G5, with libreadline
  44. HP-UX 11.23
  45. AIX 5.3 on 64bit Power4 with gcc
  46. Cygwin 1.5.25 on i686
  47. tests on Tru64 can no longer be performed because HP testdrive has taken down
  48. these hosts.
  49. Some versions of socat have been reported to successfully compile under older
  50. Linux versions back to RedHat 2.1 (kernel 1.2.13, gcc 2.7.0), under AIX 4.1 and
  51. 4.3, SunOS 5.7-5.8, FreeBSD 4.2 - 4.9, MacOS X 10.1, Cygwin, Solaris 8 on x86,
  52. OSR 5.0.6, NetBSD 1.6.1 and 2.0.2, OpenBSD 3.4 and 3.8, Tru64 5.1B, Mac OS X
  53. 10.1-10.2, and HP-UX 11
  54. It might well compile and run under other UNIX like operating systems.
  55. install
  56. -------
  57. Get the tarball and extract it:
  58. tar xzf socat.tar.gz
  59. cd socat-1.7.3.0
  60. ./configure
  61. make
  62. su
  63. make install # installs socat, filan, and procan in /usr/local/bin
  64. For compiling socat, gcc (or egc) is recommended.
  65. If gcc is not available, the configure script will fail to determine
  66. some features; then you'd better begin with one of the Makefiles and config.h's
  67. from the Config directory.
  68. If you have problems with the OpenSSL library, you can apply the option
  69. "--disable-openssl" to configure.
  70. If you have problems with the readline library or (n)curses, you can apply the
  71. option "--disable-readline" to configure.
  72. If you have problems with the tcp wrappers library, you can apply the option
  73. "--disable-libwrap" to configure.
  74. If you still get errors or a tremendous amount of warnings you can exclude
  75. the features for system call tracing and file descriptor analyzing by
  76. applying the options "--disable-sycls --disable-filan" to configure.
  77. You still need the functions vsnprintf and snprintf that are in the GNU libc,
  78. but might not be available with some proprietary libc's.
  79. The configure script looks for headers and libraries of openssl, readline, and
  80. tcp wrappers in the OS'es standard places and in the subdirectories include/
  81. and lib/ of the following places:
  82. /sw/
  83. /usr/local/
  84. /opt/freeware/
  85. /usr/sfw/
  86. and for openssl also in:
  87. /usr/local/ssl/
  88. In case of unexpected behaviour it is important to understand that configure
  89. first searches for the appropriate include file and then expects to find the
  90. library in the associated lib directory. That means, when e.g. a OpenSSL
  91. installation resides under /usr/local and there is a symbolic link from
  92. /usr/include/ssl/ssl.h to /usr/local/ssl/include/ssl/ssl.h, configure will find
  93. the /usr/include/... header and will therefore expect libssl in /usr/lib
  94. instead of /usr/local/...
  95. If configure does not find a header file or library but you know where it is,
  96. you can specify additional search locations, e.g.:
  97. export LIBS="-L$HOME/lib"
  98. export CPPFLAGS="-I$HOME/include"
  99. before running configure and make.
  100. For other operating systems, if socat does not compile without errors, refer to
  101. the file PORTING.
  102. platform specifics - redhat
  103. ---------------------------
  104. Install the following packages before building socat:
  105. tcp_wrappers-devel
  106. readline-devel
  107. openssl-devel
  108. On RedHat Linux 9.0, including openssl/ssl.h might fail due to problems with
  109. the krb5-devel package. configure reacts with disabling openssl integration.
  110. To solve this issue, help cpp to find the krb5.h include file:
  111. CPPFLAGS="-I/usr/kerberos/include" ./configure
  112. platform specifics - aix
  113. ------------------------
  114. The flock() prototype is not available but the function is. Thus, to enable the
  115. socat flock options, run configure and then change in config.h the line
  116. /* #undef HAVE_FLOCK */
  117. to
  118. #define HAVE_FLOCK 1
  119. and continue the build process.
  120. When using the OpenSSL rpm provided by IBM, configure might need the
  121. environment variable setting:
  122. LIBS="-L/opt/freeware/lib"
  123. When using the OpenSSL bundle provided by IBM, egd needs to be installed too
  124. to get enough entropy.
  125. socat compiles not only with gcc, but also with xlc. Just adapt the Makefile:
  126. replace gcc by /usr/vac/bin/xlc and remove gcc specific options
  127. "-Wall -Wno-parentheses".
  128. When linking with the OpenSSL library provided by IBM, errors may occur:
  129. ld: 0711-317 ERROR: Undefined symbol: .__umoddi3
  130. In this case, you need to link with libgcc or compile libcrypt yourself using
  131. xlc, or disable SSL (in config.h, undefine WITH_OPENSSL and recompile)
  132. The score of test.sh can be improved by uncommenting MISCDELAY=1 in this
  133. script.
  134. platform specifics - solaris
  135. ----------------------------
  136. If libreadline or libssl are in a directory not searched by the loader per
  137. default, e.g. /opt/sfw/lib, you must add this directory to $LD_LIBRARY_PATH,
  138. for running both configure and the socat executables, e.g.:
  139. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/sfw/lib
  140. For some shell scripts, it is preferable to have /usr/xpg4/bin at a prominent
  141. position in $PATH.
  142. With the default compiler define _GNU_SOURCE, the CMSG_* macros are not
  143. available, and therefore ancillary messages cannot be used. To enable these try
  144. the following:
  145. After running ./configure, edit Makefile and replace "-D_GNU_SOURCE" with
  146. "-D_XPG4_2 -D__EXTENSIONS__" and run make
  147. platform specifics - hp-ux
  148. --------------------------
  149. Ancillary messages cannot be compiled in with socat: both struct msghdr and
  150. struct cmsghdr are required. Compiling with -D_XOPEN_SOURCE_EXTENDED provides
  151. struct msghdr but disables struct cmsghdr while -D_OPEN_SOURCE disables struct
  152. msghdr but disables struct cmsghdr. Please contact socat development if you
  153. know a solution.
  154. Shutting down the write channel of a UNIX domain socket does not seem to
  155. trigger an EOF on the peer socket. This makes problems with the exec and
  156. system addresses.
  157. This OS provides the type "long long", but not the strtoll() function to read
  158. data into a long long variable.
  159. UNIX domain sockets are only supported with SOCK_STREAM, not with datagrams
  160. (see man 7 unix).
  161. With UDP sockets it seems to happen that the select() call reports available
  162. data (or EOF) but a subsequent read() call hangs.
  163. platform specifics - tru64
  164. --------------------------
  165. When the use of the readline address fails with an error like:
  166. socat: /sbin/loader: Fatal Error: Reference to unresolvable symbol "tgetent" in ".../libreadline.so.4"
  167. and you still want to use shared libraries, try the following workaround:
  168. $ make distclean; LIBS="-static" ./configure
  169. remove the "-static" occurrence in Makefile
  170. $ make
  171. documentation
  172. -------------
  173. These files reside in the doc subdirectory:
  174. socat.1 is the man page, socat.html is the HTML based man page. It is actual,
  175. but describes only the more useful options.
  176. xio.help is an older, but more exact description in text form; with socat
  177. version 1.6.0 it is outdated.
  178. doc/socat-openssltunnel.html is a simple tutorial for a private SSL connection.
  179. doc/socat-multicast.html is a short tutorial for multicast and broadcast
  180. communications.
  181. doc/socat-tun shows how to build a virtual network between two hosts.
  182. socat.1 and socat.html can be generated from socat.yo (which is released with
  183. socat 1.6.0.1 and later) using the yodl document language package. Maintenance
  184. of yodl had been discontinued by its author
  185. (http://www.xs4all.nl/~jantien/yodl/) (there seems to be a revival at
  186. http://yodl.sourceforge.net/ though). For socat, the old version 1.31 is used;
  187. an rpm is still distributed with recent OpenSuSE versions (confirmed for
  188. OpenSuSE 10.1 in suse/i586/yodl-1.31.18-1142.i586.rpm). It appears to install
  189. smoothly also under RedHat Linux. After yodl 1.31 installation, the following
  190. correction must be performed in /usr/share/yodl/shared.yo in two places:
  191. < whenhtml(htmlcommand(<!)ARG1+htmlcommand(>)))
  192. > whenhtml(htmlcommand(<!--)ARG1+htmlcommand(-->)))
  193. license
  194. -------
  195. socat is distributed under the terms of the GNU GPLv2;
  196. except for install-sh, which is copyright MIT, with its own license;
  197. In addition, as a special exception, the copyright holder
  198. gives permission to link the code of this program with
  199. any version of the OpenSSL library which is distributed
  200. under a license identical to that listed in the included
  201. COPYING.OpenSSL file, and distribute linked combinations
  202. including the two. You must obey the GNU General Public
  203. License in all respects for all of the code used other
  204. than OpenSSL. If you modify this file, you may extend this
  205. exception to your version of the file, but you are not
  206. obligated to do so. If you do not wish to do so, delete
  207. this exception statement from your version.
  208. This program is free software; you can redistribute it and/or modify
  209. it under the terms of the GNU General Public License as published by
  210. the Free Software Foundation, version 2 of the License
  211. This program is distributed in the hope that it will be useful,
  212. but WITHOUT ANY WARRANTY; without even the implied warranty of
  213. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  214. GNU General Public License for more details.
  215. You should have received a copy of the GNU General Public License
  216. along with this program; if not, write to the Free Software
  217. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  218. contact
  219. -------
  220. For questions, bug reports, ideas, contributions etc. please contact
  221. socat@dest-unreach.org
  222. For socat source distribution, bug fixes, and latest news see
  223. http://www.dest-unreach.org/socat/
  224. www.socat.org is an alternate site providing the same contents.
  225. public git repository:
  226. git://repo.or.cz/socat.git
  227. http://repo.or.cz/r/socat.git