Skip to content

Commit 61d290c

Browse files
author
daniel
committed
Modified install / update to copy over jailkit configs
Included jailkit config templates Added bash.bashrc and motd templates to copy over for for chroot system Updated ispconfig vhost to include php fastcgi configs if fastcgi is enabled. What if the module is loaded too ? TODO: jailkit chroot is still not loading the modified motd in /etc/motd and /var/run/motd ??
1 parent a014c2c commit 61d290c

File tree

12 files changed

+323
-10
lines changed

12 files changed

+323
-10
lines changed

install/dist/conf/debian40.conf.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,9 @@
7676
$conf['mydns']['config_dir'] = '/etc';
7777
$conf['mydns']['init_script'] = 'mydns';
7878

79+
//* Jailkit
80+
$conf['jailkit']['config_dir'] = '/etc/jailkit';
81+
$conf['jailkit']['jk_init'] = 'jk_init.ini';
82+
$conf['jailkit']['jk_chrootsh'] = 'jk_chrootsh.ini';
83+
7984
?>

install/dist/conf/gentoo.conf.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,9 @@
6262
$dist['mydns']['config_dir'] = '/etc';
6363
$dist['mydns']['init_script'] = 'mydns';
6464

65+
//* Jailkit
66+
$conf['jailkit']['config_dir'] = '/etc/jailkit';
67+
$conf['jailkit']['jk_init'] = 'jk_init.ini';
68+
$conf['jailkit']['jk_chrootsh'] = 'jk_chrootsh.ini';
69+
6570
?>

install/install.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,10 @@
134134

135135
//* Configure postfix
136136
$inst->configure_postfix();
137+
138+
//* Configure postfix
139+
swriteln('Configuring Jailkit');
140+
$inst->configure_jailkit();
137141

138142
//* Configure saslauthd
139143
swriteln('Configuring SASL');

install/lib/installer_base.lib.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,24 @@ private function process_postfix_config($configfile)
183183
wf($full_file_name, $content);
184184
}
185185

