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,225 @@
#!/usr/bin/perl -w
# vim: se ft=perl:
use strict;
use Test::More 'no_plan';
use User::pwent;
use User::grent;
use File::stat;
use esmith::AccountsDB;
my $adb = esmith::AccountsDB->open;
### Check the admin account is in order.
my $admin = getpwnam('admin');
ok( $admin, 'admin user exists' );
is( $admin->shell, '/sbin/e-smith/console', 'shell' );
# Check for the existence of these groups.
my @groups = qw(shared www slocate ntp);
foreach my $group_name (@groups)
{
ok( getgrnam($group_name), "$group_name group exists" );
}
# Check the groups that the admin user should be a member of.
foreach my $group_name (qw(root shared www)) {
my $group = getgrnam($group_name);
ok( grep($_ eq 'admin', @{ $group->members }),
"admin is in group $group_name" );
}
# Check that all users in the AccountsDB are in the passwd file.
foreach my $user ($adb->users)
{
my $name = $user->{key};
ok( getpwnam($name), "$name from accounts db exists in passwd file" );
}
# Check that all groups in the AccountsDB are in the group file.
foreach my $group ($adb->groups)
{
my $name = $group->{key};
ok( getgrnam($name), "$name from accounts db exists in group file" );
}
# Check for the existence of these users.
my @users = qw(public www root admin public);
foreach my $user_name (@users)
{
ok( getpwnam($user_name), "$user_name user exists" );
}
# Make sure that user www belongs to admin and shared groups.
foreach my $group_name (qw(admin shared))
{
my $group = getgrnam($group_name);
ok( grep($_ eq 'www', @{ $group->members }),
"www is in group $group_name" );
}
# Check that unwanted accounts don't exist.
foreach my $user (qw(halt shutdown sync)) {
ok( !getpwnam($user), "unwanted $user account" );
}
# Check the shells of the root and admin users.
ok( (getpwnam('admin')->shell eq '/sbin/e-smith/console'), 'admin shell is /sbin/e-smith/console' );
ok( (getpwnam('root')->shell eq '/bin/bash'), 'root shell is /bin/bash' );
# Check ownership and permissions of important files.
# These files may not exist, thanks to the breakup of the base. Make the tests
# conditional on their existence.
my %dirs = (
'/home/e-smith' => { user => 'admin',
group => 'admin',
mode => 040755
},
'/home/e-smith/files' => {
user => 'root',
group => 'root',
mode => 040755,
},
'/home/e-smith/files/users/admin' => {
user => 'admin',
group => 'admin',
mode => 040500,
},
'/home/e-smith/Maildir' => {
user => 'admin',
group => 'admin',
mode => 040700,
},
'/etc/e-smith/web' => {
user => 'root',
group => 'root',
mode => 0755,
},
'/etc/e-smith/web/functions' => {
user => 'root',
group => 'admin',
mode => 0550,
},
'/etc/e-smith/web/panels' => {
user => 'root',
group => 'admin',
mode => 0550,
},
'/etc/e-smith/web/common' => {
user => 'www',
group => 'admin',
mode => 0550,
},
'/etc/e-smith/web/panels/password/cgi-bin/userpassword' =>
{
user => 'root',
group => 'admin',
mode => 06550,
},
'/usr/bin/pwauth' => {
user => 'root',
group => 'www',
mode => 04750,
},
);
while(my($dir, $setup) = each %dirs) {
my $stat = stat($dir);
SKIP: {
skip "$dir does not exist", 3 unless defined $stat;
is( $stat->uid, getpwnam($setup->{user})->uid, "owner of $dir" );
is( $stat->gid, getgrnam($setup->{group})->gid, "group of $dir" );
SKIP: {
skip "No mode expectations for $dir", 1 unless $setup->{mode};
cmp_ok( $stat->mode & $setup->{mode}, '==', $setup->{mode},
"perms for $dir" );
}
}
}
my %files = (
'/home/e-smith/files/' => {
user => 'root',
group => 'root',
mode => 0755
},
'/home/e-smith/files/ibays/Primary' => {
user => 'admin',
group => 'shared',
mode => 02750,
},
'/etc/e-smith/web/functions' => {
user => 'root',
group => 'admin',
mode => 04750,
},
'/etc/e-smith/web/panels' => {
user => 'root',
group => 'root',
mode => 0755,
},
);
while( my($dir, $setup) = each %files ) {
opendir DIR, $dir || die $!;
foreach my $file (readdir DIR) {
next if $file =~ /^\.{1,2}$/;
$file = "$dir/$file";
next if -l $file;
my $stat = stat($file);
is( $stat->uid, getpwnam($setup->{user})->uid, "owner of $file" );
is( $stat->gid, getgrnam($setup->{group})->gid, "group of $file" );
cmp_ok( $stat->mode & $setup->{mode}, '==', $setup->{mode},
"perms for $file" );
}
close DIR;
}
my %name2type =
(
admin => 'system',
mysql => 'system',
shared => 'system',
everyone => 'pseudonym',
'mailer-daemon' => 'pseudonym',
postmaster => 'pseudonym',
'cgi-bin' => 'url',
'e-smith-manager' => 'url',
'e-smith-password' => 'url',
'server-manager' => 'url',
'server-manual' => 'url',
'user-password' => 'url',
'common' => 'url',
'files' => 'url',
'icons' => 'url',
webmail => 'url',
'Primary' => 'ibay',
);
my $account;
while( my($name, $type) = each %name2type ) {
SKIP: {
skip "$name is not defined", 2 unless $adb->get($name);
isa_ok( $account = $adb->get($name), 'esmith::DB::Record', "$name" );
is( $account->prop('type'), $type, ' type' );
}
}
my %Expected_Props =
(
shared => { Visible => 'internal' },
everyone => { Account => 'shared',
Visible => 'internal'
},
'mailer-daemon' => { Account => 'admin' },
postmaster => { Account => 'admin' }
);
while( my($name, $exp_props) = each %Expected_Props ) {
my $account = $adb->get($name);
my %props = $account->props;
is_deeply( [@props{keys %$exp_props}], [@{$exp_props}{keys %$exp_props}],
"$name props");
}

