Commit 3bfc1f5a authored by johan's avatar johan

Add crontab configuration to clean the upload tmp dir

+ publish package in public repository
parent 0459b47f
Pipeline #14048 passed with stages
in 39 seconds
......@@ -2,10 +2,6 @@
# Base configuration
#################################################
variables:
DEPLOY_SERVER: buildbot@www.linphone.org
CENTOS7_DEPLOY_DIRECTORY: snapshots-private/centos7
job-centos7-rpm:
tags: [ "docker" ]
......
......@@ -13,6 +13,8 @@ rpm:
cp httpd/flexisip-http-file-transfer-server.conf $(OUTPUT_DIR)/flexisip-http-file-transfer-server/httpd
mkdir -p $(OUTPUT_DIR)/flexisip-http-file-transfer-server/logrotate
cp logrotate/flexisip-http-file-transfer-server.conf $(OUTPUT_DIR)/flexisip-http-file-transfer-server/logrotate
mkdir -p $(OUTPUT_DIR)/flexisip-http-file-transfer-server/cron.d
cp cron.d/flexisip-http-file-transfer-server $(OUTPUT_DIR)/flexisip-http-file-transfer-server/cron.d
cp flexisip-http-file-transfer-server.spec $(OUTPUT_DIR)/rpmbuild/SPECS/
tar cvf flexisip-http-file-transfer-server.tar.gz -C $(OUTPUT_DIR) flexisip-http-file-transfer-server
mv flexisip-http-file-transfer-server.tar.gz $(OUTPUT_DIR)/rpmbuild/SOURCES/flexisip-http-file-transfer-server.tar.gz
......
......@@ -12,7 +12,20 @@ Requirements
------------
The server requires a functional web server serving php script located (by default) in */opt/belledonne-communications/share/flexisip-http-file-transfer-server/hft.php*
The server requires writing access to a directory accessible directly through http, located by default in */opt/belledonne-communications/share/flexisip-http-file-transfer-server/tmp/* It is strongly advised to disable any script execution in this directory.
The server requires writing access to a directory accessible directly through http, located by default in */var/opt/belledonne-communications/flexisip-http-file-transfer-tmp/* It is strongly advised to disable any script execution in this directory.
Logs are written in /var/opt/belledonne-communications/log/flexisip-http-file-transfer.log
Configuration
-------------
The configuration file is in */etc/flexisip-http-file-transfer-server/flexisip-http-file-transfer-server.conf*
Optional
--------
The package install a logrotate and a crontab entry to rotate the log and delete uploaded file at the end of their validity period (default 1 week)
Package
--------
......
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed
# everyday at 2am, all files older than 7 days (-mmin +$((7*24*60))) are removed from the tmp directory.
# the job is run by apache to prevent deleting files the server did not wrote
0 2 * * * apache find /var/opt/belledonne-communications/flexisip-http-file-transfer-tmp/ -type f -mmin +$((7*24*60)) -exec rm -f {} \;
......@@ -9,7 +9,7 @@
#%define _datadir %{_datarootdir}
#%define _docdir %{_datadir}/doc
%define build_number 2
%define build_number 3
#%if %{build_number}
#%define build_number_ext -%{build_number}
#%endif
......@@ -29,7 +29,7 @@ Source0: flexisip-http-file-transfer-server.tar.gz
#BuildRoot: /home/jenkins/rpmbuild/%{name}-%{version}-%{release}
# dependencies
Requires: rh-php71-php
# this server need php to run there is no generic name and we do not need to enforce the use of apache, so no dependencies
%description
A PHP script managing file transfer according to Rich Communications Service recommendation : RCC.07 v6.0 section 3.5.4.8 File Transfer via HTTP.
......@@ -56,6 +56,8 @@ mkdir -p $RPM_BUILD_ROOT/opt/rh/httpd24/root/etc/httpd/conf.d
cp httpd/flexisip-http-file-transfer-server.conf "$RPM_BUILD_ROOT/opt/rh/httpd24/root/etc/httpd/conf.d"
mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d
cp logrotate/flexisip-http-file-transfer-server.conf "$RPM_BUILD_ROOT/etc/logrotate.d"
mkdir -p $RPM_BUILD_ROOT/etc/cron.d
cp cron.d/flexisip-http-file-transfer-server "$RPM_BUILD_ROOT/etc/cron.d"
%post
if [ $1 -eq 1 ] ; then
......@@ -63,6 +65,8 @@ mkdir -p /var/opt/belledonne-communications/log
touch /var/opt/belledonne-communications/log/flexisip-http-file-transfer-server.log
chown apache:apache /var/opt/belledonne-communications/log/flexisip-http-file-transfer-server.log
chcon -t httpd_sys_rw_content_t /var/opt/belledonne-communications/log/flexisip-http-file-transfer-server.log
# it seems crontab daemon parses only fresh files, to be sure, touch this one when the install is done
touch /etc/cron.d/flexisip-http-file-transfer-server
fi
%files
......@@ -75,11 +79,14 @@ fi
%config(noreplace) /etc/flexisip-http-file-transfer-server/flexisip-http-file-transfer-server.conf
%config(noreplace) /opt/rh/httpd24/root/etc/httpd/conf.d/flexisip-http-file-transfer-server.conf
%config(noreplace) /etc/logrotate.d/flexisip-http-file-transfer-server.conf
%config(noreplace) /etc/cron.d/flexisip-http-file-transfer-server
%clean
rm -rf $RPM_BUILD_ROOT
%changelog
* Tue Apr 7 2020 Johan Pascal <johan.pascal@belledonne-communications.com>
- Add crontab configuration file
* Wed Apr 1 2020 Johan Pascal <johan.pascal@belledonne-communications.com>
- Add configuration file
* Mon Feb 24 2020 Johan Pascal <johan.pascal@belledonne-communications.com>
......
......@@ -5,6 +5,7 @@
// This repository must be accessible (write access) by the web server process. Check the webserver configuration
// But no script executed from there
// This path MUST include a final "/"
// If you change this path, do not forget to change it too in /etc/cron.d/flexisip-http-file-transfer-server
define ("fhft_tmp_path", "/var/opt/belledonne-communications/flexisip-http-file-transfer-tmp/");
// File Extension: as some client can forward the transfered file URL using external body url, we must keep the
// original file extension. For clients using the RCS recommendation, this is not mandatory but there is no way to know from the server side
......@@ -15,6 +16,7 @@ define ("fhft_extension_black_list", array("html", "htm", "xhtml", "xht", "asp",
// Any file with a black listed extension, will get the fallback one added on the server. RCS file transfer will recover from it and give the correct filename to the recipient
define ("fhft_extension_fallback", "txt");
// Validity expressed in seconds. Default is 1 week
// If you change this value, do not forget to change it too in /etc/cron.d/flexisip-http-file-transfer-server
define ("fhft_validity_period", 7*24*60*60);
/* ### Logs configuration ### */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment