initial commit of file from CVS for e-smith-base on Thu 26 Oct 11:24:52 BST 2023

This commit is contained in:
2023-10-26 11:24:52 +01:00
parent bbc22988a8
commit 9510d1a360
678 changed files with 22721 additions and 2 deletions

View File

@@ -0,0 +1,28 @@
#!/usr/bin/perl -w
use strict;
use esmith::ConfigDB;
use esmith::templates;
use esmith::event;
use Digest::file qw(digest_file_hex);
my $c = esmith::ConfigDB->open_ro;
my $s = $c->get('SystemName')->value;
my $d = $c->get('DomainName')->value;
my $pem = "/home/e-smith/ssl.pem/$s.$d.pem";
if (!-e $pem){
die "$pem doesn't exist. This shouldn't happen. Please report a bug\n";
}
my $old_hash = digest_file_hex( $pem, 'SHA-1' );
esmith::templates::processTemplate({
TEMPLATE_PATH => '/home/e-smith/ssl.pem/pem',
});
my $new_hash = digest_file_hex( $pem, 'SHA-1' );
if ($old_hash ne $new_hash){
event_signal("ssl-update");
}

View File

@@ -0,0 +1,4 @@
if [ "$reason" = "BOUND" ]
then
/sbin/e-smith/signal-event ip-change "$new_ip_address" "$interface"
fi

View File

@@ -0,0 +1,14 @@
# This file is used by /usr/share/diald/connect to determine how
# to establish a connection using the given device.
#
# First match is used. List specific device names before generic types.
#
# Device type Dial method
# ----------- -----------
/dev/ttyS0 modem/generic
/dev/ttyS1 modem/generic
/dev/ttyS2 modem/generic
/dev/ttyS3 modem/generic
modem modem/generic
ippp isdn
isdn isdn

130
root/etc/diald/scripts/connect Executable file
View File

@@ -0,0 +1,130 @@
#!/bin/sh
# $DIALD_LINK is the name of the link we are connecting.
# $DIALD_DEVICE is the device we are calling out on.
#CFG_SCRIPTS='/usr/share/diald'
CFG_SCRIPTS='/etc/diald/scripts'
CFG_DEVICE='/etc/diald/device.conf'
CFG_LINK="/etc/diald/link"
CFG_SEQ='/var/run'
# $DIALD_DEVTYPE is a sanitized version of $DIALD_DEVICE.
case "$DIALD_DEVICE" in
ippp*) DIALD_DEVTYPE='isdn' ;;
isdn*) DIALD_DEVTYPE='isdn' ;;
*) DIALD_DEVTYPE='modem' ;;
esac
connect()
{
status=0
# If this device has a dial script we use it to bring up
# the physical link.
if [ -n "$dial_script" -a "$dial_script" != '-' ]; then
"$CFG_SCRIPTS/$dial_script"
status=$?
if [ $status -ne 0 ]; then
exit $status
fi
fi
# If we need to do some form of login when connecting this
# link over this device, do it now.
if [ -n "$LOGIN" -a "$LOGIN" != '-' ]; then
"$CFG_SCRIPTS/login/$LOGIN"
status=$?
fi
# If everything worked we start from the beginning of the
# list again next time
if [ $status -eq 0 ]; then
echo 1 > "$CFG_SEQ/dialdseq.$DIALD_LINK"
fi
exit $status
}
# Save stdin, we need it later if we are dialling a modem.
exec 9<&0
# Find out what dial script to use on this device.
exec < "$CFG_DEVICE"
gotdev=
while read dev dial_script dial_args
do
# Ignore blank lines and comments.
case "$dev" in
'#'*|'')
continue ;;
esac
if [ "$dev" = "$DIALD_DEVICE" -o "$dev" = "$DIALD_DEVTYPE" ]; then
gotdev=1
break
fi
done
if [ -z "$gotdev" ]; then
echo "<3>No entry for $DIALD_DEVICE, type $DIALD_DEVTYPE in $CFG_DEVICE"
exit 1
fi
seq=0
if [ -r "$CFG_SEQ/dialdseq.$DIALD_LINK" ]; then
seq=`cat "$CFG_SEQ/dialdseq.$DIALD_LINK"`
fi
seq=`expr $seq + 1`
echo $seq > "$CFG_SEQ/dialdseq.$DIALD_LINK"
passes=2
while [ $passes -gt 0 ]; do
passes=`expr $passes - 1`
exec < "$CFG_LINK"
dev_type=
link_params=
base_params=
counted=0
while read dev_type link_params
do
# Ignore blank lines and comments.
case "$dev_type" in
'#'*|'')
continue ;;
esac
if [ "$dev_type" = '=' ]; then
base_params="$link_params"
elif [ "$dev_type" = '+' ]; then
base_params="$base_params $link_params"
elif [ "$dev_type" = "$DIALD_DEVICE" \
-o "$dev_type" = "$DIALD_DEVTYPE" ]; then
counted=`expr $counted + 1`
seq=`expr $seq - 1`
if [ $seq -eq 0 ]; then
passes=0
exec 0<&9
eval "$dial_args $base_params $link_params connect"
exit $?
fi
fi
done
# If no entries match there is a problem
if [ $counted -eq 0 ]; then
echo "<3>No entry for $DIALD_DEVICE, type $DIALD_DEVTYPE in $CFG_LINK"
exit 1
fi
# One or more entries exists, we have just run off the end
# of the list so we have to start again from the top.
echo 1 > "$CFG_SEQ/dialdseq.$DIALD_LINK"
seq=1
done
exit 1