View File

@@ -0,0 +1,10 @@
#!/usr/bin/perl -w
use strict;
use Test::More 'no_plan';
use esmith::FormMagick::Tester;
my $ua = new esmith::FormMagick::Tester;
ok($ua->get("http://localhost/server-manager"), "Get server manager");
is($ua->{status}, 200, "200 OK");

View File

@@ -0,0 +1,102 @@
#!/usr/bin/perl -w
# vim: ft=perl:
use strict;
use Test::More 'no_plan';
use esmith::util;
use esmith::ConfigDB;
my $db = esmith::ConfigDB->open_ro;
my $internal = $db->get('InternalInterface');
my $external = $db->get('ExternalInterface');
# Test the internal interface.
ok( $internal, "InternalInterface exists" );
ok( $internal->prop('type') eq 'interface', "InternalInterface is an interface" );
ok( $internal->prop('Configuration') eq 'static',
"InternalInterface Configuration is static" );
ok( $internal->prop('Driver') eq $db->get_value("EthernetDriver1"),
"InternalInterface Driver is correct" );
ok( $internal->prop('IPAddress') eq $db->get_value("LocalIP"),
"InternalInterface IPAddress is correct" );
ok( $internal->prop('Netmask') eq $db->get_value("LocalNetmask"),
"InternalInterface Netmask is correct" );
# There might be an external interface.
SKIP: {
skip "serveronly mode, no external interface expected", 9
if $db->get_value('SystemMode') eq 'serveronly';
ok( $external, "ExternalInterface exists" );
ok( $external->prop('type') eq 'interface',
"ExternalInterface is an interface" );
ok( $external->prop('IPAddress') eq $db->get_value('ExternalIP'),
"ExternalInterface IPAddress is correct" );
ok( $external->prop('Netmask') eq $db->get_value('ExternalNetmask'),
"ExternalInterface Netmask is correct" );
ok( $external->prop('Gateway') eq $db->get_value('GatewayIP'),
"ExternalInterface Gateway is correct" );
ok( ($external->prop('Network'), $external->prop('Broadcast')) eq
esmith::util::computeNetworkAndBroadcast($external->prop('IPAddress'),
$external->prop('Netmask')),
"ExternalInterface Network is correct" );
if ($db->get_value('AccessType') eq 'dialup')
{
ok( $external->prop('Configuration') eq 'dialup',
"ExternalInterface Configuration is dialup" );
my $isdn = $db->get_prop('isdn', 'status') || "disabled";
my $sync_isdn = $db->get_prop('isdn', 'UseSyncPPP') || "no";
my $name = ($isdn eq "enabled" and $sync_isdn eq "yes") ?
"ippp0" : "ppp0";
ok( $external->prop('Name') eq $name, "ExternalInterface Name is $name" );
}
elsif ($db->get_prop('pppoe', 'status') eq 'enabled')
{
ok( $external->prop('Configuration') eq 'pppoe',
"ExternalInterface Configuration is pppoe" );
ok( $external->prop('Name') eq 'ppp0', "ExternalInterface name is ppp0" );
}
else
{
ok( $external->prop('Driver') eq $db->get_value("EthernetDriver2"),
"ExternalInterface Driver is correct" );
}
if ($db->get_value("ExternalDHCP") eq "on")
{
if ($db->get_value("DHCPClient") eq "dhi")
{
ok( $external->prop('Configuration') eq "DHCPHostname",
"ExternalInterface Configuration is DHCPHostname" );
}
else
{
ok( $external->prop('Configuration') eq "DHCPEthernetAddress",
"ExternalInterface Configuration is DHCPEthernetAddress" );
}
}
else
{
unless (($db->get_value('AccessType') eq 'dialup') ||
($db->get_prop('pppoe', 'status') eq 'enabled'))
{
ok( $external->prop('Configuration') eq 'static',
"ExternalInterface Configuration is static" );
}
}
}
# The interfaces migrate fragment also creates a dhcpcd record.
my $dhcpcd = $db->get("dhcpcd");
ok( defined $dhcpcd, "dhcpcd record exists" );
ok( $dhcpcd->prop('type') eq 'service', "dhcpcd is a service" );
if ($db->get_value("ExternalDHCP") eq "on")
{
ok( $dhcpcd->prop('status') eq 'enabled', "dhcpcd is enabled" );
}
else
{
ok( $dhcpcd->prop('status') eq 'disabled', "dhcpcd is disabled" );
}

