From owner-freebsd-jail@freebsd.org Fri Jul 19 22:01:47 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 EC3F6ACCC4 for ; Fri, 19 Jul 2019 22:01:47 +0000 (UTC) (envelope-from jamie@gritton.org) Received: from mailman.nyi.freebsd.org (unknown [127.0.1.3]) by mx1.freebsd.org (Postfix) with ESMTP id B26D287C0B for ; Fri, 19 Jul 2019 22:01:47 +0000 (UTC) (envelope-from jamie@gritton.org) Received: by mailman.nyi.freebsd.org (Postfix) id B0025ACCC2; Fri, 19 Jul 2019 22:01:47 +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 AFBDFACCC1 for ; Fri, 19 Jul 2019 22:01:47 +0000 (UTC) (envelope-from jamie@gritton.org) Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) (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 F064987C02 for ; Fri, 19 Jul 2019 22:01:45 +0000 (UTC) (envelope-from jamie@gritton.org) Received: by mail-wr1-x436.google.com with SMTP id 31so33628353wrm.1 for ; Fri, 19 Jul 2019 15:01:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gritton.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=zzPqod1+3Q9kgJvaOTFQcmoisU3bKPtagUQ409Ae5cY=; b=RmskmzXli7Z+LYtWPPU5Gx2iq7gifWFjYXnnXt6I1wfvjgdiMn+waV9pMgNXVaUjQ+ jWEZz6Bha40+JEpR3TdwKwr9CmAbYj/auoV4wtximRIl4vKUZivVUFcDzt1ANAliAQI1 9QHIub7x1sBU9lGNAfDQC2se63wlsjOHuYYhs= 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=zzPqod1+3Q9kgJvaOTFQcmoisU3bKPtagUQ409Ae5cY=; b=C7ZGn75o6pp6uD3ZfCeaOgOMhhrL2Cy4rmHi9G2TO6RP/XeKARVknxh7y5jPkhp4l+ 4kWe3U/XxiyRf2RpLP/2PobYcuptk1rCyrWDYtH+0lDKW6jYSkzDPC8u8E8Nh3Z8Inma MnYIC/AIgEeaLvPcAi05ofRhcPbznelJF9/6zxq9FPOkngqMw/DuuX3haT/ktzvE8Xa8 MFJQ1L2ecNW39C1f8xG0UizFHrQg38vaMuoBeQ8Cs3TbRo2qghur2dwtvKe+RO0frX1A XoMUnGODFx1ECOFx9IH6jzYE1ig9e32DkhmFjTNY6r4oM0ivy7okLtUx/VjZwNwT+wpM iATA== X-Gm-Message-State: APjAAAUOjdnHt6MLwS+0XJ9L/8UtdmpG3+93EstrIIF88AdJsd5Lm+EU Yg/lPSvRs6M5aDG0aQTXjr/hrS1gX7Y8Z/SCCWUR80PHiM0= X-Google-Smtp-Source: APXvYqxUAMOGA0CkEhJnqViEF0VPCRBr0+UgwYyhmozq29g1koDSRmxGpoc7LytnDfYUQsPrFJ8DUvlg1+mmrWxv64A= X-Received: by 2002:adf:f8cf:: with SMTP id f15mr56956033wrq.333.1563573704557; Fri, 19 Jul 2019 15:01:44 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: James Gritton Date: Fri, 19 Jul 2019 16:01:33 -0600 Message-ID: Subject: Re: Defaults in jail.conf not applied if jail block is not existing To: Luca Pizzamiglio Cc: jail@freebsd.org X-Rspamd-Queue-Id: F064987C02 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gritton.org header.s=google header.b=RmskmzXl; spf=pass (mx1.freebsd.org: domain of jamie@gritton.org designates 2a00:1450:4864:20::436 as permitted sender) smtp.mailfrom=jamie@gritton.org X-Spamd-Result: default: False [-6.45 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; R_DKIM_ALLOW(-0.20)[gritton.org:s=google]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[jail@freebsd.org]; DMARC_NA(0.00)[gritton.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[gritton.org:+]; RCPT_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_NONE(0.00)[6.3.4.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.5.4.1.0.0.a.2.list.dnswl.org : 127.0.5.0]; MX_GOOD(-0.01)[alt1.aspmx.l.google.com,aspmx.l.google.com,aspmx5.googlemail.com,alt2.aspmx.l.google.com,aspmx2.googlemail.com]; IP_SCORE(-2.95)[ip: (-9.32), ipnet: 2a00:1450::/32(-2.93), asn: 15169(-2.43), country: US(-0.05)]; NEURAL_HAM_SHORT(-0.99)[-0.993,0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; RCVD_COUNT_TWO(0.00)[2] 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: Fri, 19 Jul 2019 22:01:48 -0000 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" >