From owner-freebsd-current@freebsd.org Fri Sep 14 13:45:29 2018 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8D9FC1083FC7 for ; Fri, 14 Sep 2018 13:45:29 +0000 (UTC) (envelope-from gpalmer@freebsd.org) Received: from mail.in-addr.com (mail.in-addr.com [IPv6:2a01:4f8:191:61e8::2525:2525]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2788C8292F for ; Fri, 14 Sep 2018 13:45:29 +0000 (UTC) (envelope-from gpalmer@freebsd.org) Received: from gjp by mail.in-addr.com with local (Exim 4.91 (FreeBSD)) (envelope-from ) id 1g0oPX-000MID-9n; Fri, 14 Sep 2018 14:45:27 +0100 Date: Fri, 14 Sep 2018 14:45:27 +0100 From: Gary Palmer To: "Hartmann, O." Cc: FreeBSD CURRENT Subject: Re: ppp.linkup: How is the !bg argument expanded and substituted? Message-ID: <20180914134527.GB72784@in-addr.com> References: <20180914133433.26280064@hermann> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180914133433.26280064@hermann> X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: gpalmer@freebsd.org X-SA-Exim-Scanned: No (on mail.in-addr.com); SAEximRunCond expanded to false X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Sep 2018 13:45:29 -0000 On Fri, Sep 14, 2018 at 01:34:33PM +0200, Hartmann, O. wrote: > Hello list, > > my question may sound blunt but I miss something with the documentation > of ppp(8). > > Background: My homeoffice is running a network and server > infrastructure I'd like to access from the internet, therefore, I use a > DDNS service. My gateway is a FreeBSD based small, efficient NanoBSD > based system acting as firewall, router and performing some gatewaying > stuff. Recently the usually used dns/ddclient stopped working on > recent CURRENT running on that gateway (FreeBSD 12.0-ALPHA5 #32 > r338541: Sun Sep 9 09:27:47 CEST 2018 amd64, NETINET6 enabled, > secureretylevel=1, all NICs have only IPv6 linklocal, exterior IF is > tun0 with a regular IPv4 assign by my ISP and only linklocal IPv6). > dns/ddclient stopped working out of the blue and I need an alternative > to update my IP (ipv4) at my DDNS provider. > > To achiev the requested IPv4 updates as done via ddclient I > used /etc/ppp/ppp.linkup with a !bg command this way: > > !bg /usr/local/bin/curl -v -X PUT -u \ > \"email@host.de:SOME_TOKEN_GIVEN_BY_PROVIDER\" \ > -d '{\"ip_address\": \"auto\"}' https://api.twodns.de/hosts/all > > It is ONE ROW, I broke it up for presentation here. > > Somehow I needed to escape some quotes like \"; I tried to check how > ppp would emmit the !bg command via a logger statement with the very > same line - the reason is I can't see what ppp is doing and since DDNS > updates never were performed so far via ppp.linkup I consider some > mistakes here. > > For the JSON data (after -d '{...}'), quoted tags are requisite. > > When I issue the command on the gateway without the escaped quotes to > achieve the command line: > > /usr/local/bin/curl -v -X PUT -u \ > "email@host.de:SOME_TOKEN_GIVEN_BY_PROVIDER" \ > -d '{"ip_address": "auto"}' https://api.twodns.de/hosts/all > > everythings works perfect: the IP gets updated, the DDNS provider > respons with status code "200 OK". So far. > > But somehow this never happens or is successful with the !bg statement > from ppp.linkup when the IP changes on that link and ppp.linkup is > triggered. Since I do not see why (it seems that the response from > the !bg command is lost), I need to check the substitutions. > > Can someone enlighted please shed some illumination on that problem? It > would really help to hint me to the doc were I can read about the way > the command string is parsed/interpreted by ppp (I only found the > substitutions for MYADDR, MYADDR6 and so on in man ppp(8)). I'd skip the above and put the CURL command into a small script which is run from the !bg command Regards, Gary