186-
186+
public function configure_jailkit()
187+
{
188+
$cf = $this->conf['jailkit'];
189+
$config_dir = $cf['config_dir'];
190+
$jk_init = $cf['jk_init'];
191+
$jk_chrootsh = $cf['jk_chrootsh'];
192+
193+
if (!is_dir($config_dir))
194+
{
195+
copy($config_dir.'/'.$jk_init, $config_dir.'/'.$jk_init.'~');
196+
copy($config_dir.'/'.$jk_chrootsh.".master", $config_dir.'/'.$jk_chrootsh.'~');
197+
198+
copy('tpl/'.$jk_init.".master", $config_dir.'/'.$jk_init);
199+
copy('tpl/'.$jk_chrootsh.".master", $config_dir.'/'.$jk_chrootsh);
200+
}
201+
202+
}
203+
187204
public function configure_postfix($options = '')
188205
{
189206
$cf = $this->conf['postfix'];

install/tpl/jk_chrootsh.ini.master

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
## example for a user
2+
#[test]
3+
#env= DISPLAY, XAUTHORITY
4+
#
5+
##example for a group, there should be only 1 space inbetween the words!
6+
#[group users]
7+
#env = DISPLAY, XAUTHORITY
8+
#
9+
[DEFAULT]
10+
#relax_home_group=1
11+
skip_injail_passwd_check=1
12+
injail_shell=/bin/bash
13+
env = TERM, PATH

install/tpl/jk_init.ini.master

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
[uidbasics]
2+
# this section probably needs adjustment on 64bit systems
3+
# or non-Linux systems
4+
comment = common files for all jails that need user/group information
5+
libraries = /lib/libnsl.so.1, /lib64/libnsl.so.1, /lib/libnss*.so.2, /lib64/libnss*.so.2
6+
regularfiles = /etc/nsswitch.conf /etc/ld.so.conf
7+
8+
[netbasics]
9+
comment = common files for all jails that need any internet connectivity
10+
libraries = /lib/libnss_dns.so.2, /lib64/libnss_dns.so.2
11+
regularfiles = /etc/resolv.conf, /etc/host.conf, /etc/hosts, /etc/protocols
12+
13+
[logbasics]
14+
comment = timezone information
15+
regularfiles = /etc/localtime
16+
need_logsocket = 1
17+
18+
[jk_lsh]
19+
comment = Jailkit limited shell
20+
executables = /usr/sbin/jk_lsh
21+
regularfiles = /etc/jailkit/jk_lsh.ini
22+
users = root
23+
groups = root
24+
need_logsocket = 1
25+
includesections = uidbasics
26+
27+
[limitedshell]
28+
comment = alias for jk_lsh
29+
includesections = jk_lsh
30+
31+
[cvs]
32+
comment = Concurrent Versions System
33+
executables = /usr/bin/cvs
34+
devices = /dev/null
35+
36+
[git]
37+
comment = Fast Version Control System
38+
executables = /usr/bin/git*
39+
directories = /usr/share/git-core
40+
includesections = editors
41+
42+
[scp]
43+
comment = ssh secure copy
44+
executables = /usr/bin/scp
45+
includesections = netbasics, uidbasics
46+
devices = /dev/urandom
47+
48+
[sftp]
49+
comment = ssh secure ftp
50+
executables = /usr/lib/sftp-server, /usr/libexec/openssh/sftp-server, /usr/lib/misc/sftp-server, /usr/libexec/sftp-server
51+
includesections = netbasics, uidbasics
52+
devices = /dev/urandom, /dev/null
53+
54+
[ssh]
55+
comment = ssh secure shell
56+
executables = /usr/bin/ssh
57+
includesections = netbasics, uidbasics
58+
devices = /dev/urandom, /dev/tty
59+
60+
[rsync]
61+
executables = /usr/bin/rsync
62+
includesections = netbasics, uidbasics
63+
64+
[procmail]
65+
comment = procmail mail delivery
66+
executables = /usr/bin/procmail, /bin/sh
67+
devices = /dev/null
68+
69+
[basicshell]
70+
comment = bash based shell with several basic utilities
71+
executables = /bin/sh, /bin/bash, /bin/ls, /bin/cat, /bin/chmod, /bin/mkdir, /bin/cp, /bin/cpio, /bin/date, /bin/dd, /bin/echo, /bin/egrep, /bin/false, /bin/fgrep, /bin/grep, /bin/gunzip, /bin/gzip, /bin/ln, /bin/ls, /bin/mkdir, /bin/mktemp, /bin/more, /bin/mv, /bin/pwd, /bin/rm, /bin/rmdir, /bin/sed, /bin/sh, /bin/sleep, /bin/sync, /bin/tar, /bin/touch, /bin/true, /bin/uncompress, /bin/zcat
72+
regularfiles = /etc/motd, /etc/issue, /etc/bash.bashrc, /etc/bashrc, /etc/profile
73+
directories = /usr/lib/locale/en_US.utf8
74+
users = root
75+
groups = root
76+
includesections = uidbasics
77+
78+
[midnightcommander]
79+
comment = Midnight Commander
80+
executables = /usr/bin/mc, /usr/bin/mcedit, /usr/bin/mcview
81+
directories = /etc/terminfo, /usr/share/terminfo, /usr/share/mc
82+
includesections = basicshell
83+
84+
[extendedshell]
85+
comment = bash shell including things like awk, bzip, tail, less
86+
executables = /usr/bin/awk, /usr/bin/bzip2, /usr/bin/bunzip2, /usr/bin/ldd, /usr/bin/less, /usr/bin/clear, /usr/bin/cut, /usr/bin/du, /usr/bin/find, /usr/bin/head, /usr/bin/less, /usr/bin/md5sum, /usr/bin/nice, /usr/bin/sort, /usr/bin/tac, /usr/bin/tail, /usr/bin/tr, /usr/bin/sort, /usr/bin/wc, /usr/bin/watch, /usb/bin/whoami
87+
includesections = basicshell, midnightcommander, editors
88+
89+
[editors]
90+
comment = vim, joe and nano
91+
executables = /usb/bin/joe, /usr/bin/nano, /usr/bin/vi, /usr/bin/vim, /usr/bin/pico
92+
regularfiles = /etc/vimrc
93+
directories = /etc/joe, /etc/terminfo, /usr/share/vim, /usr/share/terminfo, /lib/terminfo
94+
95+
[netutils]
96+
comment = several internet utilities like wget, ftp, rsync, scp, ssh
97+
executables = /usr/bin/wget, /usr/bin/lynx, /usr/bin/ftp, /usr/bin/host, /usr/bin/rsync, /usr/bin/smbclient
98+
includesections = netbasics, ssh, sftp, scp
99+
100+
[apacheutils]
101+
comment = htpasswd utility
102+
executables = /usr/bin/htpasswd
103+
104+
[extshellplusnet]
105+
comment = alias for extendedshell + netutils + apacheutils
106+
includesections = extendedshell, netutils, apacheutils
107+
108+
[openvpn]
109+
comment = jail for the openvpn daemon
110+
executables = /usr/sbin/openvpn
111+
users = root,nobody
112+
groups = root,nogroup
113+
includesections = netbasics
114+
devices = /dev/urandom, /dev/random, /dev/net/tun
115+
includesections = netbasics, uidbasics
116+
need_logsocket = 1
117+
118+
[apache]
119+
comment = the apache webserver, very basic setup, probably too limited for you
120+
executables = /usr/sbin/apache
121+
users = root, www-data
122+
groups = root, www-data
123+
includesections = netbasics, uidbasics
124+
125+
[perl]
126+
comment = the perl interpreter and libraries
127+
executables = /usr/bin/perl
128+
directories = /usr/lib/perl, /usr/lib/perl5, /usr/share/perl, /usr/share/perl5
129+
130+
[xauth]
131+
comment = getting X authentication to work
132+
executables = /usr/bin/X11/xauth
133+
regularfiles = /usr/X11R6/lib/X11/rgb.txt, /etc/ld.so.conf
134+
135+
[xclients]
136+
comment = minimal files for X clients
137+
regularfiles = /usr/X11R6/lib/X11/rgb.txt
138+
includesections = xauth
139+
140+
[vncserver]
141+
comment = the VNC server program
142+
executables = /usr/bin/Xvnc, /usr/bin/Xrealvnc
143+
directories = /usr/X11R6/lib/X11/fonts/
144+
includesections = xclients
145+
146+
147+
#[xterm]
148+
#comment = xterm
149+
#executables = /usr/bin/X11/xterm
150+
#directories = /usr/share/terminfo, /etc/terminfo
151+
#devices = /dev/pts/0, /dev/pts/1, /dev/pts/2, /dev/pts/3, /dev/pts/4, /dev/ptyb4, /dev/ptya4, /dev/tty, /dev/tty0, /dev/tty4

install/update.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,11 @@
134134
if($reconfigure_services_answer == 'yes') {
135135
//** Configure postfix
136136
$inst->configure_postfix('dont-create-certs');
137-
137+
138+
//* Configure postfix
139+
swriteln('Configuring Jailkit');
140+
$inst->configure_jailkit();
141+
138142
//** Configure saslauthd
139143
swriteln('Configuring SASL');
140144
$inst->configure_saslauthd();

interface/bin/php-fcgi

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh
2+
PHPRC="/etc/php5/cgi/"
3+
export PHPRC
4+
PHP_DOCUMENT_ROOT="/usr/local/ispconfig/interface/web/"
5+
export PHP_DOCUMENT_ROOT
6+
PHP_FCGI_CHILDREN=8
7+
export PHP_FCGI_CHILDREN
8+
PHP_FCGI_MAX_REQUESTS=5000
9+
export PHP_FCGI_MAX_REQUESTS
10+
exec /usr/bin/php-cgi $1

server/conf/bash.bashrc.master

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
2+
<tmpl_if name='jailkit_chroot'>
3+
## Hack for Jailkit User to change back to the logged in user ##
4+
if [ "$LOGNAME" != $USER ]; then
5+
export HOME=<tmpl_var name='home_dir'>$LOGNAME
6+
export USER=$LOGNAME
7+
export USERNAME=$LOGNAME
8+
cd $HOME
9+
fi
10+
11+
## Change machine hostname to site domain ##
12+
export HOSTNAME=<tmpl_var name='domain'>
13+
14+
</tmpl_if>
15+
16+
17+
# If not running interactively, don't do anything
18+
[ -z "$PS1" ] && return
19+
20+
21+
# check the window size after each command and, if necessary,
22+
# update the values of LINES and COLUMNS.
23+
shopt -s checkwinsize
24+
25+
# make less more friendly for non-text input files, see lesspipe(1)
26+
[ -x /usr/bin/lesspipe ] && eval "$(lesspipe)"
27+
28+
29+
# set a fancy prompt (non-color, unless we know we "want" color)
30+
case "$TERM" in
31+
xterm-color)
32+
PS1='\[\033[01;32m\]$USER@$HOSTNAME\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
33+
;;
34+
*)
35+
PS1='\$USER@$HOSTNAME:\w\$ '
36+
;;
37+
esac
38+
39+
40+
# If this is an xterm set the title to user@host:dir
41+
case "$TERM" in
42+
xterm*|rxvt*)
43+
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"'
44+
;;
45+
*)
46+
;;
47+
esac
48+
49+
50+
# enable color support of ls and also add handy aliases
51+
if [ "$TERM" != "dumb" ]; then
52+
eval "`dircolors -b`"
53+
alias ls='ls --color=auto'
54+
#alias dir='ls --color=auto --format=vertical'
55+
#alias vdir='ls --color=auto --format=long'
56+
fi
57+
58+
# some more ls aliases
59+
#alias ll='ls -l'
60+
#alias la='ls -A'
61+
#alias l='ls -CF'
62+
63+

server/conf/motd.master

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Welcome To Site <tmpl_var name='domain'>
2+
3+
4+

0 commit comments

Comments
 (0)