This file is indexed.

/usr/share/doc/syncmaildir/sample-hooks/persistent-ssh is in syncmaildir 1.2.6.2-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/sh
#
# Released under the terms of GPLv3 or at your option any later version.
# No warranties.
# Copyright 2008-2010 Enrico Tassi <gares@fettunta.org>
#
# lines beginning with a double '#' are considered the documentation
# of the hook, and should use the markdown syntax
#
## Persistent ssh connection
## =========================
##
## Ssh can share multiple sessions over a single network connection.
## This feature allows to speedup connections.
##
## The `persistent-ssh` script is a `pre-*` hook that
## starts (if necessary) a mother connection the first time that 
## it is needed. To make this hook work properly, you have to
## setup ssh as explained in the following.
##
## Your `.ssh` directory should have permission `700`, and your 
## `.ssh/config` file should look like this, where `smd-server-foo`
## is the `SERVERNAME` specified in your smd config file:
##
##     Host smd-server-foo
##         ControlPath ~/.ssh/master-socket-%l-%r@%h:%p
##         ControlMaster auto
##         PermitLocalCommand yes
##         LocalCommand ln -sf ~/.ssh/master-socket-%l-%r@%h:%p ~/.ssh/master-socket-smd-server-foo
##         BatchMode yes
##         Compression yes
##         Hostname your.real.server.name
##         User you
##
## The key ingredient is to obtain standard name for the master socket of a 
## given endpoint, in that case `~/.ssh/master-socket-smd-server-foo` for
## the endpoint `smd-server-foo`. Refer the `ssh_config` man page for a
## detailed explanation of `ControlMaster` and `ControlPath`.
##
## Note that you may want to put the first four lines also in a more
## generic configuration entry, so that every ssh connection to your
## server can benefit from connection sharing. For example, a complete
## ssh configuration file for `your.real.server.name` may look like
## the following:
##
##     Host smd-server-foo
##         ControlPath ~/.ssh/master-socket-%l-%r@%h:%p
##         ControlMaster auto
##         PermitLocalCommand yes
##         LocalCommand ln -sf ~/.ssh/master-socket-%l-%r@%h:%p ~/.ssh/master-socket-smd-server-foo
##         BatchMode yes
##         Compression yes
##         Hostname your.real.server.name
##         User you
##
##     Host your.real.server.name
##         ControlPath ~/.ssh/master-socket-%l-%r@%h:%p
##         ControlMaster auto
##         PermitLocalCommand yes
##         LocalCommand ln -sf ~/.ssh/master-socket-%l-%r@%h:%p ~/.ssh/master-socket-smd-server-foo

when="$1"
what="$2"
endpoint="$3"
status="$4"

SMD_ROOT=$HOME/.smd

. $SMD_ROOT/config.$endpoint

MASTER_SOCKET=~/.ssh/master-socket-$SERVERNAME

# on failure we send the mail, and create HOOK_STATUS
if [ "$when" = "pre" -a ! -e $MASTER_SOCKET ]; then
	# we spawn ssh and put it in the background
	# so that all subsequent connection attempts
        # reuse the same socket
	set +e
	ssh -fN $SERVERNAME 
	set -e
fi

# vim:set ft=sh: