Initial ZIP contents

This commit is contained in:
Yaakov 2022-05-29 21:12:14 +10:00
commit 0245ab71c8
6 changed files with 3189 additions and 0 deletions

87
ELProxy.conf Normal file
View file

@ -0,0 +1,87 @@
# EchoLink Proxy Configuration File
# REQUIRED ITEMS
# This is the default proxy password used when no specific password is set
# for a proxy instance.
# You must change the password to something besides "notset".
# Set it to "PUBLIC" to run a public proxy.
Password=notset
# OPTIONAL ITEMS
# Logfile for connections and errors.
LogFile=/var/log/elproxy
# Statusfile for active connections, usually put in RAMdisk.
StatusFile=/dev/shm/elproxy
# Change Port to something else if you don't want to use the default.
# (If you use 1023 or below on Unix/Linux systems, you will need to run
# EchoLink Proxy as root.)
Port=8100
# Set the number of proxies you want to run
NumberOfProxies=1
# Set the address for each of the proxies defined in NumberOfProxies above.
# This is the public address on which this proxy instance will be running.
# In this version there is no separate inside, outside and registration
# address, they are all the same. But multiple proxies will have to use
# different addresses, all defined in the operating system of this machine.
# Proxies are numbered from 0 up to NumberOfProxies-1, but holes in the
# list can be created by omitting the proxy with that number.
Proxy_0=your.domain.name
# It is possible to set a password per proxy instance, e.g. when you want
# to run a couple of private proxies in addition to a number of public
# proxies. When no Password_nn value is found, the global password is used.
#Password_0=MyPassWord
# Set the number of relays you want to run
NumberOfRelays=0
# Set the address for each of the relays defined in NumberOfRelays above.
# This is the public address on which this relay instance will be running.
# Relays are numbered from 0 up to NumberOfRelays-1, but holes in the
# list can be created by omitting the relay with that number.
Relay_0=your.domain.name
# ADVANCED ITEMS
# Automatically become daemon process when set to 1
Daemonize=1
# Set the ConnectionTimeout to something besides 0 if you want the proxy
# to "pull the plug" on a client that has been using the proxy for more
# than n minutes, regardless of whether an EchoLink connection is active.
ConnectionTimeout=0
# Set RegistrationName to something unique (such as your callsign) if you
# want EchoLink Proxy to register itself with the EchoLink Web site.
# Enable this option only if you want the IP address of this server to
# be listed on the Web page. You might want to do this if the IP address
# of your server changes from time to time and you need to find out what
# it is. The Comment is optional.
# Note: If you want to "advertise" this Proxy as a Public proxy, and make
# it available to any EchoLink user, set the Password above to PUBLIC
# and set RegistrationName below to something unique, such as your call.
# This will cause the proxy to be also be listed on the Proxy List page
# on the EchoLink Web site. Note that each RegistrationName must be
# different for each instance. To facilitate this, a printf-style
# format like %03d or %d can be used to set the instance number.
RegistrationName=yourcallsign
RegistrationComment=yourcomment
# If you want to restrict access to the proxy only to certain callsigns,
# create regular expressions for either or both of the following. A
# connection will be denied if it matches the CallsignsDenied pattern, or
# if it does NOT match the CallsignsAllowed pattern (and CallsignsAllowed
# is not empty). These patterns apply only to EchoLink clients that use
# this proxy, not the nodes to which they connect while using it.
# Examples: CallsignsAllowed=K1RFD|AK8V will allow K1RFD and AK8V to use this proxy.
# CallsignsDenied=.*-L$|.*-R$ will deny any Sysop nodes from using it.
#CallsignsDenied=.*-L$|.*-R$
#CallsignsAllowed=

4
Makefile Normal file
View file

@ -0,0 +1,4 @@
all: elproxy
elproxy: elproxy.c
gcc -O3 -finline-functions-called-once -finline-small-functions -Wall elproxy.c -s -o elproxy -lnettle

116
README Normal file
View file