106
root/etc/diald/scripts/disconnect Executable file
View File

@@ -0,0 +1,106 @@
#!/bin/sh
# $DIALD_LINK is the name of the link we are disconnecting.
# $DIALD_DEVICE is the device we are called out on.
#CFG_SCRIPTS='/usr/share/diald'
CFG_SCRIPTS='/etc/diald/scripts'
CFG_DEVICE='/etc/diald/device.conf'
CFG_LINK="/etc/diald/link"
CFG_SEQ='/var/run'
# $DIALD_DEVTYPE is a sanitized version of $DIALD_DEVICE.
case "$DIALD_DEVICE" in
ippp*) DIALD_DEVTYPE='isdn' ;;
isdn*) DIALD_DEVTYPE='isdn' ;;
*) DIALD_DEVTYPE='modem' ;;
esac
disconnect()
{
status=0
# If this device has a hangup script we use it to hang up
# the physical link.
if [ -n "$dial_script" -a "$dial_script" != '-' \
-a -x "$CFG_SCRIPTS/$dial_script.hangup" ]; then
"$CFG_SCRIPTS/$dial_script.hangup"
status=$?
if [ $status -ne 0 ]; then
exit $status
fi
fi
exit $status
}
# Save stdin, we need it later if we are dialling a modem.
exec 9<&0
# Find out what dial script to use on this device.
exec < "$CFG_DEVICE"
gotdev=
while read dev dial_script dial_args
do
# Ignore blank lines and comments.
case "$dev" in
'#'*|'')
continue ;;
esac
if [ "$dev" = "$DIALD_DEVICE" -o "$dev" = "$DIALD_DEVTYPE" ]; then
gotdev=1
break
fi
done
if [ -z "$gotdev" ]; then
echo "<3>No entry for $DIALD_DEVICE, type $DIALD_DEVTYPE in $CFG_DEVICE"
exit 1
fi
seq=1
if [ -r "$CFG_SEQ/dialdseq.$DIALD_LINK" ]; then
seq=`cat "$CFG_SEQ/dialdseq.$DIALD_LINK"`
fi
exec < "$CFG_LINK"
dev_type=
link_params=
base_params=
counted=0
while read dev_type link_params
do
# Ignore blank lines and comments.
case "$dev_type" in
'#'*|'')
continue ;;
esac
if [ "$dev_type" = '=' ]; then
base_params="$link_params"
elif [ "$dev_type" = '+' ]; then
base_params="$base_params $link_params"
elif [ "$dev_type" = "$DIALD_DEVICE" \
-o "$dev_type" = "$DIALD_DEVTYPE" ]; then
seq=`expr $seq - 1`
counted=`expr $counted + 1`
if [ $seq -eq 0 ]; then
exec 0<&9
eval "$dial_args $base_params $link_params disconnect"
exit $?
fi
fi
done
# If no entries match there is a problem
if [ $counted -eq 0 ]; then
echo "<3>No entry for $DIALD_DEVICE, type $DIALD_DEVTYPE in $CFG_LINK"
exit 1
fi
echo "<3>Did not find entry matching sequence number $seq for $DIALD_DEVICE, type $DIALD_DEVTYPE in $CFG_LINK"
exit 1

83
root/etc/diald/scripts/isdn Executable file
View File

