bugJailkit - Bugs: bug #30744, jk_init fails throws exception...

 
 

bug #30744: jk_init fails throws exception when run first to create a chroot environment

Submitted by:  Sebastian Reitenbach <buzzdee>
Submitted on:  Wed 11 Aug 2010 09:26:36 AM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Need Info
Privacy: PublicAssigned to: None
Open/Closed: Open

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Sun 15 Aug 2010 10:57:42 AM UTC, comment #3:

Yes, the directory did not existed yet.

Sebastian Reitenbach <buzzdee>
Fri 13 Aug 2010 02:36:03 PM UTC, comment #2:

hmm I cannot reproduce this.

did the directory /home/testjail2 exist before the command or not?

Olivier Sessink <oli4>
Project Administrator
Wed 11 Aug 2010 08:02:13 PM UTC, comment #1:

hmm your patch makes the error message go away, but the code shouldn't be executed if the directory already exists...

I'll have to test this

Olivier Sessink <oli4>
Project Administrator
Wed 11 Aug 2010 09:26:36 AM UTC, original submission:

running jk_init at the first time throws below exception:

$ sudo jk_init -j /home/testjail2 jk_lsh -f
ERROR: cannot lstat() /home/testjail2
/home
Creating jail /home/testjail2
Traceback (most recent call last):
File "/usr/local/sbin/jk_init", line 246, in <module>
main()
File "/usr/local/sbin/jk_init", line 243, in main
activateConfig(config, jail, args)
File "/usr/local/sbin/jk_init", line 163, in activateConfig
ji.handle_cfg_section(config,jail,cfg,section)
File "/usr/local/sbin/jk_init", line 98, in handle_cfg_section
self.handle_cfg_section(config,chroot,cfg,tmp)
File "/usr/local/sbin/jk_init", line 133, in handle_cfg_section
jk_lib.init_passwd_and_group(chroot,users,groups,config['verbose'])
File "/usr/local/share/jailkit/jk_lib.py", line 738, in init_passwd_and_group
create_parent_path(chroot,'/etc/', be_verbose, copy_permissions=0, allow_suid=0, copy_ownership=0)
File "/usr/local/share/jailkit/jk_lib.py", line 445, in create_parent_path
os.mkdir(jailpath, 0755)
OSError: [Errno 17] File exists: '/home/testjail2/etc/'

running it a second time, it works as expected.

Appended patch fixes the problem for me. However, I'm not perfectly sure whether this is the right way to fix it.
I ran into the same problem on SLES 11 and OpenBSD.

patch is against jailkit-2.11

Sebastian Reitenbach <buzzdee>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #21187:  patch-py_jk_lib_py added by buzzdee (631B - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by oli4 (Posted a comment)
  • -unavailable- added by buzzdee (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 13 Aug 2010 02:36:03 PM UTColi4StatusNone=>Need Info
    Wed 11 Aug 2010 09:26:36 AM UTCbuzzdeeAttached File-=>Added patch-py_jk_lib_py, #21187

    Back to the top


    Powered by Savane 3.1-cleanup