As soon as this version is installed via upgrade, a shell user can no longer log on to the server when Jail is active.
workaround
Downgrading back to version 2.20 restores the previous functionality, if the installed jk_init.ini is kept
Configuration file '/etc/jailkit/jk_init.ini' ==> Modified (by you or by a script) since installation. ==> Package distributor has shipped an updated version. What would you like to do about it ? Your options are: Y or I : install the package maintainer's version N or O : keep your currently-installed version D : show the differences between the versions Z : start a shell to examine the situation The default action is to keep your current version.*** jk_init.ini (Y/I/N/O/D/Z) [default=N] ? n
possible cause
As mentioned on the Jailkit website, the outdated utility jk_addjailuser has been removed in the new version
proposed fix
In the short term, a note/warning should be included in the above-mentioned tutorial. Maybe a note can be added on how to block the automatic upgrade of Jailkit (~# apt-mark hold jailkit).
If my suspicion is correct that the missing utility jk_addjailuser causes the issue, the related scripts should be modified for future ISPConfig installations.
Designs
Child items
...
Show closed items
Linked items
0
Link issues together to show that they're related.
Learn more.
Did you ran an ispconfig update with reconfigure services = yes after you installed jailkit 2.21 from backports repo? If not, you overwrote the jailkit config that is set up by ispconfig with an incompatible config file and the creation of jailkit users will fail.
During my various tests, I have certainly also executed an "ispconfig update" and "reconfigure services". However, I can hardly say at which step of the testing.
However, I will verify the proposed procedure once again with a backup machine and will then report.
I have now executed a jailkit upgrade on my test machine.
apt list jailkit -aListing... Donejailkit/unstable,now 2.21-2 amd64 [installed]jailkit/buster-backports 2.21-2~bpo10+1 amd64
Without performing an "ispconfig update" existing shell users will work as before - a new one created now does not work, if the jail is active.
Then I have done an ISPConfig update (incl. reconfigure services) by executing the following commands:
cd /tmpwget http://www.ispconfig.org/downloads/ISPConfig-3.1.15p3.tar.gztar xvfz ISPConfig-3.1.15p3.tar.gzcd ispconfig3_install/installphp -q update.php
Neither the last "new" user nor another newly created shell user can log in.
In auth.log, the following messages can be found:
...server useradd[25609]: new user: name=xxxx, UID=5008, GID=5005, home=/var/www/clients/client1/web5, shell=/bin/bash...server usermod[25622]: change user 'xxxx' shell from '/bin/bash' to '/bin/false'...server usermod[25622]: lock user 'xxxx' password...server usermod[25690]: unlock user 'xxxx' password...server sshd[25700]: Accepted publickey for xxxx from 192.168.1.15 port 55047 ssh2: RSA SHA256:0VTDvkBpl2+Y1876bFm8jTmoUJtbDCVARgMW97GxSc0...server jk_chrootsh[25703]: now entering jail /var/www/clients/client1/web5 for user xxxx (5008) with arguments ...server jk_chrootsh[25703]: ERROR: failed to execute shell /bin/bash for user xxxx (5008), check the permissions and libraries of /var/www/clients/client1/web5//bin/bash
I noticed the two slashes near the end of the last line (... /var/www/clients/client1/web5//bin/bash)
Does that have any significance at all?
Now again I did a downgrade to version 2.20 of Jailkit by executing the following commands:
The lock file ".ispconfig_lock" can be found neither in the specified directory nor anywhere else in the system.
Of course, it's a lock file and lock files get removed when the process finished and that's also what the messages tell you.
Beside that, you did not create a new jailed shell user, that#s why you did not got any additional details for the process of the creation of a shell user.
Create a new website, can be a temporary 'fake' domain name like test.local and then create a jailed shell user. The reason why you have to create a website first is that the jail gets created only once when the first jailed user for a new website gets created.
run server.sh, you should then see the full debug output of the steps to create that jailed shell user.
Yes, with the new version please. And beside debug.log, please check the line for this new user in /etc/passwd and in the /var/www/yourdomain.tld/etc/passwd file.
The attached file debug.txt is taken from terminal output.
The new shell user can't connect:
In auth.log, the following messages are found:
Aug 24 20:47:45 aserver sshd[11152]: Accepted publickey for dzdebug from 192.168.1.15 port 57546 ssh2: RSA SHA256:0CNJngDWNvTQeLrOFMxbzCx2LJ12u7lYqyTfeQm3fSoAug 24 20:47:46 aserver jk_chrootsh[11155]: now entering jail /var/www/clients/client1/web15 for user dzdebug (5014) with arguments Aug 24 20:47:46 aserver jk_chrootsh[11155]: ERROR: failed to execute shell /bin/bash for user dzdebug (5014), check the permissions and libraries of /var/www/clients/client1/web15//bin/bash
configparser.DuplicateOptionError: While reading from '/etc/jailkit/jk_init.ini' [line 115]: option 'includesections' in section 'openvpn' already exists
please check the ini file to ensure that includesections is used only once in openvpn section. You can combine both includesections lines.
I just checked the current stable dev version and it exists there just once, so the reported issue is probably solved already in 3.1dev version.
There was also a fix in 3.1dev for newly created jailkit users to do with an empty homedir in the jailkit passwd file I believe, but not 100% sure of the details, nor if it's related here.
A quick grep shows jk_addjailuser is not used, so its absence should not be a problem.
One thing that stands out as a significant error are the debug lines like:
Note that jk_cp requires a -j in front of the jail name, and should not at all use -k, that is a significant security problem. (Using hard links allows an easy escape from the chroot jail if/once root access within has been achieved.) @dziller, can you check if you have hardlinks = 1 set in your jk_update.ini? Perhaps that is something left behind by the backports package causing this behavior, and not the ISPConfig code.
Looks like the jk -k issue is indeed ISPConfig code, in server/lib/classes/system.inc.php and server/scripts/create_jailkit_programs.sh. This would only affect programs installed with jk_cp, not entire sections from jk_init.ini, so it failing might go unnoticed for a while. This is a different issue than what causes @dziller's problem though.
Doing a bit of testing, this is not failing, the jail is determined correctly and the binary attempted to be hardlinked, and failing that will be copied. (-j is optional if the jail is the first argument (after options, apparently)).
So on my system a test jk_cp resulted in a copy - but with a different filesystem layout it would have been a hardlink, which is bad.
root@host:~# ls -l /var/www/clients/client*/web*/bin/chownls: cannot access '/var/www/clients/client*/web*/bin/chown': No such file or directoryroot@host:~# jk_cp -k /var/www/clients/client##/web## /bin/chownTrying to link /bin/chown to /var/www/clients/client##/web##/bin/chownLinking /bin/chown to /var/www/clients/client##/web##/bin/chown failed, will revert to copyingroot@host:~# ls -l /var/www/clients/client*/web*/bin/chown-rwxr-xr-x 1 root root 72512 Feb 28 2019 /var/www/clients/client##/web##/bin/chownroot@host:~# ls -li /var/www/clients/client##/web##/bin/chown /bin/chown 273618 -rwxr-xr-x 1 root root 72512 Feb 28 2019 /bin/chown5116699 -rwxr-xr-x 1 root root 72512 Feb 28 2019 /var/www/clients/client##/web##/bin/chown
Maybe a quick cleanup routine in the installer should be looked at? find(1) can find them (see eg. this), or stat files and compare inode numbers.
!1118 (merged) is a start, with no cleanup for existing jails. Also note that when digging further, jk_init also had -k specified, so forget my earlier claim that only jk_cp programs would be affected.
I just created a new site + jailkit user on a similar vintage system (it was 3.1dev from Dec 9, 2019, which basically 3.1.15p3, sans an unrelated a bugfix), and did not have a "chmod failed" line. What owner and permissions do you have for that directory? I see:
root@host-web-1:~# ls -ld /var/www/clients/client##/web##/bindrwxr-xr-x 2 root root 4096 Aug 24 15:46 /var/www/clients/client##/web##/bin
Thanks, the user in /etc/password are looking ok. and what's in /var/www/yourdomain.tld/etc/passwd file? And please post the output of:
That passwd file (/client1/web15/...) is empty!
ls -la /var/www/clients/client1/web15/bin/bash
ls: cannot access '/var/www/clients/client1/web15/bin/bash': No such file or directory
ls -la /var/www/clients/client1/web15/
total 56drwxr-xr-x 14 root root 4096 Aug 24 19:32 .drwxr-xr-x 14 root root 4096 Aug 24 19:32 ..-rwxr-x--- 1 web15 client1 0 Aug 24 19:32 .bash_history-rw-r--r-- 1 web15 client1 0 Aug 24 19:32 .profiledrwx------ 2 web15 client1 4096 Aug 24 19:32 .sshlrwxrwxrwx 1 root root 7 Aug 24 19:32 bin -> usr/bindrwxr-xr-x 2 web15 client1 4096 Aug 24 19:32 cgi-bindrwxr-xr-x 3 root root 4096 Aug 24 19:32 etcdrwxr-xr-x 4 root root 4096 Aug 24 19:32 homelrwxrwxrwx 1 root root 7 Aug 24 19:32 lib -> usr/liblrwxrwxrwx 1 root root 9 Aug 24 19:32 lib64 -> usr/lib64drwxr-xr-x 2 root root 4096 Aug 25 00:02 logdrwx--x--- 2 web15 client1 4096 Aug 24 19:32 privatedrwxr-xr-x 2 root root 4096 Aug 24 19:32 ssldrwxrwxrwx 2 web15 client1 4096 Aug 24 19:32 tmpdrwxr-xr-x 5 root root 4096 Aug 24 19:32 usrdrwxr-xr-x 3 root root 4096 Aug 24 19:32 vardrwx--x--x 4 web15 client1 4096 Aug 24 19:32 webdrwx--x--- 2 web15 client1 4096 Aug 24 19:32 webdav
jk_init.ini file
Just for information I have uploaded my jk_init.ini file.
However, caused by the multiple up- and downgrades there are 2 more files which were created automatically.
This directory is a symlink to usr/bin/ ls -ld /var/www/clients/client1/web15/bin lrwxrwxrwx 1 root root 7 Aug 24 19:32 /var/www/clients/client1/web15/bin -> usr/bin
/var/www/clients/client1/web15# ls -ld usr/bin drwxr-xr-x 2 root root 4096 Aug 24 19:32 usr/bin