@@ -0,0 +1,83 @@
#!/bin/sh
#exec > /tmp/isdn.log 2>&1
#set -x
end_dial() {
for n in $PHONE
do
/usr/sbin/isdnctrl delphone "$DIALD_DEVICE" out "$n"
done
/usr/sbin/isdnctrl eaz "$DIALD_DEVICE" "$EAZ_IN"
if [ $status -ne 0 ]; then
# You should have specified "lock" in diald's config
# otherwise if we try and dial out on a device that
# is already connected we will hang it up.
/usr/sbin/isdnctrl hangup "$DIALD_DEVICE"
fi
exit $status
}
trap 'end_dial' 0
for n in $PHONE
do
/usr/sbin/isdnctrl addphone "$DIALD_DEVICE" out "$n"
done
/usr/sbin/isdnctrl eaz "$DIALD_DEVICE" "$EAZ_OUT"
/usr/sbin/isdnctrl dial "$DIALD_DEVICE"
status=$?
if [ $status -eq 0 ]; then
status=1
while true
do
msg=`/sbin/ifconfig "$DIALD_DEVICE" 2>&1`
if echo "$msg" | grep 'P-t-P:0.0.0.0' > /dev/null 2>&1
then
# no link yet...
WAITTIME=`expr $WAITTIME - 1`
if [ $WAITTIME -ge 0 ]; then
# still waiting...
sleep 1
else
echo "Timed out" 1>&2
break
fi
elif echo "$msg" | grep 'P-t-P:\[NONE SET\]' > /dev/null 2>&1
then
# no link yet...
WAITTIME=`expr $WAITTIME - 1`
if [ $WAITTIME -ge 0 ]; then
# still waiting...
sleep 1
else
echo "Timed out" 1>&2
break
fi
elif [ -n "$REMOTEIP" ]; then
if echo "$msg" | grep "P-t-P:$REMOTEIP" > /dev/null 2>&1
then
echo "Interface up: remote host ok" 1>&2
status=0
break
fi
elif [ -z "$REMOTEIP" ]; then
# The remote has a dynamic IP so we have no way
# of knowing whether the dial succeeded or some
# incoming connection was accepted. (If diald
# is not using device locking we may even have
# dialled somewhere else!)
echo "Interface up: host indeterminate" 1>&2
status=0
break
else
# Dial failed and something else is using this link.
echo "Interface up: wrong host - not my link" 1>&2
break
fi
done
fi
exit $status

View File

@@ -0,0 +1,37 @@
#!/bin/sh
/usr/sbin/isdnctrl eaz "$DIALD_DEVICE" "$EAZ_IN"
/usr/sbin/isdnctrl hangup "$DIALD_DEVICE"
status=$?
if [ $status -eq 0 ]; then
status=1
while true
do
msg=`/sbin/ifconfig "$DIALD_DEVICE" 2>&1`
if echo "$msg" | grep 'P-t-P:' > /dev/null 2>&1
then
# no link yet...
WAITTIME=`expr $WAITTIME - 1`
if [ $WAITTIME -ge 0 ]; then
# still waiting...
sleep 1
else
echo "Timed out - link still up" 1>&2
break
fi
else
echo "Link is down" 1>&2
status=0
break
fi
done
else
echo "Error return $status from isdnctrl hangup command" 2>&1
fi
# Set fake IPs for ippp0 device, to help diald
/sbin/ifconfig "$DIALD_DEVICE" \
$(/sbin/e-smith/db configuration get LocalIP) pointopoint 0.0.0.0 \
|| echo "Error ($?) while forcing ippp0 device down" 2>&1
exit $status

View File

@@ -0,0 +1 @@
enabled

View File

@@ -0,0 +1 @@
shared

View File

@@ -0,0 +1 @@
no

View File

@@ -0,0 +1 @@
Primary i-bay

View File

@@ -0,0 +1 @@
no

View File

@@ -0,0 +1 @@
no

View File

@@ -0,0 +1 @@
global

View File

@@ -0,0 +1 @@
no

View File

@@ -0,0 +1 @@
wr-admin-rd-group

View File

@@ -0,0 +1 @@
ibay

View File

@@ -0,0 +1 @@
Local

View File

@@ -0,0 +1 @@
Administrator

View File

@@ -0,0 +1 @@
no

View File

@@ -0,0 +1 @@
no

View File

@@ -0,0 +1 @@
/sbin/e-smith/console

View File

@@ -0,0 +1 @@
no

View File

@@ -0,0 +1 @@
system

View File