View File

@@ -0,0 +1,83 @@
# DO NOT MODIFY THIS FILE.
# This file is automatically maintained by the Mitel Networks SME Server
# configuration software. Manually editing this file may put your
# system in an unknown state.
#
# updated: Tue Feb 26 13:56:13 2002
Bart.Simpson=pseudonym|Account|bart
Bart_Simpson=pseudonym|Account|bart
Global=system
Primary=system
adm=system|Gid|4|Uid|3
admin=system|Gid|101|Uid|101
alias=system|Gid|400|Uid|400
apache=existing|Gid|48|Uid|48
bart=user|FirstName|Bart|LastName|Simpson
bin=system|Gid|1|Uid|1
cdrom=system
cgi-bin=url
console=system
daemon=system|Gid|2|Uid|2
dip=system|Gid|40
disk=system|Gid|6
dns=existing|Gid|53|Uid|53
e-smith-manager=url
e-smith-password=url
everyone=pseudonym|Account|shared|Visible|internal
floppy=system|Gid|19
ftp=system|Gid|50|Uid|14
games=system|Gid|20|Uid|12
global=system
gopher=system|Gid|30|Uid|13
halt=system
homes=system
kmem=system|Gid|9
ldap=existing|Gid|55|Uid|55
lp=system|Gid|7|Uid|4
mail=system|Gid|12|Uid|8
mailer-daemon=pseudonym|Account|admin
man=system|Gid|15
mem=system|Gid|8
mysql=existing|Gid|27|Uid|27
named=existing|Gid|25|Uid|25
netlogon=netlogon|Comment|placeholder for netlogon share
news=system|Gid|13|Uid|9
nobody=system|Gid|99|Uid|99
nofiles=system|Gid|400
operator=system|Gid|0|Uid|11
postgres=system
postmaster=pseudonym|Account|admin
primary=system
printers=system
public=system|Gid|103|Uid|102
qmail=system|Gid|401
qmaild=system|Gid|400|Uid|401
qmaill=system|Gid|400|Uid|402
qmailp=system|Gid|400|Uid|403
qmailq=system|Gid|401|Uid|404
qmailr=system|Gid|401|Uid|405
qmails=system|Gid|401|Uid|406
qmailscan=existing|Gid|407|Uid|407
root=system|Gid|0|Uid|0
schwern=user|Uid|500|Gid|501|FirstName|Michael|LastName|Schwern
server-manager=url
server-manual=url
shared=system|Gid|500|Visible|internal
shutdown=system
simpsons=group|Description|Simpsons Family|Gid|5005|Members|bart,lisa,homer|Uid|5005
flanders=group|Description|Flanders Family|Gid|5006|Members|ned,rod,tod|Uid|5005
slocate=system
somegroup=group|Gid|42
squid=system|Gid|23|Uid|23
sync=system
sys=system|Gid|3
trend=existing|Gid|408|Uid|408
tty=system|Gid|5
user-password=url
users=system|Gid|100
utmp=system|Gid|22
uucp=system|Gid|14|Uid|10
webmail=url
wheel=system|Gid|10
www=system|Gid|102|Uid|100
webstats=ibay|CgiBin|disabled|Gid|5017|Group|shared|Name|Web Statistics|PasswordSet|no|PublicAccess|global|Uid|5017|UserAccess|wr-group-rd-group

