Return-Path: X-Original-To: apmail-brooklyn-dev-archive@minotaur.apache.org Delivered-To: apmail-brooklyn-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D9EDA174C7 for ; Fri, 29 Jan 2016 15:58:57 +0000 (UTC) Received: (qmail 23665 invoked by uid 500); 29 Jan 2016 15:58:54 -0000 Delivered-To: apmail-brooklyn-dev-archive@brooklyn.apache.org Received: (qmail 23633 invoked by uid 500); 29 Jan 2016 15:58:54 -0000 Mailing-List: contact dev-help@brooklyn.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@brooklyn.apache.org Delivered-To: mailing list dev@brooklyn.apache.org Received: (qmail 23621 invoked by uid 99); 29 Jan 2016 15:58:54 -0000 Received: from Unknown (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 29 Jan 2016 15:58:54 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id DA1BF1A09EE for ; Fri, 29 Jan 2016 15:58:53 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.901 X-Spam-Level: ** X-Spam-Status: No, score=2.901 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=3, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (1024-bit key) header.d=cloudsoftcorp.com Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id ZSiyvM1-mjLh for ; Fri, 29 Jan 2016 15:58:40 +0000 (UTC) Received: from mail-wm0-f49.google.com (mail-wm0-f49.google.com [74.125.82.49]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with ESMTPS id 2F01D20C6A for ; Fri, 29 Jan 2016 15:58:39 +0000 (UTC) Received: by mail-wm0-f49.google.com with SMTP id p63so74109444wmp.1 for ; Fri, 29 Jan 2016 07:58:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloudsoftcorp.com; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=SkRRf6a/p1NHhFnBX2JDTUixlXhHrwWjOOEvBlJiU/w=; b=PaVdsBzCY4EN1E6kfRF0knci73UwkQNtQvCCwpzdjUdMQm7BS0IO6xaWoDXG0QgzCH gUoOu1ztMLkkzLZDgtUH40FthxmUytgFP98S/UyK6BZmy/5Exy12x5yt78rsRwLXOdlu DUULeZKHDynkX1DurWC+7GkslxbWqvMiF9hEg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=SkRRf6a/p1NHhFnBX2JDTUixlXhHrwWjOOEvBlJiU/w=; b=iVIHDmHNdg0c60TR56XHLyoV4qPfhTjQLdeczUuWR7v158h+JQI0GGfIyd1ii1+77d F0IziDUPiz2q6xcG93rpUMb9mAuSGpscUf5NPgn26lv5+p8BCOMHwOUIyekXiqhCLB8f DSmwew7uTjaNaBQIB6ooIvBO4VvryfW9M2eCrG7uo2lSCJMzqiO7xpwVJAP8ZyavHRLK xtbBHbdmAm/9iw59BJp8Pe2Fm7Ya6rPa+t9XyGEX2nzNfWKFXTkvXoqt4vWpiyqm5vRW aO0cmKRuciNL5KiDY+TYVVje8zB8eEjhrSVULtDmHK8P66iC3cHHgcJEBon2bJm/rLzw 3HqQ== X-Gm-Message-State: AG10YOS+EakmRhPO9KNjOUTTKb1Fio2/mgKorTQI3RvvOzkk6TWYxaL9ABucR2GIBWnXlu3CINzLamKBKH928Tt6nBUf1Cfjesh4grGl3TaZQtJ+7Jehu/352TeudUMRdHS6wiPwkrLOBqlFHgVhiw== MIME-Version: 1.0 X-Received: by 10.194.113.165 with SMTP id iz5mr9455664wjb.4.1454083113041; Fri, 29 Jan 2016 07:58:33 -0800 (PST) Received: by 10.27.97.135 with HTTP; Fri, 29 Jan 2016 07:58:32 -0800 (PST) In-Reply-To: References: <56AA42FF.2020902@CloudsoftCorp.com> Date: Fri, 29 Jan 2016 18:58:32 +0300 Message-ID: Subject: Re: Brooklyn Daemon Solution From: Aleksandr Vasilev To: dev@brooklyn.apache.org Content-Type: multipart/alternative; boundary=001a1130c8a06db9c4052a7b1bb6 X-Legal-Virus-Advice: Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by Cloudsoft Corporation Limited in this regard and the recipient should carry out such virus and other checks as it considers appropriate. X-Legal-Confidentiality: This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. Cloudsoft Corporation Limited does not accept responsibility for changes made to this message after it was sent. X-Legal-Company-Info: Cloudsoft Corporation Limited. Registered in Scotland. Number: SC349230. Registered Office: 13 Dryden Place, Edinburgh, EH9 1RP. --001a1130c8a06db9c4052a7b1bb6 Content-Type: text/plain; charset=UTF-8 > Regarding the security implications when using a script vs a binary, could you explain? It's not the difference between binary vs script, it's the different approach at launching the process. In my daemon I make sure child process is detached from the parent and can't get hold of any terminal sessions, so an attacker can't get any additional privileges. >with file descriptor redirection, beyond stderr, stdout what are you considering here? Nothing more unless any other file descriptors are opened by Brooklyn. The daemon makes sure to close them all. >are you intending this to be used outside of init? we'd have the config set externally to the daemon Not at all, just suggesting it can be used in any type of service script >we don't have to wrap a script surely? the init script doesn't have to call the brooklyn script. Agreed, we can wrap java command, calling Brooklyn's Main class. Again I'm not sure this solution detaches the child process properly. Best Regards, Aleksandr Vasilev DevOps Engineer | Cloudsoft Corporation On 29 January 2016 at 18:45, John McCabe wrote: > Hi Aleksandr, > > > 1. Proper detaching from the parent process, making daemon more secure > > 2. Proper detaching from any TTYs, making daemon even more secure > > Regarding the security implications when using a script vs a binary, could > you explain? > > > 3. Proper redirection of all file descriptors, helps with debugging and > > logging > > with file descriptor redirection, beyond stderr, stdout what are you > considering here? > > > 5. More flexible solution: ability to run Brooklyn with any arguments, > > service script will have "brooklyn launch" part hardcoded and will > require > > to edit the code each time you need to run it with the new args. > > are you intending this to be used outside of init? we'd have the config set > externally to the daemon > > > Overall I see the native daemon solution as more traditional and > compliant > > to Linux standards than just wrapping bash script in yet another script. > > we don't have to wrap a script surely? the init script doesn't have to call > the brooklyn script. > > All the best, > John > > On Fri, Jan 29, 2016 at 2:58 PM, Aleksandr Vasilev < > aleksandr.vasilev@cloudsoftcorp.com> wrote: > > > Hi Alex, > > > > The advantages of having a native daemon in my opinion are: > > 1. Proper detaching from the parent process, making daemon more secure > > 2. Proper detaching from any TTYs, making daemon even more secure > > 3. Proper redirection of all file descriptors, helps with debugging and > > logging > > 4. More portable solution, as the daemon can be used in any type of > service > > scripts or even on its own, not only systemd script > > 5. More flexible solution: ability to run Brooklyn with any arguments, > > service script will have "brooklyn launch" part hardcoded and will > require > > to edit the code each time you need to run it with the new args. > > > > Overall I see the native daemon solution as more traditional and > compliant > > to Linux standards than just wrapping bash script in yet another script. > > > > Best Regards, > > Aleksandr Vasilev > > DevOps Engineer | Cloudsoft Corporation > > > > On 29 January 2016 at 17:30, John McCabe wrote: > > > > > [bumping so aleks can see the thread] > > > > > > On Thu, 28 Jan 2016 at 16:41 Andrew Kennedy < > > > andrew.kennedy@cloudsoftcorp.com> wrote: > > > > > > > Or what about running a Brooklyn Docker image as a systemd service! > > > > > > > > - > > http://container-solutions.com/running-docker-containers-with-systemd/ > > > > - https://github.com/ibuildthecloud/systemd-docker > > > > > > > > Andrew. > > > > > > > > On Thu, 28 Jan 2016 at 16:34 Alex Heneveld < > > > > alex.heneveld@cloudsoftcorp.com> > > > > wrote: > > > > > > > > > > > > > > Hi Aleksandr- > > > > > > > > > > What's the advantage of a native daemon over just wrapping it as a > > > linux > > > > > service script ? > > > > > > > > > > Best > > > > > Alex > > > > > > > > > > > > > > > On 28/01/2016 11:32, Aleksandr Vasilev wrote: > > > > > > Hello everyone! > > > > > > > > > > > > I spent last few days looking at the solution to run Brooklyn > > process > > > > as > > > > > a > > > > > > daemon and found two options: > > > > > > 1. Run daemon via Apache Commons Daemon (jsvc) > > > > > > 2. Write a custom daemon in C > > > > > > > > > > > > Both solutions has its own pros and cons, so let's look at what I > > > think > > > > > > they are: > > > > > > > > > > > > JSVC: > > > > > > Pros: > > > > > > - Ready to use solution. Running a daemon via jsvc is very > similar > > to > > > > > > running java application from the command line with similar > > arguments > > > > > > passed. > > > > > > - Builds as usual in Maven > > > > > > > > > > > > Cons: > > > > > > - Still requires you to write daemon code, which in my opinion > > kills > > > > the > > > > > > out-of-the-box usability > > > > > > - Has tons of bugs, including: not been able to find classes in > > > > > classpath, > > > > > > not been able to run by non-root users, not been able to run on > > > several > > > > > > *nix systems (Mac OS, BSD) > > > > > > - The codebase hasn't changed since 2013 and seems abandoned > > > > > > - SVN repo often isn't accessible for some reason, right now the > > > > > webserver > > > > > > returns 503 error code: > > > > > > http://svn.apache.org/viewvc/commons/proper/daemon/trunk/ > > > > > > > > > > > > Custom Daemon (written in C): > > > > > > Pros: > > > > > > - Cross-platform, runs on any *nix system supported by Brooklyn > > > > > > - Very little code to maintain > > > > > > - Independent from third-party solutions, requires only gcc to > > build > > > > > > - Easy to make LSB-compliant init scripts to control the daemon > > > > > > > > > > > > Cons: > > > > > > - Requires some overhead to build C code in Maven > > > > > > > > > > > > Having all these options considered, I propose writing daemon for > > > > Apache > > > > > > Brooklyn in C language and use gcc compiler to build it. It will > > > > require > > > > > > introducing some changes to Maven build process, but there are > > plenty > > > > of > > > > > > solutions for doing this, such as Maven NAR plugin, which is > > actively > > > > > > maintained: > > > > > > https://github.com/maven-nar/nar-maven-plugin > > > > > > > > > > > > Best Regards, > > > > > > Aleksandr Vasilev > > > > > > DevOps Engineer | Cloudsoft Corporation > > > > > > > > > > > > > > > > -- > > > > > > > > Andrew Kennedy ; Founder clocker.io project ; @grkvlt ; Cloudsoft > > > > > > > > > > --001a1130c8a06db9c4052a7b1bb6--