@@ -0,0 +1 @@
admin

View File

@@ -0,0 +1 @@
no

View File

@@ -0,0 +1 @@
internal

View File

@@ -0,0 +1 @@
pseudonym

View File

@@ -0,0 +1 @@
url

View File

@@ -0,0 +1 @@
url

View File

@@ -0,0 +1 @@
url

View File

@@ -0,0 +1 @@
url

View File

@@ -0,0 +1 @@
url

View File

@@ -0,0 +1 @@
system

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@
system

View File

@@ -0,0 +1 @@
url

View File

@@ -0,0 +1 @@
url

View File

@@ -0,0 +1 @@
url

View File

@@ -0,0 +1 @@
url

View File

@@ -0,0 +1 @@
internal

View File

@@ -0,0 +1 @@
system

View File

@@ -0,0 +1 @@
url

View File

@@ -0,0 +1 @@
placeholder for webmail URL

View File

@@ -0,0 +1 @@
url

View File

View File

@@ -0,0 +1,4 @@
{
use esmith::AccountsDB;
$DB = esmith::AccountsDB->open;
}

View File

@@ -0,0 +1,10 @@
{
# Delete any pre-existing Primary=system record
my $p = $DB->get('Primary');
return unless defined $p;
my $type = $p->prop('type');
return unless defined $type;
$p->delete if $type eq 'system';
}

View File

@@ -0,0 +1,11 @@
{
use esmith::ConfigDB;
my $conf = esmith::ConfigDB->open_ro() or return;
my $pw_set = $conf->get_value("PasswordSet") || "no";
my $admin = $DB->get('admin') || return;
$admin->set_prop('PasswordSet', $pw_set);
}

View File

@@ -0,0 +1,6 @@
{
foreach my $user ($DB->get_all_by_prop(EmailForward => 'procmail'))
{
$user->set_prop('EmailForward','local');
}
}

View File

@@ -0,0 +1,18 @@
{
# Migrate PPTPAccess -> VPNClientAccess and ensure a default for
# all user/admin accounts
foreach my $account ($DB->get_all)
{
next unless ( ($account->key eq 'admin') or
($account->prop('type') eq 'user') );
next if (defined $account->prop('VPNClientAccess'));
my $access = $account->prop('PPTPAccess') || 'no';
$account->delete_prop('PPTPAccess');
$account->set_prop('VPNClientAccess', $access);
}
}

View File

@@ -0,0 +1 @@
dedicated

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@
login

View File

@@ -0,0 +1 @@
long

View File

@@ -0,0 +1 @@
long

View File

@@ -0,0 +1 @@
long

View File

@@ -0,0 +1 @@
every15min

View File

@@ -0,0 +1 @@
everyhour

View File

@@ -0,0 +1 @@
everyhour

View File

@@ -0,0 +1 @@
/dev/ttyS1

View File

@@ -0,0 +1 @@
useraccount

View File

@@ -0,0 +1 @@
userpassword

View File

@@ -0,0 +1 @@
mycompany.local

View File

@@ -0,0 +1 @@
returntosender

View File

@@ -0,0 +1 @@
unknown

View File

@@ -0,0 +1 @@
unknown

View File

@@ -0,0 +1 @@
off

View File

@@ -0,0 +1 @@
disabled

View File

@@ -0,0 +1 @@
none

View File

@@ -0,0 +1 @@
interface

View File

@@ -0,0 +1 @@
255.255.255.0

View File

@@ -0,0 +1 @@
miimon=200 mode=active-backup

View File

@@ -0,0 +1 @@
eth0

View File

@@ -0,0 +1 @@
255.255.255.0

View File

@@ -0,0 +1 @@
interface

View File

@@ -0,0 +1 @@
255.255.255.0

View File

@@ -0,0 +1 @@
5000

View File

@@ -0,0 +1 @@
no

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1 @@
off

View File

@@ -0,0 +1 @@
servergateway

View File

@@ -0,0 +1 @@
sme-server

View File

@@ -0,0 +1 @@
enabled

View File

@@ -0,0 +1 @@
service

View File

@@ -0,0 +1 @@
configuration

View File

@@ -0,0 +1 @@
enabled

View File

@@ -0,0 +1 @@
enabled

View File

@@ -0,0 +1 @@
service

View File

@@ -0,0 +1 @@
enabled

View File

@@ -0,0 +1 @@
service

View File

@@ -0,0 +1 @@
enabled

Some files were not shown because too many files have changed in this diff Show More