View File

@@ -0,0 +1,99 @@
# DO NOT MODIFY THIS FILE.
# This file is automatically maintained by the Mitel Networks SME Server
# configuration software. Manually editing this file may put your
# system in an unknown state.
#
# updated: Fri Apr 25 22:01:19 2003
AccessType=dedicated
ActiveAccounts=0
AdminEmail=
ConsoleMode=login
ContactEmail=
ContactName=
ContactOrg=
DialupConnOffice=long
DialupConnOutside=long
DialupConnWeekend=long
DialupFreqOffice=every15min
DialupFreqOutside=everyhour
DialupFreqWeekend=everyhour
DialupModemDevice=/dev/ttyS1
DialupPhoneNumber=
DialupUserAccount=useraccount
DialupUserPassword=userpassword
DomainName=e-smith.com
EmailUnknownUser=returntosender
EthernetDriver1=pcnet32
EthernetDriver2=unknown
ExternalDHCP=off
ExternalNetmask=255.255.255.0
GatewayIP=192.168.16.1
LocalIP=192.168.16.228
LocalNetmask=255.255.255.0
MinUid=5000
PasswordSet=yes
PreviousConfiguration=/home/e-smith/db/configuration.previous
SMTPSmartHost=
SambaDomainMaster=no
SambaServerName=pretz
SambaWorkgroup=mitel-networks
ServiceAccountId=
ServiceDomainName=
ServiceTargetIP=
SquidParent=
SquidParentPort=
StatusReports=off
SystemMode=serveronly
SystemName=pretz
TimeZone=US/Eastern
UnsavedChanges=yes
atalk=service|InitscriptOrder|91|status|enabled
auth=service|access|public|status|enabled
blades=service|Host|service.e-smith.com|status|enabled
bootstrap-console=service|InitscriptOrder|35|Run|no|status|enabled
branding=service|modified|000000000000|status|enabled
crond=service|InitscriptOrder|40|status|enabled
dhcpd=service|InitscriptOrder|65|end|192.168.16.250|start|192.168.16.65|status|disabled
diald=service|InitscriptOrder|57|status|disabled
fetchmail=service|FreqOffice|every5min|FreqOutside|every30min|FreqWeekend|never|Method|standard|SecondaryMailAccount|popaccount|SecondaryMailPassword|poppassword|SecondaryMailServer|mail.myisp.xxx|status|disabled
flexbackup=backupservice|erase_rewind_only|true
ftp=service|access|private|accessLimits|off|status|enabled
horde=service|status|disabled
httpd-admin=service|InitscriptOrder|86|ValidFrom|10.1.2.0/255.255.255.0,1.2.3.4/255.255.255.255,5.4.3.2/255.255.255.255|status|enabled
httpd-e-smith=service|InitscriptOrder|85|access|private|status|enabled
imap=service|access|private|status|enabled
imaps=service|access|private|status|enabled
imp=service|status|disabled
ippp=service|InitscriptOrder|55|status|enabled
ipsec=service|InitscriptOrder|90|PubKey|0sAQOoIKaOMuDqSdCZJXgv9QI86DAuAwbbvn8uoKn2lRQ9ZVPTn9Ow5znhuw/GopsYD2eujhtvkQo7fszAhWbEpn+lW2LzLCbZYaDov7j8Q9CpeJSVgeuzaBcw3OenSL3ltTwWWtG0pvyaYsfepNqVYvo64YVmrxo0O7dCECySMVBZkQ==|status|disabled
isdn=service|Protocol|2|UseSyncPPP|yes|status|disabled
keytable=service|InitscriptOrder|25|status|enabled
ldap=service|InitscriptOrder|80|access|private|defaultCity|Ottawa|defaultCompany|XYZ Corporation|defaultDepartment|Main|defaultPhoneNumber|555-5555|defaultStreet|123 Main Street|status|enabled
lilo=service|AddressMode|linear
local=service|InitscriptOrder|99|status|enabled
lpd=service|InitscriptOrder|60|status|enabled
mariadb=service|InitscriptOrder|90|status|enabled
masq=service|InitscriptOrder|06|Logging|none|Stealth|no|status|disabled
maxIbayNameLength=2
modSSL=service|status|enabled
mysql.init=service|InitscriptOrder|99|status|enabled
named=service|chroot|yes|status|enabled
network=service|InitscriptOrder|10|status|enabled
ntpd=service|InitscriptOrder|55|status|disabled
php=service|status|enabled
pop3s=service|access|private|status|enabled
popd=service|access|private|status|enabled
pppoe=service|DemandIdleTime|no|InitscriptOrder|57|SynchronousPPP|no|status|disabled
qmail=service|InitscriptOrder|80|status|enabled
random=service|InitscriptOrder|20|status|enabled
scanner=service|ScannerFns|iscan|UpdateTime|1:14|scanMail|yes|status|enabled
smb=service|InitscriptOrder|91|RoamingProfiles|no|status|enabled
smtpfront-qmail=service|access|public|status|enabled
ssmtpfront-qmail=service|access|public|status|enabled
squid=service|InitscriptOrder|90|status|enabled
sshd=service|InitscriptOrder|85|PasswordAuthentication|yes|PermitRootLogin|yes|access|private|status|enabled
sync=service|Host|service.e-smith.com|LastId|0|SuccessId|0|SyncFrequency|1|SyncMinute|57|status|disabled
rsyslog=service|InitscriptOrder|05|status|enabled
telnet=service|access|private|status|disabled
vpn=configuration|sessions|10|status|disabled
wibble=42

