This file is indexed.

/usr/bin/dokuwiki-addsite is in dokuwiki 0.0.20131208-1.

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

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
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#! /bin/sh
set -e

if [ $# -ne 1 ]
then
    echo "Usage: $0 SITE_NAME"
    exit 1
fi

site_name="$1"
site_dir="/var/lib/dokuwiki/farm/$site_name"
conf_dir="/etc/dokuwiki/farm/$site_name"
now=$(date --rfc-2822)

echo "Creating site $site_name"


#######################
# Directory structure #
#######################

echo "Creating directory structure..."
install -d -o www-data -g root -m 0700 "$site_dir/acl"
install -d -o www-data -g root -m 0700 "$site_dir/data"
install -d -o www-data -g root -m 0700 "$site_dir/data/attic"
install -d -o www-data -g root -m 0700 "$site_dir/data/cache"
install -d -o www-data -g root -m 0700 "$site_dir/data/index"
install -d -o www-data -g root -m 0700 "$site_dir/data/locks"
install -d -o www-data -g root -m 0700 "$site_dir/data/media"
install -d -o www-data -g root -m 0700 "$site_dir/data/meta"
install -d -o www-data -g root -m 0700 "$site_dir/data/pages"
install -d -o www-data -g root -m 0700 "$site_dir/data/tmp"
install -d -o www-data -g root -m 0700 "$site_dir/data/media_attic"
install -d -o www-data -g root -m 0700 "$site_dir/data/media_meta"
install -d -o root -g www-data -m 0775 "$conf_dir"


######################
# Main configuration #
######################

echo "Creating basic configuration..."

dokuwikiconf="$conf_dir/local.php"
install -o root -g www-data -m 0664 /dev/null "$dokuwikiconf"

cat >> "$dokuwikiconf" <<EOF
<?php
/**
 * Dokuwiki's Main Configuration File - Local Settings
 * Auto-generated by Debian dokuwiki-addsite script
 * Date: $now
 */

\$conf['title'] = '$site_name';
\$conf['license'] = 'cc-by-sa';
#\$conf['lang'] = 'en';
\$conf['useacl'] = 1;
\$conf['superuser'] = '@admin';
EOF


#######################
# Fixed configuration #
#######################

echo "Setting fixed configuration..."

install -o root -g www-data -m 0644 /dev/null "$conf_dir/local.protected.php"
cat >> "$conf_dir/local.protected.php" <<EOF
<?php
/**
 * Dokuwiki's Fixed Configuration File - Local Settings
 * Auto-generated by Debian dokuwiki-addsite script
 * Date: $now
 */

\$conf['savedir'] = '$site_dir/data';
EOF


#########################
# Access control system #
#########################

echo "Setting basic permissions..."

aclauth="$site_dir/acl/acl.auth.php"
install -o www-data -g root -m 0640 /dev/null "$aclauth"

cat >> "$aclauth" <<-EOF
# acl.auth.php
# <?php exit()?>
# Don't modify the lines above
#
# Access Control Lists
#
# Auto-generated by Debian dokuwiki-addsite script
# Date: $now

*               @ALL          1
*               @user         8
EOF

ln -s "$site_dir/acl/acl.auth.php"   "$conf_dir/"


#########################
# Administrator account #
#########################

echo "Adding admin user..."

usersauth="$site_dir/acl/users.auth.php"
install -o www-data -g root -m 0640 /dev/null "$usersauth"

superuser="admin"
fullname="DokuWiki Administrator"
email="webmaster@localhost"
password="password"
confirm="confirm"
stty -echo
while [ "$password" != "$confirm" ]
do
    printf "Choose an administrator password: "
    read -r password
    echo
    printf "Retype the administrator password: "
    read -r confirm
    echo
    if [ "$password" != "$confirm" ]
    then
        echo "Sorry, password do not match" >&2
    fi
done
stty echo
password=$(echo -n "$password" | md5sum -b | cut -d' ' -f1)
echo "$superuser:$password:$fullname:$email:admin,user" >> $usersauth

ln -s "$site_dir/acl/users.auth.php" "$conf_dir/"
 
 
############
# Finished #
############

echo "Finished!"
echo "Bye!"
 
exit 0