Skip to content

A STMP Portal/Tunnel using proxies chaining for protocol SMTP.

License

Notifications You must be signed in to change notification settings

Tiloup9291/SMTP-Portal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description

SMTP Portal

The executable Portal of SMTP Portal is a process server or client that operate over the TCP layer of the OSI model in command line. The Portal will output debug data receive through the sockets stripped from the bottom OSI layer header to STDOUT. The Portal act as a couple of proxies chaining. You must start a process on a remote computer acting has the whitehole (output). You must also start a process on a local computer acting has the blackhole (input). Both processes (blackhole and whitehole) will share data between the wormhole. The SMTP client connect to the blackhole, the blackhole connect to the whitehole and the whitehole reach the MX/MTA server. The executable gives you the possibility to bind to an IPv4 or IPv6 address, if none is specify, it will bind to ANY. You can also specify the port you wish to connect the process. You have access to an help option and a usage option. Finally, you can output the license.

The source used the most of the standard libraries, ANSI C compatible.

Installation

Here how to build main.c with gcc (developped with gcc v14.1.1):

gcc -Wall -flto -O2 -Wextra -Wall -Wpedantic -D_FORTIFY_SOURCE=2 -fdata-sections -ffunction-sections -Wl,-z,relro,-z,now -fsanitize=address -fPIE -pie -fstack-protector-strong -fcf-protection=full -mshstk  -c /path/to/main.c -o path/to/store/main.o
gcc  -o path/to/store/Portal path/to/get/main.o  -O2 -flto -s -lresolv

Alternately, you can use the Makefile. Here are the available flags and their initial value :

CC=gcc
CFLAGS=-O2 -flto -s -lresolv
LDFLAGS=-Wall -flto -O2 -Wextra -Wall -Wpedantic -D_FORTIFY_SOURCE=2 -fdata-sections -ffunction-sections -Wl,-z,relro,-z,now -fsanitize=address -fPIE -pie -fstack-protector-strong -fcf-protection=full -mshstk
PREFIX = /usr
EXEC_PREFIX = $(PREFIX)
BINDIR = $(EXEC_PREFIX)/bin

To build the object file and executable :

make or make all or make build or make Portal

To install (copy) the executable in a common binaries folder :

make install

To remove the object file :

make clean

Usage

Example of usage: Case of remote MTA server, with remote whitehole, local blackhole and local SMTP client. We are using postfix. Be sure to set the /etc/postfix/main.cf setting : relayhost= to the address of the blackhole. (ex. : relayhosts = [127.0.0.3]:25);

  1. Help :
./Portal --help
Usage: Portal [OPTION...]
Portal -- A program to listen to data receive from client and exchange with a
relay.
From me, John Doe. ;)

  -b, --bind_addr=BIND_ADDR  Local address to bind the input listener
  -c, --outbind_addr=OUTBIND_ADDR
                             remote address to connect to
  -j, --outlocal_port=OUTLOCAL_PORT
                             remote port the remote bind address connect to
  -l, --local_port=LOCAL_PORT   Local port the input bind address listen to
  -s, --show                 Show license
  -t, --type=BLACKHOLE[b]/WHITEHOLE[w]
                             type of this portal
  -?, --help                 Give this help list
      --usage                Give a short usage message

Mandatory or optional arguments to long options are also mandatory or optional
for any corresponding short options.

Report bugs to me, John Doe, you know how! ;).
  1. Start the whitehole:
./Portal -b 192.168.1.25 -l 1002 -j 25 -t w
  1. Start the blackhole :
./Portal -b 127.0.0.3 -l 25 -c 192.168.2.35 -j 1002 -t b
  1. Send an email :
echo "Test" | mail -s "Test" [email protected]
  1. Postfix 127.0.0.1:25 will connect to the black hole on 127.0.0.3:25, the blackhole will output on 192.168.2.35:1002. The whitehole will receive data from 192.168.1.25:1002 and output to MTA server on the resolved MX address:25.
  2. Both CLI will output debug message during processing.
  3. You should receive your mail in your mail box.

About

A STMP Portal/Tunnel using proxies chaining for protocol SMTP.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published