$def{'PATH_ALIAS'} = 'Alias '.$set{'interface_path'}.' '.$wwwpath;
$def{'BOT_CRONTAB'} = $set{'bot_crontab'}.' '.$set{'bin_path'}.'bot'.(($set{'bot_args'} ne '')?(' '.$set{'bot_args'}):'').' >'.$set{'log_path'}.'bot.log';
-$def{'RM_ACCESS_CRONTAB'} = $set{'rm_access_crontab'}.' '.$set{'rm'}.' '.$set{'data_path'}.'access/*';
+$def{'RM_ACCESS_CRONTAB'} = $set{'rm_access_crontab'}.' '.$set{'bin_path'}.'rmaccess';
$def{'OLDLOGS_CRONTAB'} = $set{'oldlogs_crontab'}.' '.$set{'proxy_bin_path'}.'oldlogs '.$set{'log_path'}.' '.$set{'log_size_limit'}.' '.$set{'logs_total'}.' '.$set{'logs_uncompressed'};
$def{'CC'} = 'CC='.$set{'gcc'};
###PERL;
# interface.pl is generated from interface.1.pl
-# 02.01.2015
+# 05.01.2015
#
# This is the software of the facebook interface, to access archived groups,
# threads, images, etc.
}
# if password confirmed create the key and the access file
- $key=key(KEY_BITS);
+ $key=$time.'f'.key(KEY_BITS);
$accesspath=ACCESS_PATH.$key;
open ($accessfile,">",$accesspath) or return loginpage("Couldn't create temporary file $accesspath.","Status: 500 Internal Server Error\n");
all: moveout moveoutlib copyoutwww remove config.txt
-moveout: bot interface interface.pl setuid exec
- $(MV) bot interface interface.pl $(OD)
+moveout: bot interface interface.pl rmaccess setuid exec
+ $(MV) bot interface interface.pl rmaccess $(OD)
moveoutlib: facebug_lib.pm setuid exec
$(MV) facebug_lib.pm $(LD)
setuid: interface
$(CM) u+s interface
-exec: bot interface.pl
- $(CM) +x bot interface.pl
+exec: bot interface.pl rmaccess
+ $(CM) +x bot interface.pl rmaccess
remove: interface interface.c copyoutwww moveout moveoutlib setuid exec
$(RM) interface.c
bot: bot.1.pl configure.pl settings
$(PL) configure.pl settings <bot.1.pl >bot
+rmaccess: rmaccess.1.pl configure.pl settings
+ $(PL) configure.pl settings <rmaccess.1.pl >rmaccess
+
config.txt: config.1.txt configure.pl settings
$(PL) configure.pl settings <config.1.txt >config.txt
--- /dev/null
+###PERL;
+
+# rmaccess is generated from rmaccess.1.pl.
+# 05.01.2016
+#
+# This script removes old access files.
+#
+# Copyright (C) 2015-2016 Balthasar SzczepaĆski
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+###ACCESS_PATH;
+###TIMEOUT_UNLOCK;
+###TIMEOUT_INACT;
+
+my $time = time();
+srand ($time-$$);
+
+my $dir;
+my $path;
+my $unlocktime;
+my $lasttime;
+my $timeout_unlock = TIMEOUT_UNLOCK*60;
+my $timeout_inact = TIMEOUT_INACT*60;
+
+if (opendir ($dir, ACCESS_PATH)) {
+ while (defined($path = readdir $dir)) {
+ if (open ($file, '<', ACCESS_PATH.$path)) {
+ $unlocktime=<$accessfile>;
+ $lasttime=<$accessfile>;
+ close($file);
+
+ if (($unlocktime !~ /^([0-9]+)$/) || ($lasttime !~ /^([0-9]+)$/)) {
+ unlink (ACCESS_PATH.$path);
+ }
+ elsif ((abs($time-$unlocktime)>$timeout_unlock) or (abs($time-$lasttime)>$timeout_inact)){
+ unlink (ACCESS_PATH.$path);
+ }
+ }
+ }
+ closedir($dir);
+}
#not a directory path
#Time in minutes
-timeout_unlock = 90 # log out this many minutes after logging in
-timeout_inact = 30 # log out this many minutes after last activity
+timeout_unlock = 51840 # log out this many minutes after logging in
+timeout_inact = 2160 # log out this many minutes after last activity
path = /usr/local/bin:/usr/bin:/bin #The path environment variable. Must be
#overwritten if SETUID. Otherwise