From 33b7b89a36855aa231ede0c292be94818811f706 Mon Sep 17 00:00:00 2001 From: Koz Ross Date: Thu, 17 May 2018 15:05:19 +1200 Subject: [PATCH 1/3] Adding OpenRC script --- osync-srv-openrc | 55 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100755 osync-srv-openrc diff --git a/osync-srv-openrc b/osync-srv-openrc new file mode 100755 index 0000000..8a70f03 --- /dev/null +++ b/osync-srv-openrc @@ -0,0 +1,55 @@ +#!/sbin/openrc-run +# +# PROGRAM="osync-srv" +# AUTHOR="(C) Brian Evans 2018" +# CONTACT="grknight@gentoo.org" +# PROGRAM_BUILD=20180517 +# +# How to use: +# +# 0) Rename this to osync-srv, and place it in /etc/init.d. +# 1) Ensure that your config is located in /etc/osync, under some name with a +# .conf extension. +# 2) Ensure that osync.sh can be found in /usr/local/bin. +# 3) Ensure that you have rsync and inotify-tools installed. +# 4) Symlink this to a name with an extension equal to the basename of your +# config file. +# 5) Add to the default runlevel under the symlinked name. +# +# Example: +# +# Suppose the config is located at /etc/osync/documents.conf. You then want to +# symlink as follows: +# +# # ln -s /etc/init.d/osync-srv /etc/init.d/osync-srv.documents +# +# Then you can start the service as normal: +# +# # rc-update add osync-srv.documents default + +depend() { + use localmount chrony ntp-client +} + +description="Two way directory sync daemon" +command=/usr/local/bin/osync.sh +conffile="${RC_SVCNAME#*.}.conf" +cfgfile="/etc/osync/${conffile}" +command_args="${cfgfile} --on-changes --errors-only" +command_background="yes" +pidfile="/var/run/${RC_SVCNAME}" +stopsig=TERM + +start_pre() { + if [ "${conffile}" = ".conf" ]; then + eerror "${RC_SVCNAME} cannot be started directly. You must create" + eerror "symbolic links to it for the configuration you want to start" + eerror "osync on and add those to the appropriate runlevels." + return 1 + fi + + if ! [ -f "${cfgfile}" ]; then + eerror "Cannot find configuration file ${cfgfile}." + return 1 + fi +} From 601c8ace14ed9bad2bbcaac083008a2ce83b5183 Mon Sep 17 00:00:00 2001 From: Koz Ross Date: Thu, 17 May 2018 15:06:10 +1200 Subject: [PATCH 2/3] Fix README.md typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f4069db..901a379 100644 --- a/README.md +++ b/README.md @@ -148,7 +148,7 @@ Having multiple conf files can then be run in a single cron command like Daemon mode ----------- -Additionnaly, you may run osync in monitor mode, which means it will perform a sync upon file operations on initiator replica. +Additionaly, you may run osync in monitor mode, which means it will perform a sync upon file operations on initiator replica. This can be a drawback on functionnality versus scheduled mode because this mode only launches a sync task if there are file modifications on the initiator replica, without being able to monitor the target replica. Target replica changes are only synced when initiator replica changes occur, or when a given amount of time (default 600 seconds) passed without any changes on initiator replica. File monitor mode can also be launched as a daemon with an init script. Please read the documentation for more info. From 44d2df4906060407443e1c1313c2da3f0bae4f01 Mon Sep 17 00:00:00 2001 From: Koz Ross Date: Thu, 17 May 2018 15:08:11 +1200 Subject: [PATCH 3/3] Amend README for Gentoo and OpenRC stuff --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 901a379..c3721d7 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ osync uses pidlocks to prevent multiple concurrent sync processes on/to the same You may launch concurrent sync processes on the same system but as long as the replicas to synchronize are different. Multiple osync tasks may be launched sequentially by osync osync-batch tool. -Currently, it has been tested on CentOS 5.x, 6.x, 7.x, Fedora 22-25, Debian 6-8, Linux Mint 14-18, Ubuntu 12.04-12.10, FreeBSD 8.3-11, Mac OS X and pfSense 2.3x. +Currently, it has been tested on CentOS 5.x, 6.x, 7.x, Fedora 22-25, Debian 6-8, Linux Mint 14-18, Ubuntu 12.04-12.10, FreeBSD 8.3-11, Gentoo, Mac OS X and pfSense 2.3x. Microsoft Windows is supported via MSYS or Cygwin and now via Windows 10 bash. Android support works via busybox (tested on Termux). @@ -168,6 +168,8 @@ Systemd specific (one service per config file) $ systemctl start osync-srv@configfile.conf $ systemctl enable osync-srv@configfile.conf +OpenRC-specific instructions can be found in ``osync-srv-openrc``. + Security enhancements --------------------- Remote SSH connection security can be improved by limiting what hostnames may connect, disabling some SSH options and using ssh filter.