@ -0,0 +1,116 @@
Echolink Proxy/Relay server - PE1CHL
This Echolink Proxy/Relay server can run multiple echolink proxies and/or
relays on a single machine, provided it has multiple IPv4 addresses on the
internet. It is written in C and uses a single socket for the well-known
ports for all proxies and relays, reducing the number of sockets and fds.
The configuration file is very similar to the configuration of the original
Java proxy, except the definition of the addresses.
You need to set the number of proxies that are running on this machine,
1 when you have only a single public IP address, and the domain name or
address for every instance. Every proxy instance has to have a different
public IP address!
Example for a single proxy:
# Set the number of proxies you want to run
NumberOfProxies=1
# Set the address for each of the proxies defined in NumberOfProxies above.
# This is the public address on which this proxy instance will be running.
# In this version there is no separate inside, outside and registration
# address, they are all the same. But multiple proxies will have to use
# different addresses, all defined in the operating system of this machine.
# Proxies are numbered from 0 up to NumberOfProxies-1, but holes in the
# list can be created by omitting the proxy with that number.
Proxy_0=your.domain.name
For two proxy servers you would set NumberOfProxies=2 and define values
for Proxy_0 and Proxy_1
When you want to run 10 proxies numbered 30..39 (e.g. because you run
proxies numbered up to 29 on another machine and you want to register them
all using similar names on the echolink proxy list), set NumberOfProxies=40
and define the values for Proxy_30 up to Proxy_39.
Note that every proxy should have a unique registration name. When you
run multiple proxies, define the RegistrationName like this:
RegistrationName=yourcall #%02d
This will generate names with 2-digit decimal numbers set to the proxy
number. %d will generate numbers with the smallest possible number of
digits. It is just a standard printf format.
It is also possible to override the RegistrationName, RegistrationComment
or PublicAddress (registration address) for a single proxy by defining a
RegistrationName_nn, RegistrationComment_nn or PublicAddress_nn with nn the
same as the Proxy_nn number. This will override the global RegistrationName
RegistrationComment or Proxy address.
There is a similar configuration for relays. To setup relays, define
NumberOfRelays and Relay_nn each with different IP addresses.
Note that without cooperation from the echolink people, it is not possible
to run a relay that is actually used by the typical end-user. When you
want to contribute some relays to the community, contact EchoLink via
their website and ask about adding the relay addresses to their DNS
for your region. To do local testing you can override the address for
relay.echolink.org in your local DNS service, that is what the app uses
to find the addresses of relays.
Unlike in earlier versions, there no longer is a need to tweak the TCP
queue length and/or set the TCPQueueHighWater parameter. It is no longer
required for proper operation.
You can still add this to the /etc/sysctl.conf:
###################################################################
## increase Linux TCP buffer limits
net.core.rmem_max = 1048576
net.core.wmem_max = 1048576
net.core.rmem_default = 262144
net.core.wmem_default = 262144
# increase Linux autotuning TCP buffer limits
net.ipv4.tcp_rmem = 4096 262144 1048576
net.ipv4.tcp_wmem = 4096 262144 1048576
net.ipv4.tcp_mem = 1048576 1048576 1048576
###################################################################
This will be loaded at reboot and can be forced once using "sysctl -f".
Before building the program, you need to install the "nettle" library
and its development package. E.g. on debian do "apt-get install nettle-dev".
Then just type "make" to compile it using gcc, and move the binary to
some place you like.
To start the service, just run the program with 1 parameter: the name
of the configuration file as accessible from where you run it.
(a full pathname or a name relative to the current directory at startup)
Optionally you can pass a second parameter "debuglevel" to get more
detailed logging messages. Only one debuglevel is supported at this time,
you can use "1" as level:
/path/to/elproxy /path/to/ELProxy.conf 1
As always, it it wise to run it as a nonprivileged user. It does not
require any root rights to run, except that you need to make the logfile
writable for the user you want to run as.
The program writes its operational status to a file (default /dev/shm/elproxy)
that you can "cat" to see what is going on, or it can be monitored by
nagios using the nagios plugin check_statusfile, using a command like:
define command {
command_name check_elproxy
command_line /usr/lib/nagios/plugins/check_statusfile -a 10m /dev/shm/elproxy
}
This can be used to verify that the program is still running, and also to
graph the statistiscs like number of used proxies.
When this file disappears for no apparent reason, it probably is systemd
doing it.
Configure RemoveIPC=no in /etc/systemd/logind.conf to keep it at bay.

2875
elproxy.c Normal file

File diff suppressed because it is too large Load diff

95
init.d-elproxy Executable file
View file

@ -0,0 +1,95 @@
#! /bin/bash
# setup echolink proxies - Rob Janssen
#
# /etc/init.d/elproxy
#
### BEGIN INIT INFO
# Provides: elproxy
# Required-Start: cron
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: Configure special network interface and start el proxies
### END INIT INFO
. /lib/lsb/init-functions
PROG="elproxy"
DAEMON=/home/elproxy/elproxy
CONFIG=/home/elproxy/ELProxy.conf
STATFILE=/dev/shm/elproxy
PIDFILE=/var/run/$PROG.pid
LOGFILE=/var/log/$PROG
ERRLOG=/var/log/$PROG.err
RUNASUSER=elproxy
ELPROXIF="dummy0"
ELPROXNET="44.137.75"
test -x $DAEMON || exit 5
case "$1" in
start)
echo "Starting elproxy daemon"
## Check about pid file
if [ -e $PIDFILE ]; then
if $0 status > /dev/null ; then
log_failure_msg "$PROG is already started; not starting"
return
else
log_progress_msg "[Removing stale PID file $PIDFILE]"
rm -f $PIDFILE
fi
fi
echo "Starting interface"
modprobe dummy
ifconfig $ELPROXIF $ELPROXNET.1/24 up
for i in {2..249}
do
ip addr add $ELPROXNET.$i/32 dev $ELPROXIF
done
echo "Starting proxies"
touch $LOGFILE
chown $RUNASUSER.$RUNASUSER $LOGFILE
sleep 2
start-stop-daemon --start --pidfile $PIDFILE --make-pidfile --chuid $RUNASUSER --startas $DAEMON -- $CONFIG >>$ERRLOG 2>&1
;;
stop)
echo "Stopping proxies"
start-stop-daemon --stop --pidfile $PIDFILE
rm -f $STATFILE
sleep 10
echo "Stopping interface"
for i in {2..249}
do
ip addr del $ELPROXNET.$i/32 dev $ELPROXIF 2>/dev/null
done
ifconfig $ELPROXIF down
;;
restart)
$0 stop; sleep 2; $0 start
;;
reload)
echo "Reloading proxies"
killall -9 $DAEMON
rm -f $STATFILE $PIDFILE
sleep 2
start-stop-daemon --start --pidfile $PIDFILE --make-pidfile --chuid $RUNASUSER --startas $DAEMON -- $CONFIG >>$ERRLOG 2>&1
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
;;
esac
exit 0

12
logrotate.d-elproxy Normal file
View file

@ -0,0 +1,12 @@
/var/log/elproxy {
missingok
notifempty
weekly
rotate 9
compress
delaycompress
create 0644 elproxy elproxy
postrotate
killall -HUP elproxy
endscript
}