|
|
if($ARGV[0]) { | if($ARGV[0]) { |
$base=$ARGV[0]; | $base=$ARGV[0]; |
} else { | } else { |
# the last one is the one used if all else fails |
$base='/etc/assp/'; |
foreach ('.','assp','/usr/local/assp','/home/assp','/etc/assp','/usr/assp','/applications/assp','/assp','.') { |
|
$base=$_; |
|
last if -e "$base/assp.cfg"; |
|
} |
|
} | } |
if ( !-e "$base/images/noIcon.png") |
if ( !-e "/usr/share/assp/images/noIcon.png") |
{ die "Abort: folder 'images' not correctly installed";} | { die "Abort: folder 'images' not correctly installed";} |
| |
loadConfig(); | loadConfig(); |
|
|
[blackRe,'BlackRe - Expression to Identify Spam* ',60,textinput,'http://[\\w\\.]+@|\w<[a-z0-9]+[abcdfghjklmnpqrstuvwxyz0-9]{4}[a-z0-9]*>|subject: [^\\n]* \S','(.*)',ConfigCompileRe, | [blackRe,'BlackRe - Expression to Identify Spam* ',60,textinput,'http://[\\w\\.]+@|\w<[a-z0-9]+[abcdfghjklmnpqrstuvwxyz0-9]{4}[a-z0-9]*>|subject: [^\\n]* \S','(.*)',ConfigCompileRe, |
'If an incoming email that\'s not local or whitelisted matches this Perl regular expression it will be considered spam by the Bayesian filter.<br /> | 'If an incoming email that\'s not local or whitelisted matches this Perl regular expression it will be considered spam by the Bayesian filter.<br /> |
May match text from the body or header of the email. For example: penis|virgin|X-Priority: 1','Basic'], | May match text from the body or header of the email. For example: penis|virgin|X-Priority: 1','Basic'], |
[redRe,'Expression to Identify Redlisted Mail*',60,textinput,'file:files/redre.txt','(.*)',ConfigCompileRe, |
[redRe,'Expression to Identify Redlisted Mail*',60,textinput,'file:/etc/assp/redre.txt','(.*)',ConfigCompileRe, |
'If an email matches this Perl regular expression it will be considered redlisted. The redlist is a list of addresses that cannot contribute to the whitelist, and who are not considered local, even if their mail is from a local computer. For example, if someone goes on a vacation and turns on their email\'s autoresponder, put them on the redlist until they return. Then as they reply to every spam they receive they won\'t corrupt your non-spam collection or whitelist: \\[autoreply\\]<br> Redlisted addresses will not be added to the whitelist. Redlisted messages will not be stored in the SPAM/NOTSPAM-collection. As all fields marked by * this field accepts a list separated by | or a specified file \'file:files/redre.txt\' .','Basic'], |
'If an email matches this Perl regular expression it will be considered redlisted. The redlist is a list of addresses that cannot contribute to the whitelist, and who are not considered local, even if their mail is from a local computer. For example, if someone goes on a vacation and turns on their email\'s autoresponder, put them on the redlist until they return. Then as they reply to every spam they receive they won\'t corrupt your non-spam collection or whitelist: \\[autoreply\\]<br> Redlisted addresses will not be added to the whitelist. Redlisted messages will not be stored in the SPAM/NOTSPAM-collection. As all fields marked by * this field accepts a list separated by | or a specified file \'file:/etc/assp/redre.txt\' .','Basic'], |
[SpamError,'Spam Error',80,textinput,'554 5.7.1 Mail appears to be unsolicited -- send error reports to postmaster@yourdomain.com','(5\d\d .*)',undef, | [SpamError,'Spam Error',80,textinput,'554 5.7.1 Mail appears to be unsolicited -- send error reports to postmaster@yourdomain.com','(5\d\d .*)',undef, |
'SMTP error message to reject spam. For example:554 5.7.1 Mail appears to be unsolicited -- send error reports to postmaster@yourdomain.com'], | 'SMTP error message to reject spam. For example:554 5.7.1 Mail appears to be unsolicited -- send error reports to postmaster@yourdomain.com'], |
| |
|
|
Valid entry types are as per spamlovers: full address, username only, or entire @domain.'], | Valid entry types are as per spamlovers: full address, username only, or entire @domain.'], |
[noProcessingIPs,'Unprocessed IPs*',60,textinput,'','(.*)',ConfigMakeRe, | [noProcessingIPs,'Unprocessed IPs*',60,textinput,'','(.*)',ConfigMakeRe, |
'Mail from any of these IPs are ignored by ASSP. <br /> | 'Mail from any of these IPs are ignored by ASSP. <br /> |
For example: 127.0.0.1|10.|169.254.|172.16.|192.168. As all fields marked by * this field accepts a list separated by | or a filename specified this way: \'file:files/ipnp.txt\' .'], |
For example: 127.0.0.1|10.|169.254.|172.16.|192.168. As all fields marked by * this field accepts a list separated by | or a filename specified this way: \'file:/etc/assp/ipnp.txt\' .'], |
[npRe,'Expression to Identify No Processing Mail*',60,textinput,'','(.*)',ConfigCompileRe, | [npRe,'Expression to Identify No Processing Mail*',60,textinput,'','(.*)',ConfigCompileRe, |
'If an email header matches this Perl regular expression it will pass | 'If an email header matches this Perl regular expression it will pass |
through unprocessed. For example: 169\.254\.122\.|172\.16\.|\\[autoreply\\].'], | through unprocessed. For example: 169\.254\.122\.|172\.16\.|\\[autoreply\\].'], |
|
|
For example: Secret Ham Password|307\D{0,3}730\D{0,3}4[12]\d\d<br /> | For example: Secret Ham Password|307\D{0,3}730\D{0,3}4[12]\d\d<br /> |
For help writing regular expressions click <a href="http://www.perlmonks.org/index.pl?node=perlre" rel="external">here</a>. | For help writing regular expressions click <a href="http://www.perlmonks.org/index.pl?node=perlre" rel="external">here</a>. |
Note that flags are "si" and the header as well as body is scanned.<br /> | Note that flags are "si" and the header as well as body is scanned.<br /> |
Some things you might include here are your office phone number or street address, spam rarely includes these details. As usual (marked by *) this field accepts a list separated by | or a filename specified this way: \'file:files/whitere.txt\' .','Basic'], |
Some things you might include here are your office phone number or street address, spam rarely includes these details. As usual (marked by *) this field accepts a list separated by | or a filename specified this way: \'file:/etc/assp/whitere.txt\' .','Basic'], |
[whiteListedIPs,'Whitelisted IPs*',60,textinput,'','(.*)',ConfigMakeRe, | [whiteListedIPs,'Whitelisted IPs*',60,textinput,'','(.*)',ConfigMakeRe, |
'They contribute to the whitelist and to notspam. For example: 127.0.0.1|10.|169.254.|172.16.|192.168. As all fields marked by * this field accepts a list separated by | or a filename specified this way: \'file:files/ipwl.txt\' .'], |
'They contribute to the whitelist and to notspam. For example: 127.0.0.1|10.|169.254.|172.16.|192.168. As all fields marked by * this field accepts a list separated by | or a filename specified this way: \'file:/etc/assp/ipwl.txt\' .'], |
[whiteListedDomains,'Whitelisted Domains*',60,textinput,'sourceforge.net','(.*)',ConfigMakeRe, | [whiteListedDomains,'Whitelisted Domains*',60,textinput,'sourceforge.net','(.*)',ConfigMakeRe, |
'Domains from which you want to receive all mail. Your ISP, domain registration, mail list servers, stock broker, or other key business partners might be good candidates. Note this matches the end of the address, so if you don\'t want to match subdomains then include the @. Note that buy.com would also match spambuy.com but .buy.com won\'t match buy.com. DO NOT put your local domains on this list. For example: sourceforge.net|@google.com|.buy.com','Basic'], | 'Domains from which you want to receive all mail. Your ISP, domain registration, mail list servers, stock broker, or other key business partners might be good candidates. Note this matches the end of the address, so if you don\'t want to match subdomains then include the @. Note that buy.com would also match spambuy.com but .buy.com won\'t match buy.com. DO NOT put your local domains on this list. For example: sourceforge.net|@google.com|.buy.com','Basic'], |
[ValidateRWL,'Enable Realtime Whitelist Validation',0,checkbox,0,'([01]?)',configUpdateRWL, | [ValidateRWL,'Enable Realtime Whitelist Validation',0,checkbox,0,'([01]?)',configUpdateRWL, |
|
|
rel="external">NET::LDAP</a> module in PERL.'], | rel="external">NET::LDAP</a> module in PERL.'], |
[ispip,'ISP/Secondary MX Servers*',60,textinput,'','(\S*)',ConfigMakeRe, | [ispip,'ISP/Secondary MX Servers*',60,textinput,'','(\S*)',ConfigMakeRe, |
'Enter any addresses that are your ISP or backup MX servers, separated by pipes (|). <br /> | 'Enter any addresses that are your ISP or backup MX servers, separated by pipes (|). <br /> |
These addresses will (necessarily) bypass Griplist, IP Limiting, Delaying, Penalty Box, SPF, RBL & SRS checks. For example: 127.0.0.1|10. You can use here the same file which is used for delay-exceptions: \'file:files/nodelay.txt\'','Basic'], |
These addresses will (necessarily) bypass Griplist, IP Limiting, Delaying, Penalty Box, SPF, RBL & SRS checks. For example: 127.0.0.1|10. You can use here the same file which is used for delay-exceptions: \'file:/etc/assp/nodelay.txt\'','Basic'], |
[ispgreyvalue,'ISP/Secondary MX Grey Value',5,textinput,'0.5','(\S*)',undef, | [ispgreyvalue,'ISP/Secondary MX Grey Value',5,textinput,'0.5','(\S*)',undef, |
'It is recommended that for ISP & Secondary MX servers to bypass their Griplist values<br /> | 'It is recommended that for ISP & Secondary MX servers to bypass their Griplist values<br /> |
For eg. 0.5 (Completely GReyIP). If left blank then the Griplist "X" value is used.<br /> | For eg. 0.5 (Completely GReyIP). If left blank then the Griplist "X" value is used.<br /> |
|
|
"The White Box is always activated. The White Box works in a similar way for IPs as the Whitelist works for addresses - but it is not a whitelist: Bayesian check will be done. WhiteBox Entries will expire after this number of days. For example: 30"], | "The White Box is always activated. The White Box works in a similar way for IPs as the Whitelist works for addresses - but it is not a whitelist: Bayesian check will be done. WhiteBox Entries will expire after this number of days. For example: 30"], |
| |
[exportExtremeFile,'Exported Black Box Extreme IPs *',40,textinput,'','(\S*)',undef, | [exportExtremeFile,'Exported Black Box Extreme IPs *',40,textinput,'','(\S*)',undef, |
'IP\'s in Black Box which surpassed the extreme level will be regularly stored to this file - if defined. It can be used, to fill safely the denysmtpfile over time. For example: file:files/exportextreme.txt'], |
'IP\'s in Black Box which surpassed the extreme level will be regularly stored to this file - if defined. It can be used, to fill safely the denysmtpfile over time. For example: file:/etc/assp/exportextreme.txt'], |
[denySMTPConnectionsFrom,'Deny SMTP Connections from these IPs*',40,textinput,'','(\S*)',ConfigMakeRe, | [denySMTPConnectionsFrom,'Deny SMTP Connections from these IPs*',40,textinput,'','(\S*)',ConfigMakeRe, |
'Manually maintained list of IPs which should be denied access. For example: file:files/denysmtp.txt'], |
'Manually maintained list of IPs which should be denied access. For example: file:/etc/assp/denysmtp.txt'], |
[DoNotPenalizeRed,'Do Not Penalize Redlisted Mails',0,checkbox,0,'([01]?)',undef, | [DoNotPenalizeRed,'Do Not Penalize Redlisted Mails',0,checkbox,0,'([01]?)',undef, |
'Mails matching Red Regex or Redlist will not be penalized.'], | 'Mails matching Red Regex or Redlist will not be penalized.'], |
[DoNotPenalizeBounces,'Do Not Penalize Bounced Mails',0,checkbox,1,'([01]?)',undef, | [DoNotPenalizeBounces,'Do Not Penalize Bounced Mails',0,checkbox,1,'([01]?)',undef, |
|
|
[DoInvalidPTR,'Reversed Lookup FQDN',1,textinput,0,'(.*)',undef, | [DoInvalidPTR,'Reversed Lookup FQDN',1,textinput,0,'(.*)',undef, |
'If activated - and Reversed Lookup is activated and found a record -, the PTR-FQDN record is checked against the Regex. This requires an installed <a href="http://search.cpan.org/search?query=Net::DNS" rel="external">Net::DNS</a> module in PERL.<br /> | 'If activated - and Reversed Lookup is activated and found a record -, the PTR-FQDN record is checked against the Regex. This requires an installed <a href="http://search.cpan.org/search?query=Net::DNS" rel="external">Net::DNS</a> module in PERL.<br /> |
<span class="negative"> 0 = deactivate, 1 = activate, 2 = log only, 3 = message-scoring .</span>','Basic'], | <span class="negative"> 0 = deactivate, 1 = activate, 2 = log only, 3 = message-scoring .</span>','Basic'], |
[invalidPTRRe,'Expression to Invalidate Format of PTR*',80,textinput,'file:files/invalidptr.txt','(.*)',ConfigCompileRe, |
[invalidPTRRe,'Expression to Invalidate Format of PTR*',80,textinput,'file:/etc/assp/invalidptr.txt','(.*)',ConfigCompileRe, |
'Validate Format PTR will check PTR records for this. <br /> | 'Validate Format PTR will check PTR records for this. <br /> |
For example: ^\d+\.\d+\.\d+\.\d+$|^[^\.]+\.?$ or file:files/invalidptr.txt'], |
For example: ^\d+\.\d+\.\d+\.\d+$|^[^\.]+\.?$ or file:/etc/assp/invalidptr.txt'], |
[DoDomainCheck,'Validate Sender Domain MX/A',1,textinput,0,'(.*)',undef, | [DoDomainCheck,'Validate Sender Domain MX/A',1,textinput,0,'(.*)',undef, |
'If activated, each sender address is checked for a valid MX/A record. | 'If activated, each sender address is checked for a valid MX/A record. |
This requires an installed <a href="http://search.cpan.org/search?query=Email::Valid" rel="external">Email::Valid</a> module in PERL.<br /> | This requires an installed <a href="http://search.cpan.org/search?query=Email::Valid" rel="external">Email::Valid</a> module in PERL.<br /> |
|
|
'Delete outdated entries from triplets and whitelisted tuplets databases every this many seconds.<br /> | 'Delete outdated entries from triplets and whitelisted tuplets databases every this many seconds.<br /> |
Note: the current timeout must expire before the new setting is loaded, or you can restart. | Note: the current timeout must expire before the new setting is loaded, or you can restart. |
Defaults to 1 hour.'], | Defaults to 1 hour.'], |
[noDelay,'Don\'t Delay these IPs*',60,textinput,'file:files/nodelay.txt','(.*)',ConfigMakeRe, |
[noDelay,'Don\'t Delay these IPs*',60,textinput,'file:/etc/assp/nodelay.txt','(.*)',ConfigMakeRe, |
'Enter IP addresses that you don\'t want to be delayed, separated by pipes (|). There are misbehaving MTAs that will not be able to get a legitimate email through a Greylisting server because they do not try again later. An INCOMPLETE list of such mailers is available at <a href="http://cvs.puremagic.com/viewcvs/greylisting/schema/whitelist_ip.txt" rel="external">cvs.puremagic.com/viewcvs/Greylisting/schema/whitelist_ip.txt</a>. <br /> | 'Enter IP addresses that you don\'t want to be delayed, separated by pipes (|). There are misbehaving MTAs that will not be able to get a legitimate email through a Greylisting server because they do not try again later. An INCOMPLETE list of such mailers is available at <a href="http://cvs.puremagic.com/viewcvs/greylisting/schema/whitelist_ip.txt" rel="external">cvs.puremagic.com/viewcvs/Greylisting/schema/whitelist_ip.txt</a>. <br /> |
When using mentioned list remember to add trailing dots in IP addresses which specify subnets (eg. 192.168 -> 192.168. ).<br /> | When using mentioned list remember to add trailing dots in IP addresses which specify subnets (eg. 192.168 -> 192.168. ).<br /> |
For example: 127.0.0.1|192.168.'], | For example: 127.0.0.1|192.168.'], |
|
|
<span class="negative"> 0 = deactivate, 1 = activate, 2 = log only, 3 = message-scoring .</span>','Basic'], | <span class="negative"> 0 = deactivate, 1 = activate, 2 = log only, 3 = message-scoring .</span>','Basic'], |
[URIBLServiceProvider,'URIBL Service Providers*',60,\&textinput,'multi.surbl.org','(.*)',configUpdateURIBLSP, | [URIBLServiceProvider,'URIBL Service Providers*',60,\&textinput,'multi.surbl.org','(.*)',configUpdateURIBLSP, |
'Domain Names of URIBLs to use separated by "|". Default is: multi.surbl.org. You may separate this in multi.uribl.com|sc.surbl.org|ws.surbl.org|ob.surbl.org|ab.surbl.org|ph.surbl.org|jp.surbl.org and set and set the max hits to 2 for an affirmative'], | 'Domain Names of URIBLs to use separated by "|". Default is: multi.surbl.org. You may separate this in multi.uribl.com|sc.surbl.org|ws.surbl.org|ob.surbl.org|ab.surbl.org|ph.surbl.org|jp.surbl.org and set and set the max hits to 2 for an affirmative'], |
[URIBLCCTLDS,'URIBL Country Code TLDs*',60,\&textinput,'file:files/URIBLCCTLDS.txt','(.*)',ConfigMakeRe, |
[URIBLCCTLDS,'URIBL Country Code TLDs*',60,\&textinput,'file:/etc/assp/URIBLCCTLDS.txt','(.*)',ConfigMakeRe, |
'List of <a href="http://spamcheck.freeapp.net/two-level-tlds" rel="external">country code TLDs</a> used to determine the base domain of the uri.'], | 'List of <a href="http://spamcheck.freeapp.net/two-level-tlds" rel="external">country code TLDs</a> used to determine the base domain of the uri.'], |
[ValidateMaxURI,'Enable maximum number of URI domains check' ,1,textinput,'1','(.*)',undef,' | [ValidateMaxURI,'Enable maximum number of URI domains check' ,1,textinput,'1','(.*)',undef,' |
<span class="negative"> 0 = deactivate, 1 = activate, 2 = log only, 3 = message-scoring .</span>'], | <span class="negative"> 0 = deactivate, 1 = activate, 2 = log only, 3 = message-scoring .</span>'], |
|
|
[DoBombRe,'<a href="http://www.asspsmtp.org/wiki/BombRe_and_ScriptRe">Use Bomb Regular Expression <img src="' . $wikiinfo . '" alt="wiki" /></a>','1',textinput,0,'(\d*)',undef, | [DoBombRe,'<a href="http://www.asspsmtp.org/wiki/BombRe_and_ScriptRe">Use Bomb Regular Expression <img src="' . $wikiinfo . '" alt="wiki" /></a>','1',textinput,0,'(\d*)',undef, |
'If activated, each message is checked against the Bomb Regular Expression. <br /> | 'If activated, each message is checked against the Bomb Regular Expression. <br /> |
<span class="negative"> 0 = deactivate, 1 = activate, 2 = log only, 3 = message-scoring .</span>'], | <span class="negative"> 0 = deactivate, 1 = activate, 2 = log only, 3 = message-scoring .</span>'], |
[bombRe,'Bomb Regular Expression*',80,textinput,'file:files/bombre.txt','(.*)',ConfigCompileRe,'Header and Data will be checked against the Regex. For example:<br />IMG [^>]*src=[\'"]cid|<BODY[^>]*>(<[^>]+>|\n|\r)*<IMG[^>]+>(<[^>]+>|\n|\r)*</BODY>'], |
[bombRe,'Bomb Regular Expression*',80,textinput,'file:/etc/assp/bombre.txt','(.*)',ConfigCompileRe,'Header and Data will be checked against the Regex. For example:<br />IMG [^>]*src=[\'"]cid|<BODY[^>]*>(<[^>]+>|\n|\r)*<IMG[^>]+>(<[^>]+>|\n|\r)*</BODY>'], |
| |
[noBombScript,'Don\'t Check Messages from these Addresses*',60,textinput,'','(.*)',ConfigMakeRe, | [noBombScript,'Don\'t Check Messages from these Addresses*',60,textinput,'','(.*)',ConfigMakeRe, |
'Don\'t detect spam bombs or scripts in messages from these addresses. Valid entry types are as per spamlovers.'], | 'Don\'t detect spam bombs or scripts in messages from these addresses. Valid entry types are as per spamlovers.'], |
|
|
[logfile,'ASSP Logfile',40,textinput,'logs/maillog.txt','(\S*)',ConfigChangeLogfile, | [logfile,'ASSP Logfile',40,textinput,'logs/maillog.txt','(\S*)',ConfigChangeLogfile, |
'Blank if you don\'t want a log file. Change it to maillog.log if you don\'t want auto rollover. | 'Blank if you don\'t want a log file. Change it to maillog.log if you don\'t want auto rollover. |
NOTE: Changing this field requires restarting ASSP before changes take effect.'], | NOTE: Changing this field requires restarting ASSP before changes take effect.'], |
[pidfile,'PID File',40,textinput,'pid','(\S*)',undef,'Blank to skip writing a pid file. *nix users need pid files. |
[pidfile,'PID File',40,textinput,'asspd.pid','(\S*)',undef,'Blank to skip writing a pid file. *nix users need pid files. |
Leave it blank in Windows.<br /> You have to restart the service before you get a pid file in the new location.<br /><hr /><div class=\"menuLevel1\">Notes On File Path</div><input type="button" value="Notes" onClick="javascript:popFileEditor(\'notes/filepath.txt\',3);">'], | Leave it blank in Windows.<br /> You have to restart the service before you get a pid file in the new location.<br /><hr /><div class=\"menuLevel1\">Notes On File Path</div><input type="button" value="Notes" onClick="javascript:popFileEditor(\'notes/filepath.txt\',3);">'], |
[0,0,0,'heading','Collecting'], | [0,0,0,'heading','Collecting'], |
[spamaddresses,'Spam Collect Addresses* ',60,textinput,'put|your@spambucket.com|addresses|@here.org','(.*)',ConfigMakeRe, | [spamaddresses,'Spam Collect Addresses* ',60,textinput,'put|your@spambucket.com|addresses|@here.org','(.*)',ConfigMakeRe, |
|
|
[0,0,0,'heading','Server Setup'], | [0,0,0,'heading','Server Setup'], |
[AsAService,'Run ASSP as a Windows Service**',0,checkbox,0,'([01]?)',undef, | [AsAService,'Run ASSP as a Windows Service**',0,checkbox,0,'([01]?)',undef, |
'In Windows NT/2000/XP/2003 ASSP can be installed as a service. This setting tells ASSP that this has been done -- it does not install the Windows service for you. Installing ASSP as a service requires several steps which are detailed in the <a href="http://www.asspsmtp.org/wiki/Quick_Start_for_Win32">Quick Start for Win32</a> wiki page.','Basic'], | 'In Windows NT/2000/XP/2003 ASSP can be installed as a service. This setting tells ASSP that this has been done -- it does not install the Windows service for you. Installing ASSP as a service requires several steps which are detailed in the <a href="http://www.asspsmtp.org/wiki/Quick_Start_for_Win32">Quick Start for Win32</a> wiki page.','Basic'], |
[AsADaemon,'Run ASSP as a Daemon**',0,checkbox,0,'([01]?)',undef, |
[AsADaemon,'Run ASSP as a Daemon**',0,checkbox,1,'([01]?)',undef, |
'In Linux/BSD/Unix/OSX fork and close file handles. Similar to the command "perl assp.pl &", but better.','Basic'], | 'In Linux/BSD/Unix/OSX fork and close file handles. Similar to the command "perl assp.pl &", but better.','Basic'], |
[runAsUser,'Run as UID**',20,textinput,'','(\S*)',undef, |
[runAsUser,'Run as UID**',20,textinput,'assp','(\S*)',undef, |
'The *nix user name to assume after startup (*nix only).<p><small><i>Examples:</i> assp, nobody</small>','Basic'], | 'The *nix user name to assume after startup (*nix only).<p><small><i>Examples:</i> assp, nobody</small>','Basic'], |
[runAsGroup,'Run as GID**',20,textinput,'','(\S*)',undef, |
[runAsGroup,'Run as GID**',20,textinput,'assp','(\S*)',undef, |
'The *nix group to assume after startup (*nix only).<p><small><i>Examples:</i> assp, nobody</small>','Basic'], | 'The *nix group to assume after startup (*nix only).<p><small><i>Examples:</i> assp, nobody</small>','Basic'], |
[ChangeRoot,'Change Root**',40,textinput,'','(.*)',undef, | [ChangeRoot,'Change Root**',40,textinput,'','(.*)',undef, |
'The new root directory to which ASSP should chroot (*nix only). If blank, no chroot jail will be used. Note: if you use this feature, be sure to copy or link the etc/protocols file in your chroot jail.','Basic'], | 'The new root directory to which ASSP should chroot (*nix only). If blank, no chroot jail will be used. Note: if you use this feature, be sure to copy or link the etc/protocols file in your chroot jail.','Basic'], |
|
|
} | } |
} | } |
# load configuration file | # load configuration file |
open(F,"<$base/assp.cfg"); local $/; (%Config)=split(/:=|\n/,<F>); close F; |
open(F,"</etc/assp/assp.cfg"); local $/; (%Config)=split(/:=|\n/,<F>); close F; |
# set nonexistent settings to default values | # set nonexistent settings to default values |
foreach $c (@Config) { | foreach $c (@Config) { |
if ($c->[0] && !(exists $Config{$c->[0]})) { | if ($c->[0] && !(exists $Config{$c->[0]})) { |
|
|
$silent=1; | $silent=1; |
} | } |
| |
if($pidfile) {open(F,">$base/$pidfile"); print F $$; close F;} |
if($pidfile) {open(F,">/var/run/assp/$pidfile"); print F $$; close F;} |
| |
sub RemovePid { | sub RemovePid { |
if ($pidfile) { | if ($pidfile) { |
d('RemovePid'); | d('RemovePid'); |
unlink("$base/$pidfile"); |
unlink("/var/run/assp/$pidfile"); |
} | } |
} | } |
| |
if($DEBUG) {open(DEBUG, ">$base/".time.".dbg"); binmode(DEBUG); my $oldfh = select(DEBUG); $| = 1; select($oldfh);} | if($DEBUG) {open(DEBUG, ">$base/".time.".dbg"); binmode(DEBUG); my $oldfh = select(DEBUG); $| = 1; select($oldfh);} |
my $logdir = $1 if $logfile=~/(.*)\/.*/; | my $logdir = $1 if $logfile=~/(.*)\/.*/; |
mkdir "$base/$logdir",0777 if $logdir; |
mkdir "$logdir",0777 if $logdir; |
if($logfile && open(LOG,">>$base/$logfile")) {my $oldfh = select(LOG); $| = 1; select($oldfh);} |
if($logfile && open(LOG,">>$logfile")) {my $oldfh = select(LOG); $| = 1; select($oldfh);} |
| |
if($AsAService) { | if($AsAService) { |
eval(<<'EOT'); | eval(<<'EOT'); |
|
|
switchUsers($uid,$gid) if ($runAsUser || $runAsGroup); | switchUsers($uid,$gid) if ($runAsUser || $runAsGroup); |
SaveConfig(); | SaveConfig(); |
# create folders if they're missing | # create folders if they're missing |
-d "$base/$spamlog" or mkdir "$base/$spamlog",0700; |
-d "/var/lib/assp/$spamlog" or mkdir "/var/lib/assp/$spamlog",0700; |
-d "$base/$notspamlog" or mkdir "$base/$notspamlog",0700; |
-d "/var/lib/assp/$notspamlog" or mkdir "/var/lib/assp/$notspamlog",0700; |
-d "$base/$incomingOkMail" or mkdir "$base/$incomingOkMail",0700; |
-d "/var/lib/assp/$incomingOkMail" or mkdir "/var/lib/assp/$incomingOkMail",0700; |
-d "$base/$viruslog" or mkdir "$base/$viruslog",0700; |
-d "/var/lib/assp/$viruslog" or mkdir "/var/lib/assp/$viruslog",0700; |
-d "$base/files" or mkdir "$base/files",0777; |
-d "/var/lib/assp/files" or mkdir "/var/lib/assp/files",0777; |
-d "$base/logs" or mkdir "$base/logs",0777; |
-d "/var/lib/assp/logs" or mkdir "/var/lib/assp/logs",0777; |
my $dir=$correctedspam; | my $dir=$correctedspam; |
$dir=~s/\/.*?$//; | $dir=~s/\/.*?$//; |
-d "$base/$dir" or mkdir "$base/$dir",0700; |
-d "/var/lib/assp/$dir" or mkdir "/var/lib/assp/$dir",0700; |
-d "$base/$correctedspam" or mkdir "$base/$correctedspam",0700; |
-d "/var/lib/assp/$correctedspam" or mkdir "/var/lib/assp/$correctedspam",0700; |
-d "$base/$correctednotspam" or mkdir "$base/$correctednotspam",0700; |
-d "/var/lib/assp/$correctednotspam" or mkdir "/var/lib/assp/$correctednotspam",0700; |
my $pbdir = $1 if $pbdb=~/(.*)\/.*/; | my $pbdir = $1 if $pbdb=~/(.*)\/.*/; |
mkdir "$base/$pbdir",0700 if $pbdir; | mkdir "$base/$pbdir",0700 if $pbdir; |
-d "$base/notes" or mkdir "$base/notes",0777; |
-d "/etc/assp/notes" or mkdir "$base/notes",0770; |
if ( !-e "$base/reports/whitereport.txt") { |
if ( !-e "/etc/assp/reports/whitereport.txt") { |
-d "$base/reports" or mkdir "$base/reports",0777; |
-d "/etc/assp/reports" or mkdir "/etc/assp/reports",0770; |
copy("whitereport.txt", "reports/whitereport.txt"); |
copy("/usr/share/assp/whitereport.txt", "/etc/assp/reports/whitereport.txt"); |
copy("whiteremovereport.txt", "reports/whiteremovereport.txt"); |
copy("/usr/share/assp/whiteremovereport.txt", "/etc/assp/reports/whiteremovereport.txt"); |
copy("redreport.txt", "reports/redreport.txt"); |
copy("/usr/share/assp/redreport.txt", "/etc/assp/reports/redreport.txt"); |
copy("redremovereport.txt", "reports/redremovereport.txt"); |
copy("/usr/share/assp/redremovereport.txt", "/etc/assp/reports/redremovereport.txt"); |
copy("helpreport.txt", "reports/helpreport.txt"); |
copy("/usr/share/assp/helpreport.txt", "/etc/assp/reports/helpreport.txt"); |
copy("notspamreport.txt", "reports/notspamreport.txt"); |
copy("/usr/share/assp/notspamreport.txt", "/etc/assp/reports/notspamreport.txt"); |
copy("spamreport.txt", "reports/spamreport.txt"); |
copy("/usr/share/assp/spamreport.txt", "/etc/assp/reports/spamreport.txt"); |
} | } |
| |
| |
|
|
# roll log every $LogRollDays days, at midnight | # roll log every $LogRollDays days, at midnight |
my $t=int((time()+Time::Local::timelocal(localtime())-Time::Local::timelocal(gmtime()))/($LogRollDays*24*3600)); | my $t=int((time()+Time::Local::timelocal(localtime())-Time::Local::timelocal(gmtime()))/($LogRollDays*24*3600)); |
| |
if($logfile && $mlogLastT && $t != $mlogLastT && $logfile ne "maillog.log" && $asspLog) { |
if($logfile && $mlogLastT && $t != $mlogLastT && $logfile ne "/var/log/assp/maillog.log" && $asspLog) { |
# roll the log | # roll the log |
my $backt=time - 1800; | my $backt=time - 1800; |
my ($sec,$min,$hour,$mday,$mon,$year) = localtime($backt); | my ($sec,$min,$hour,$mday,$mon,$year) = localtime($backt); |
|
|
if (!$logdir) { | if (!$logdir) { |
$archivelogfile = "$mm.$logfile"; | $archivelogfile = "$mm.$logfile"; |
} else { | } else { |
mkdir "$base/$logdir",0777; |
mkdir "$logdir",0777; |
$archivelogfile = "$logdir/$mm.$logdirfile"; | $archivelogfile = "$logdir/$mm.$logdirfile"; |
} | } |
my $msg="$m: Rolling log file -- archive saved as '$archivelogfile'\n"; | my $msg="$m: Rolling log file -- archive saved as '$archivelogfile'\n"; |
|
|
print $msg unless $silent; | print $msg unless $silent; |
| |
close LOG; | close LOG; |
rename("$base/$logfile", "$base/$archivelogfile"); |
rename("$logfile", "$archivelogfile"); |
if(open(LOG,">>$base/$logfile")) {my $oldfh = select(LOG); $| = 1; select($oldfh);} |
if(open(LOG,">>$logfile")) {my $oldfh = select(LOG); $| = 1; select($oldfh);} |
print LOG "$m new log file -- old log file renamed to '$archivelogfile'\n"; | print LOG "$m new log file -- old log file renamed to '$archivelogfile'\n"; |
SaveConfig(); | SaveConfig(); |
} | } |
|
|
return 1; | return 1; |
} | } |
my ($per_result, $smtp_comment, $header_comment, $spf_fail); | my ($per_result, $smtp_comment, $header_comment, $spf_fail); |
foreach my $recip (split(' ', $this->{rcpt})) { |
foreach my $recip (split('/var/lib/assp/', $this->{rcpt})) { |
($per_result, $smtp_comment, $header_comment, $spf_fail) = | ($per_result, $smtp_comment, $header_comment, $spf_fail) = |
$query->result2($recip); | $query->result2($recip); |
# Keep processing SPF records until all recipients are checked | # Keep processing SPF records until all recipients are checked |
|
|
| |
| |
| |
ReturnMail($this->{mailfrom},"$base/$file",$sub,"$this->{rcpt}\n\n$this->{report}\n") if ($EmailErrorsReply==1 || $EmailErrorsReply==3); |
ReturnMail($this->{mailfrom},"/etc/assp/$file",$sub,"$this->{rcpt}\n\n$this->{report}\n") if ($EmailErrorsReply==1 || $EmailErrorsReply==3); |
ReturnMail($EmailErrorsTo,"$base/$file",$sub,"$this->{rcpt}\n\n$this->{report}\n",$this->{mailfrom}) if ($EmailErrorsTo && ($EmailErrorsReply==2 || $EmailErrorsReply==3)); |
ReturnMail($EmailErrorsTo,"/etc/assp/$file",$sub,"$this->{rcpt}\n\n$this->{report}\n",$this->{mailfrom}) if ($EmailErrorsTo && ($EmailErrorsReply==2 || $EmailErrorsReply==3)); |
| |
stateReset($fh); | stateReset($fh); |
$this->{getline}=\&getline; | $this->{getline}=\&getline; |
|
|
| |
if (($this->{reporttype}==2) || ($this->{reporttype}==3)) { | if (($this->{reporttype}==2) || ($this->{reporttype}==3)) { |
| |
ReturnMail($this->{mailfrom},"$base/$file",'',"$this->{rcpt}\n\n$this->{report}\n") if ($EmailWhitelistReply==1 || $EmailWhitelistReply==3); |
ReturnMail($this->{mailfrom},"/etc/assp/$file",'',"$this->{rcpt}\n\n$this->{report}\n") if ($EmailWhitelistReply==1 || $EmailWhitelistReply==3); |
| |
ReturnMail($EmailWhitelistTo,"$base/$file",'',"$this->{rcpt}\n\n$this->{report}\n",$this->{mailfrom}) if ( $EmailWhitelistTo && ($EmailWhitelistReply==2 || $EmailWhitelistReply==3)); |
ReturnMail($EmailWhitelistTo,"/etc/assp/$file",'',"$this->{rcpt}\n\n$this->{report}\n",$this->{mailfrom}) if ( $EmailWhitelistTo && ($EmailWhitelistReply==2 || $EmailWhitelistReply==3)); |
} else { | } else { |
ReturnMail($this->{mailfrom},"$base/$file",'',"$this->{rcpt}\n\n$this->{report}\n") if ($EmailRedlistReply==1 || $EmailRedlistReply==3); |
ReturnMail($this->{mailfrom},"/etc/assp/$file",'',"$this->{rcpt}\n\n$this->{report}\n") if ($EmailRedlistReply==1 || $EmailRedlistReply==3); |
| |
ReturnMail($EmailRedlistTo,"$base/$file",'',"$this->{rcpt}\n\n$this->{report}\n",$this->{mailfrom}) if ( $EmailRedlistTo && ($EmailRedlistReply==2 || $EmailRedlistReply==3)); |
ReturnMail($EmailRedlistTo,"/etc/assp/$file",'',"$this->{rcpt}\n\n$this->{report}\n",$this->{mailfrom}) if ( $EmailRedlistTo && ($EmailRedlistReply==2 || $EmailRedlistReply==3)); |
} | } |
delete $this->{report}; | delete $this->{report}; |
stateReset($fh); | stateReset($fh); |
|
|
my $file=($this->{reporttype}==0) ? "reports/spamreport.txt" : "reports/notspamreport.txt"; | my $file=($this->{reporttype}==0) ? "reports/spamreport.txt" : "reports/notspamreport.txt"; |
| |
| |
ReturnMail($this->{mailfrom},"$base/$file",$sub,"$this->{rcpt}\n\n$this->{report}\n") if ($EmailErrorsReply==1 || $EmailErrorsReply==3); |
ReturnMail($this->{mailfrom},"/etc/assp/$file",$sub,"$this->{rcpt}\n\n$this->{report}\n") if ($EmailErrorsReply==1 || $EmailErrorsReply==3); |
ReturnMail($EmailErrorsTo,"$base/$file",$sub,"$this->{rcpt}\n\n$this->{report}\n",$this->{mailfrom}) if ($EmailErrorsTo && ($EmailErrorsReply==2 || $EmailErrorsReply==3)); |
ReturnMail($EmailErrorsTo,"/etc/assp/$file",$sub,"$this->{rcpt}\n\n$this->{report}\n",$this->{mailfrom}) if ($EmailErrorsTo && ($EmailErrorsReply==2 || $EmailErrorsReply==3)); |
| |
delete $this->{report}; | delete $this->{report}; |
stateReset($fh); | stateReset($fh); |
|
|
$a{lc $1}=1; | $a{lc $1}=1; |
} | } |
} | } |
foreach $a (split(' ',lc $this->{rcpt})) { |
foreach $a (split('/var/lib/assp/',lc $this->{rcpt})) { |
$a{$a}=1; | $a{$a}=1; |
} | } |
foreach $a (keys %a) { | foreach $a (keys %a) { |
|
|
$Stats{rblfails}=0; | $Stats{rblfails}=0; |
$Stats{uriblfails}=0; | $Stats{uriblfails}=0; |
| |
open(F,"<$base/asspstats.sav"); |
open(F,"</var/lib/assp/asspstats.sav"); |
(%OldStats)=split(/\001/,<F>); | (%OldStats)=split(/\001/,<F>); |
close F; | close F; |
# conversion from previous versions | # conversion from previous versions |
|
|
} | } |
} | } |
$AllStats{starttime}=$OldStats{starttime} || $Stats{starttime}; | $AllStats{starttime}=$OldStats{starttime} || $Stats{starttime}; |
open(F,">$base/asspstats.sav"); |
open(F,">/var/lib/assp/asspstats.sav"); |
print F join("\001",%AllStats); | print F join("\001",%AllStats); |
close F; | close F; |
} | } |
|
|
if($UseSubjectsAsMaillogNames || $isspam==2 || $isspam==3) { | if($UseSubjectsAsMaillogNames || $isspam==2 || $isspam==3) { |
| |
$sub.="--".(++$Counter); | $sub.="--".(++$Counter); |
return "$base/$maillog/$sub$maillogExt"; |
return "/var/lib/assp/$maillog/$sub$maillogExt"; |
} else { | } else { |
my $fn=(time + $Counter++ ) % $MaxFiles; | my $fn=(time + $Counter++ ) % $MaxFiles; |
"$base/$maillog/$fn$maillogExt"; |
"var/lib/assp/$maillog/$fn$maillogExt"; |
} | } |
} | } |
| |
|
|
if($1 eq 'R') { | if($1 eq 'R') { |
$qs{list}="red"; # update radios | $qs{list}="red"; # update radios |
$RedlistObject->flush() if $RedlistObject && $redlistdb !~ /mysql/; | $RedlistObject->flush() if $RedlistObject && $redlistdb !~ /mysql/; |
open(F,"<$base/$redlistdb"); |
open(F,"<$redlistdb"); |
$s.='<div class="textbox"><b>Redlist</b></div>'; | $s.='<div class="textbox"><b>Redlist</b></div>'; |
} else { | } else { |
$qs{list}="white"; # update radios | $qs{list}="white"; # update radios |
$WhitelistObject->flush() if $WhitelistObject && $whitelistdb !~ /mysql/; | $WhitelistObject->flush() if $WhitelistObject && $whitelistdb !~ /mysql/; |
open(F,"<$base/$whitelistdb") if $whitelistdb !~ /mysql/; |
open(F,"<$whitelistdb") if $whitelistdb !~ /mysql/; |
$s.='<div class="textbox"><b>Whitelist</b></div>'; | $s.='<div class="textbox"><b>Whitelist</b></div>'; |
if ($whitelistdb =~ /mysql/) { | if ($whitelistdb =~ /mysql/) { |
$s.='<div class="textbox"><b>mysql</b></div>'; | $s.='<div class="textbox"><b>mysql</b></div>'; |
|
|
$m=~s/^... (...) +(\d+) (\S+) ..(..)/$1-$2-$4 $3 /; | $m=~s/^... (...) +(\d+) (\S+) ..(..)/$1-$2-$4 $3 /; |
my $indent=" " x length($m); | my $indent=" " x length($m); |
if(!$pat) { | if(!$pat) { |
open(F,"<$base/$logfile"); |
open(F,"<$logfile"); |
seek(F,-$MaillogTailBytes,2) || seek(F,0,0); | seek(F,-$MaillogTailBytes,2) || seek(F,0,0); |
local $/; | local $/; |
$s=<F>; | $s=<F>; |
|
|
my $lines=0; | my $lines=0; |
my $files=0; | my $files=0; |
my ($logdir, $logdirfile) = $logfile=~/^(.*[\/\\])?(.*?)$/; | my ($logdir, $logdirfile) = $logfile=~/^(.*[\/\\])?(.*?)$/; |
my @logfiles=reverse sort glob("$base/$logdir*$logdirfile"); |
my @logfiles=reverse sort glob("/var/lib/assp/$logdir*$logdirfile"); |
my $logf=File::ReadBackwards->new(shift(@logfiles),'(?:\r?\n|\r)',1); # line terminator regex | my $logf=File::ReadBackwards->new(shift(@logfiles),'(?:\r?\n|\r)',1); # line terminator regex |
if ($logf) { | if ($logf) { |
$files++; | $files++; |
|
|
my %replace; | my %replace; |
my $j=0; | my $j=0; |
my $highlightExpr='=~s/('; | my $highlightExpr='=~s/('; |
foreach (map/^([^-].*)/, split(' ',$pat)) { |
foreach (map/^([^-].*)/, split('/var/lib/assp',$pat)) { |
$replace{lc $_}=$highlights[$j % @highlights]; # pick highlight style | $replace{lc $_}=$highlights[$j % @highlights]; # pick highlight style |
$highlightExpr.=quotemeta($_).'|'; | $highlightExpr.=quotemeta($_).'|'; |
if ($MaillogTailWrapColumn>0) { | if ($MaillogTailWrapColumn>0) { |
|
|
| |
else { | else { |
#$fil="$base/$fil" if $fil!~/^(([a-z]:)?[\/\\]|\Q$base\E)/; | #$fil="$base/$fil" if $fil!~/^(([a-z]:)?[\/\\]|\Q$base\E)/; |
$fil="$base/$fil" if $fil!~/^\Q$base\E/i; |
$fil="/var/lib/assp/$fil" if $fil!~/^\Q\/var\/lib\/assp\/\E/i; |
if ($qs{B1}=~/delete/i) { | if ($qs{B1}=~/delete/i) { |
unlink($fil); | unlink($fil); |
} | } |
|
|
$s2='<div class="text"><span class="positive">File saved successfully</span></div>'; | $s2='<div class="text"><span class="positive">File saved successfully</span></div>'; |
} | } |
} | } |
if(open(F,"<$fil")) { |
if(open(F,"</var/lib/assp/$fil")) { |
local $/; | local $/; |
$s1=<F>; | $s1=<F>; |
# make line terminators uniform | # make line terminators uniform |
|
|
EOT | EOT |
} | } |
| |
if ($fil !~ /^\Q$base\E/i) { |
if ($fil !~ /^\Q\/etc\/assp\/\E/i) { |
$fil="$base/$fil"; |
$fil="/usr/share/assp/$fil"; |
} | } |
if (-e $fil) { | if (-e $fil) { |
my $mtime; | my $mtime; |
|
|
} | } |
| |
sub SaveConfig { | sub SaveConfig { |
rename("$base/assp.cfg.bak","$base/assp.cfg.bak.bak"); |
rename("/etc/assp/assp.cfg.bak","/etc/assp/assp.cfg.bak.bak"); |
rename("$base/assp.cfg","$base/assp.cfg.bak"); |
rename("/etc/assp/assp.cfg","/etc/assp/assp.cfg.bak"); |
open(F,">$base/assp.cfg"); |
open(F,">/etc/assp/assp.cfg"); |
foreach (sort keys %Config) {print F "$_:=$Config{$_}\n";} | foreach (sort keys %Config) {print F "$_:=$Config{$_}\n";} |
close F; | close F; |
chmod(0666,"$base/assp.cfg"); |
chmod(0666,"/etc/assp/assp.cfg"); |
PrintConfigSettings(); | PrintConfigSettings(); |
} | } |
sub backupFile { | sub backupFile { |
|
|
my $f=shift; | my $f=shift; |
my $bf=$f; $bf=~s/.*[\\\/]|/bak\//; | my $bf=$f; $bf=~s/.*[\\\/]|/bak\//; |
my $i=$BackupCopies-1; | my $i=$BackupCopies-1; |
unlink("$base/$bf.$i"); |
unlink("/etc/assp/$bf.$i"); |
for (; $i>0; $i--) { rename("$base/$bf.".($i-1),"$base/$bf.$i"); } | for (; $i>0; $i--) { rename("$base/$bf.".($i-1),"$base/$bf.$i"); } |
rename($f,"$base/$bf.0"); |
rename($f,"/etc/assp/$bf.0"); |
} | } |
| |
sub textinput {my ($name,$nicename,$size,$func,$default,$valid,$onchange,$description,$cssoption)=@_; | sub textinput {my ($name,$nicename,$size,$func,$default,$valid,$onchange,$description,$cssoption)=@_; |
|
|
} | } |
sub PrintConfigSettings { | sub PrintConfigSettings { |
| |
open(F,">$base/changeddefaults.txt"); |
open(F,">/var/lib/assp/changeddefaults.txt"); |
foreach $c (@Config) { | foreach $c (@Config) { |
print F "S e c t i o n: $c->[4] \n" if $c->[0] eq "0"; | print F "S e c t i o n: $c->[4] \n" if $c->[0] eq "0"; |
next if $c->[0] eq "0"; | next if $c->[0] eq "0"; |
|
|
print F "$c->[0] -- $desc: $Config{$c->[0]} \n"; | print F "$c->[0] -- $desc: $Config{$c->[0]} \n"; |
}} | }} |
close F; | close F; |
chmod(0666,"$base/changeddefaults.txt"); |
chmod(0666,"/var/lib/assp/changeddefaults.txt"); |
open(F,">$base/description.txt"); |
open(F,">/var/lib/assp/description.txt"); |
foreach $c (@Config) { | foreach $c (@Config) { |
$desc=$c->[7]; | $desc=$c->[7]; |
$desc=~ s/\<.*\>//g; | $desc=~ s/\<.*\>//g; |
|
|
| |
} | } |
close F; | close F; |
chmod(0666,"$base/description.txt"); |
chmod(0666,"/var/lib/assp/description.txt"); |
} | } |
# This function is called on startup to clean up some settings | # This function is called on startup to clean up some settings |
# Primarily these are settings that might be absent from assp.cfg | # Primarily these are settings that might be absent from assp.cfg |
|
|
if ($value=~/^ *file: *(.+)/i) { | if ($value=~/^ *file: *(.+)/i) { |
# the option list is actually saved in a file. | # the option list is actually saved in a file. |
$fromfile=1; | $fromfile=1; |
my $fil=$1; $fil="$base/$fil" if $fil!~/^\Q$base\E/i; |
my $fil=$1; $fil="$base/$fil" if $fil!~/^\Q\/etc\/assp\/\E/i; |
local $/; | local $/; |
my @s=stat($fil); | my @s=stat($fil); |
my $mtime=$s[9]; | my $mtime=$s[9]; |
|
|
sub fileUpdated { | sub fileUpdated { |
my $fil=shift; | my $fil=shift; |
| |
$fil="$base/$fil" if $fil!~/^(([a-z]:)?[\/\\]|\Q$base\E)/; |
$fil="$base/$fil" if $fil!~/^(([a-z]:)?[\/\\]|\Q\/etc\/assp\/\E)/; |
#$fil="$base/$fil" if $fil!~/^\Q$base\E/i; | #$fil="$base/$fil" if $fil!~/^\Q$base\E/i; |
return 1 unless $FileUpdate{$fil}; | return 1 unless $FileUpdate{$fil}; |
my @s=stat($fil); | my @s=stat($fil); |
|
|
sub ConfigChangeLogfile {my ($name, $old, $new)=@_; | sub ConfigChangeLogfile {my ($name, $old, $new)=@_; |
close LOG if $logfile; | close LOG if $logfile; |
$logfile=$new; | $logfile=$new; |
if($logfile && open(LOG,">>$base/$logfile")) {my $oldfh = select(LOG); $| = 1; select($oldfh);} |
if($logfile && open(LOG,">>$logfile")) {my $oldfh = select(LOG); $| = 1; select($oldfh);} |
mlog(0,"log file changed to '$new' from '$old' per admin request"); | mlog(0,"log file changed to '$new' from '$old' per admin request"); |
''; | ''; |
} | } |
|
|
# called on SIG HUP | # called on SIG HUP |
my %newConfig; | my %newConfig; |
mlog(0,"sig HUP -- reloading config"); | mlog(0,"sig HUP -- reloading config"); |
open(F,"<$base/assp.cfg"); local $/; (%newConfig)=split(/:=|\n/,<F>); close F; |
open(F,"</etc/assp/assp.cfg"); local $/; (%newConfig)=split(/:=|\n/,<F>); close F; |
foreach $c (@Config) { | foreach $c (@Config) { |
my ($name,$nicename,$size,$func,$default,$valid,$onchange,$description)=@$c; | my ($name,$nicename,$size,$func,$default,$valid,$onchange,$description)=@$c; |
if($Config{$name} ne $newConfig{$name}) { | if($Config{$name} ne $newConfig{$name}) { |
|
|
} | } |
# reopen log file, just for fun. | # reopen log file, just for fun. |
close LOG; | close LOG; |
if(open(LOG,">>$base/$logfile")) {my $oldfh = select(LOG); $| = 1; select($oldfh);} |
if(open(LOG,">>$logfile")) {my $oldfh = select(LOG); $| = 1; select($oldfh);} |
print LOG "Logfile reopened on HUP\n"; | print LOG "Logfile reopened on HUP\n"; |
} | } |
| |