From owner-freebsd-jail@freebsd.org Sat Jul 20 16:24:57 2019 Return-Path: Delivered-To: freebsd-jail@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C98E8C1E9F for ; Sat, 20 Jul 2019 16:24:57 +0000 (UTC) (envelope-from luca.pizzamiglio@gmail.com) Received: from mailman.nyi.freebsd.org (unknown [127.0.1.3]) by mx1.freebsd.org (Postfix) with ESMTP id 3378F87C2C for ; Sat, 20 Jul 2019 16:24:57 +0000 (UTC) (envelope-from luca.pizzamiglio@gmail.com) Received: by mailman.nyi.freebsd.org (Postfix) id 32F78C1E9A; Sat, 20 Jul 2019 16:24:57 +0000 (UTC) Delivered-To: jail@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 329B8C1E99 for ; Sat, 20 Jul 2019 16:24:57 +0000 (UTC) (envelope-from luca.pizzamiglio@gmail.com) Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C169A87C29 for ; Sat, 20 Jul 2019 16:24:56 +0000 (UTC) (envelope-from luca.pizzamiglio@gmail.com) Received: by mail-lf1-f45.google.com with SMTP id c19so23763153lfm.10 for ; Sat, 20 Jul 2019 09:24:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=LBzT85rp8IDICK2CglxWb6Pcw3T8S2DXvfTSQYOiLRs=; b=cfmTfqRfONlG1keGw+RRxIUZxVgakChnzMQvkLyU2CyT9gM5TEsJc0dKfrBHjFwQMn /QUiVpHUMzxozj2HmkHfpH6lFzwr/dvJsgDF2bRISry//OY9oydDn/FU1yV6wMKv8QI5 3iSd5HLhgqKDDHSkyeFIUydwGiPxs9fOyxIYI6njmKmpBBTazD90q0cHIy8U+2ZJQ5yc WRMUkRJm7xzOoXUh/WInG5LYFRWPovgjTrtur64G3UEx1WSiBBTL/ihGRpBa7XMA0uG4 D4u912RCqfrp2xiQVTt0cry5rDMlKS4DkwXi5zVNWIItyID4szOII1rqeovzwqofaqey aNCA== X-Gm-Message-State: APjAAAU5SCvRj1xiSJurc0ZSlmDwrp6KXR6MsbJgsj0yWuH5gjJCXCGi DaeCL6ZXMrhBL9IU8df2YxbMu56iDXU= X-Google-Smtp-Source: APXvYqx8X8CcBw3TryOdil2lebcCoiQyOm41lWXtWAq2r2ie5T6MmKGJ3WG+qPPyHAB1jl93dIzvEw== X-Received: by 2002:a19:8c08:: with SMTP id o8mr26566547lfd.57.1563639889054; Sat, 20 Jul 2019 09:24:49 -0700 (PDT) Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com. [209.85.208.170]) by smtp.gmail.com with ESMTPSA id p28sm5219609lfh.55.2019.07.20.09.24.48 for (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Sat, 20 Jul 2019 09:24:48 -0700 (PDT) Received: by mail-lj1-f170.google.com with SMTP id h10so33592384ljg.0 for ; Sat, 20 Jul 2019 09:24:48 -0700 (PDT) X-Received: by 2002:a2e:6c14:: with SMTP id h20mr30637982ljc.38.1563639888415; Sat, 20 Jul 2019 09:24:48 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Luca Pizzamiglio Date: Sat, 20 Jul 2019 18:24:31 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Defaults in jail.conf not applied if jail block is not existing To: James Gritton Cc: jail@freebsd.org X-Rspamd-Queue-Id: C169A87C29 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.98 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.98)[-0.981,0]; TAGGED_FROM(0.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: freebsd-jail@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Discussion about FreeBSD jail\(8\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Jul 2019 16:24:57 -0000 Hi Jamie, Thanks for the quick answer. I guess I have to decide to go full command-line or full jail.conf. The devctl patch seems pretty cool. Actually, I like the idea to have a jaild daemon that take care of all the pre/post start/stop stuff, doable if the devctl notifications system is in place, but it adds more complexity. Probably, it's something I can work on in the future, even if it can overlap with what an orchestrator does. Thanks again for the support Best regards, pizzamig@ On Sat, Jul 20, 2019 at 12:01 AM James Gritton wrote: > If I'm reading it right, then yes the behavior on creating jails if > intended. The defaults in jail.conf are only defaults to the jails listed > in jail.conf, not defaults to command-line-generated jails. So even if you > only include an empty block for the jail, it then is a jail.conf jail and > not a command-line jail. > > For the non-persistent jail poststop scripts, the only way to run them > outside the jail is to have a process outside the jail to run them from. > Cron isn't a perfect solution, but a pretty workable one. If your jail has > a single process that runs from start to finish (i.e. not something like a > typical "command=sh /etc/rc"), then you could simply have a subshell that > runs the jail and then runs the poststop script itself: > # (jail -c name=foo command=sleep 10; echo doing cleanup) & > > You may be interested in the suggested patch for jail notifications in > devctl. That way, a jail-watch process can tell when jails start and stop. > > - Jamie > > On Fri, Jul 19, 2019 at 10:29 AM Luca Pizzamiglio > wrote: > >> Hi all, >> >> I have 2 silly questions and I think I know the answer. >> I'd like to use the command line jail tool start and configure my jails; >> however, I'd like to have defaults set up in a central place. >> >> I thought I could put those defaults in /etc/jail.conf and then >> dynamically >> create my jails with the cli tool. >> However, if the jail create (or stop) is not explicitly listed in >> jail.conf, the defaults are not applied. >> If I add an empty configuration block, then the default values are >> applied. >> >> Is this an intended behavior? >> >> The second question is about not persistent jails. >> Once all processes in the jail exits, the jail is automatically destroyed. >> However, without invoking jail -r , there is no way (that I'm aware of) to >> invoke a poststop script automatically. >> Is there a workaround or a suggested way to have a callback/script invoked >> when a jail disappear? (currently, I'm not happily considering a cronjob >> as >> a solution) >> >> Thanks in advance for the support! >> >> Best regards. >> pizzamig@ >> _______________________________________________ >> freebsd-jail@freebsd.org mailing list >> https://lists.freebsd.org/mailman/listinfo/freebsd-jail >> To unsubscribe, send any mail to "freebsd-jail-unsubscribe@freebsd.org" >> >