Compare commits

..

No commits in common. "rawhide" and "f38" have entirely different histories.

9 changed files with 8061 additions and 53 deletions

1
.gitignore vendored
View file

@ -1 +0,0 @@
/ssh-connect-1.105.tar.gz

39
INSTALL.md Normal file
View file

@ -0,0 +1,39 @@
# connect-proxy
Make socket connection using SOCKS4/5, telnet HTTP or HTTPS tunnel.
*************************************************************************
QUICK START:
Unix:
gcc -o connect connect.c -lssl -lcrypto
*************************************************************************
The development version can be found here:
https://github.com/jjkeijser/connect-proxy/
How To Compile
==============
On Linux/UNIX environment:
gcc -o connect connect.c -lssl -lcrypto
Or using a specific OpenSSL installation:
gcc -o connect connect.c -I../openssl-1.1.1g/include
-L../openssl-1.1.1g -lssl -lcrypto
The default CA certificate file is the RHEL/CentOS/Fedora default:
/etc/pki/tls/certs/ca-bundle.crt
You can specify an alternative location using
gcc -o connect connect.c -D__DEFAULT_CA_PATH__=\"/some/path\"
-lssl -lcrypto
(mind the quotes!)

153
README.md Normal file
View file

@ -0,0 +1,153 @@
# connect-proxy
Make socket connection using SOCKS4/5, telnet HTTP or HTTPS tunnel.
Based on connect.c from Shun-ichi GOTO <gotoh@taiyo.co.jp>
* Added HTTPS proxy support
* Made code gcc-9 and valgrind clean
How To Compile
==============
On Linux/UNIX environment:
$ gcc connect.c -o connect -lssl -lcrypto
How To Use
==========
* You can specify proxy method in an environment variable or in a command line option.
* usage:
/connect [-dnhstx45] [-p local-port][-R resolve] [-w timeout]
[-S [user@]socks-server[:port]]
[-H [user@]proxy-server[:port]]
[-T proxy-server[:port] [-c telnet-proxy-command]
[-X [user@]proxy-server[:port]]
[--help]
[--socks-server [user@]socks-server[:port]]
[--http-proxy [user@]proxy-server[:port]]
[--telnet-proxy proxy-server[:port]
[--https-proxy [user@]proxy-server[:port]]
[--https-proxy-ca PEM format file of CA's]
[--https-proxy-ca-path PEM format directory of CA's]
[--https-proxy-certname name]
[--https-user-cert certfile.pem]
[--https-user-key keyfile.pem]
[--no-check-certificate]
host port
* "host" and "port" is for the target hostname and port-number to connect to.
* The '-H' or '--http-proxy' option specifies a hostname and port number of the http proxy server to
relay. If port is omitted, 80 is used. You can specify this value in the environment variable
HTTP_PROXY and pass the '-h' option to use it.
* The '-X' or '--https-proxy' option specifies a hostname and port number of the https proxy server to
relay. If port is omitted, 443 is used. You can specify this value in the environment variable
HTTPS_PROXY and pass the '-x' option to use it.
* The '-S' or '--socks-proxy' option specifies the hostname and port number of the SOCKS server to
relay. Like '-H', port number can be omitted and the default is 1080. You can also specify this
value pair in the environment variable SOCKS5_SERVER and give the '-s' option to use it.
* The '-4' and the '-5' options are for specifying SOCKS relaying and indicates protocol version
to use. It is valid only when used with '-s' or '-S'. Default is '-5' (protocol version 5)
* The '-R' option is for specifying method to resolve the hostname. Three keywords ("local",
"remote", "both") or dot-notation IP address are acceptable. The keyword "both" means, "Try local
first, then remote". If a dot-notation IP address is specified, use this host as nameserver. The
default is "remote" for SOCKS5 or "local" for others. On SOCKS4 protocol, remote resolving method
("remote" and "both") requires protocol 4a supported server.
* The '-p' option will forward a local TCP port instead of using the standard input and output.
* The '-P' option is same to '-p' except keep remote session. The program repeats waiting the port
with holding remote session without
disconnecting. To disconnect the remote session, send EOF to stdin or kill the program.
* The '-w' option specifys timeout seconds for making connection with TARGET host.
* The '-d' option is used for debug. If you fail to connect, use this and check request to and
response from server.
You can omit the "port" argument when program name is special format containing port number
itself. For example,
$ ln -s connect connect-25
means this connect-25 command is spcifying port number 25 already so you need not 2nd argument
(and ignored if specified).
* To use proxy, this example is for SOCKS5 connection to connect to 'host' at port 25 via SOCKS5
server on 'firewall' host.
$ connect -S firewall host 25
or
$ SOCKS5_SERVER=firewall; export SOCKS5_SERVER
$ connect -s host 25
* For a HTTP-PROXY connection:
$ connect -H proxy-server:8080 host 25
or
$ HTTP_PROXY=proxy-server:8080; export HTTP_PROXY
$ connect -h host 25
* For a HTTPS-PROXY connection:
$ connect -H proxy-server:443 host 25
or
$ HTTPS_PROXY=proxy-server:443; export HTTPS_PROXY
$ connect -x host 25
TIPS
====
* Connect.c doesn't have any configuration to specify the SOCKS server.
If you are a mobile user, this limitation might bother you. However,
You can compile connect.c and link with other standard SOCKS library
like the NEC SOCKS5 library or Dante. This means connect.c is
socksified and uses a configration file like to other SOCKSified
network commands and you can switch configuration file any time
(ex. when ppp startup) that brings you switching of SOCKS server for
connect.c in same way with other commands. For this case, you can
write ~/.ssh/config like this:
ProxyCommand connect -n %h %p
SOCKS5 authentication
=====================
* Only USER/PASS authentication is supported.
HTTP Proxy authentication
=========================
* Only BASIC scheme is supported.
HTTPS proxy authentication
==========================
* BASIC scheme is supported.
* The server certificate can be verified against a CA certificate (or list of CA
certficates) by specifying either '--https-ca-file' or '--https-ca-path'.
(default file: /etc/pki/tls/certs/ca-bundle.crt).
* By default, the server certificate name (/CN=...) is checked against the hostname
of the https_proxy server. It is possible to specify an alternative name using
'--http-proxy-certname'.
* You can disable server certificate verification by specifying '--no-certificate-check'.
* Certificate based authentication is supported. Use the '--https-user-cert' and
'--https-user-key' parameters to specify the user certificate and key. If the private
key is protected using a passphrase, the $SSH_ASKPASS program will be used to query the user.
The following environment variables can be used to specify the above parameters:
* HTTPS proxy server: $HTTPS_PROXY
* proxy user: $HTTPS_PROXY_USER
* proxy password: $HTTPS_PROXY_PASSWORD
* server certificate name: $HTTPS_PROXY_CERTNAME
* CA certificate name: $HTTPS_PROXY_CA_FILE
* CA certificate path: $HTTPS_PROXY_CA_PATH
* client certificate file: $HTTPS_PROXY_USERCERT
* client privatekey file: $HTTPS_PROXY_USERKEY
Authentication information
==========================
The User name for authentication is specifed by an environment variable or system login name. And
password is specified from environment variable or external program (specified in $SSH_ASKPASS) or
tty.
The following environment variable is used for specifying user name.
- SOCKS: $SOCKS5_USER, $LOGNAME, $USER
- HTTP Proxy: $HTTP_PROXY_USER, $LOGNAME, $USER
- HTTPS Proxy: $HTTPS_PROXY_USER, $LOGNAME, $USER
ssh-askpass support
===================
You can use ssh-askpass (came from OpenSSH or else) to specify password on graphical environment
(X-Window or MS Windows). To use this, set program name to environment variable SSH_ASKPASS. On
UNIX, X-Window must be required, so $DISPLAY environment variable is also needed. On Win32
environment, $DISPLAY is not mentioned.

2983
connect-1.100.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,11 +0,0 @@
--- a/connect.c 2024-05-17 09:06:35.176046528 +0200
+++ b/connect.c 2024-05-17 09:02:00.234749758 +0200
@@ -2822,7 +2822,7 @@
int connection;
struct sockaddr_in name;
struct sockaddr client;
- SOCKLEN_T socklen;
+ socklen_t socklen;
fd_set ifds;
int nfds;
int sockopt;

View file

@ -1,22 +1,20 @@
Name: connect-proxy
Version: 1.105
Release: 5%{?dist}
Version: 1.100
Release: 28%{?dist}
Summary: SSH Proxy command helper
# Automatically converted from old format: GPLv2+ - review is highly recommended.
License: GPL-2.0-or-later
License: GPLv2+
URL: http://www.taiyo.co.jp/~gotoh/ssh/connect.html
Source0: ssh-connect-%{version}.tar.gz
Source0: connect-%{version}.c
# Real source listed below, it was renamed for sanity's sake
#Source0: https://github.com/gotoh/ssh-connect/archive/refs/tags/1.105-tar.gz
Source1: connect-proxy.1
Patch0: connect-proxy-1.105-socklen.patch
#Source0: http://www.taiyo.co.jp/~gotoh/ssh/connect.c
Source1: http://www.taiyo.co.jp/~gotoh/ssh/connect.html
Patch0: connect-proxy-make-man.patch
Requires: openssh
BuildRequires: gcc
BuildRequires: make
BuildRequires: add-determinism
BuildRequires: make
%description
connect-proxy is the simple relaying command to make network connection via
SOCKS and https proxy. It is mainly intended to be used as proxy command
@ -32,49 +30,28 @@ Features of connect-proxy are:
* You can also relay local socket stream instead of standard I/O.
%prep
%setup -q -n ssh-connect-%{version}
%patch -P 0 -p1
#setup -q -T -c -n %{name}-%{version}
%setup -q -T -c
cp %{SOURCE0} connect.c
cp %{SOURCE1} .
%patch0 -p1
%build
make CFLAGS="$RPM_OPT_FLAGS" %{?_smp_mflags}
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/%{_bindir}
cp connect $RPM_BUILD_ROOT/%{_bindir}/connect-proxy
mkdir -p $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT install
mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1
cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_mandir}/man1/
cp -p %{name}.1 $RPM_BUILD_ROOT%{_mandir}/man1/
%files
%doc doc/manual.html
%doc connect.html
%{_mandir}/man1/*
%{_bindir}/%{name}
%changelog
* Wed Jul 23 2025 Fedora Release Engineering <releng@fedoraproject.org> - 1.105-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
* Thu Jan 16 2025 Fedora Release Engineering <releng@fedoraproject.org> - 1.105-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
* Thu Jul 25 2024 Miroslav Suchý <msuchy@redhat.com> - 1.105-3
- convert license to SPDX
* Wed Jul 17 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.105-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
* Fri May 17 2024 Timotheus Pokorra <timotheus.pokorra@solidcharity.com> - 1.105-1
- Update to upstream 1.105
* Wed Jan 24 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.100-31
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Fri Jan 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.100-30
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Wed Jul 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.100-29
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.100-28
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

3727
connect.c Normal file

File diff suppressed because it is too large Load diff

1142
connect.html Normal file

File diff suppressed because it is too large Load diff

View file

@ -1 +0,0 @@
SHA512 (ssh-connect-1.105.tar.gz) = f49001043a8ffbda3823d0ea3640cc85536ce3d23302fd4d704d8a520f99271a2ed66fda11a5402382edc1dcf874988339ebcaf1d6335249a8dd2a8b4ae965a3