View File

@@ -0,0 +1,6 @@
# DO NOT MODIFY THIS FILE.
# This file is automatically maintained by the March Networks SME Server
# configuration software. Manually editing this file may put your
# system in an unknown state.
frog.pond=domain|Description|Frog Pond|Content|Primary
swamp.hollow.log=domain|Description|Swamp Hollow|Content|webstats

View File

@@ -0,0 +1,9 @@
# DO NOT MODIFY THIS FILE.
# This file is automatically maintained by the Mitel Networks SME Server
# configuration software. Manually editing this file may put your
# system in an unknown state.
#
# updated: Sat May 25 22:33:50 2002
10.33.16.0=network|Mask|255.255.255.240|RemoteVPNSubnet|yes|Router|default
10.33.17.0=network|Mask|255.255.255.240|RemoteVPNSubnet|yes|Router|default
10.35.127.16=network|Mask|255.255.255.240|RemoteVPNSubnet|yes|Router|default

View File

@@ -0,0 +1,19 @@
# DO NOT MODIFY THIS FILE.
# This file is automatically maintained by the Mitel Networks SME Server
# configuration software. Manually editing this file may put your
# system in an unknown state.
#
# updated: Tue Sep 10 14:54:26 2002
PreviousConfiguration=10e-smith-base/system_configuration.previous
SystemMode=servergateway-private
ftp=service|access|private|accessLimits|private|status|disabled
httpd-e-smith=service|access|private|status|disabled
imap=service|access|private|status|disabled
imaps=service|access|private|status|disabled
oidentd=service|access|private|status|disabled
pop3s=service|access|private|status|disabled
popd=service|access|private|status|disabled
smtpfront-qmail=service|access|private|status|disabled
ssmtpfront-qmail=service|access|private|status|disabled
sshd=service|access|private|status|disabled
telnet=service|access|private|status|disabled

View File

@@ -0,0 +1,7 @@
# DO NOT MODIFY THIS FILE.
# This file is automatically maintained by the Mitel Networks SME Server
# configuration software. Manually editing this file may put your
# system in an unknown state.
#
# updated: Tue Sep 10 14:54:25 2002
SystemMode=junk4testing