From patchwork Thu Jul 12 02:36:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Araneda X-Patchwork-Id: 942757 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="IAvcstSf"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="olIX+x14"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41R0SK0wWQz9rxs for ; Thu, 12 Jul 2018 12:36:32 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:Message-Id: Date:To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=sIRf3kOhfPTAluX6XsRTju2GTBT7Gb49y++D6pAiKLY=; b=IAvcstSfUFoIHC v+2RATfbAoKzIjrhXE0Hw/FNKy14LPS0USzzJSJ92k5zT10aQNayJhSC1TPDGj7lkmSze16sJLZAG IqxAP1PrMhNo+beEX5Ev2JXgCpyJnsV78GsOJCXjJjJq341oVk2EpHyeCUYinvA2OOm39q4vl+9WJ vldXSuIwfFPTdyBM7vbeUNTMzBoVWWaE0NpL+1r6mCqyTTOkMCor0hgl5RADmEecKTPkUHZ+pdVpp XeXCxCMLydr6Li1B8Cas+ycqnw13YOKQjwGGwPRBy4I+V8ycoSvjroE5VKoYavYRu5tNkCabqMybt h/D24X6Na+yC7cqBrXwA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fdRT2-0000XZ-ND; Thu, 12 Jul 2018 02:36:28 +0000 Received: from mail-qk0-x241.google.com ([2607:f8b0:400d:c09::241]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fdRT0-0000WR-33 for openwrt-devel@lists.openwrt.org; Thu, 12 Jul 2018 02:36:27 +0000 Received: by mail-qk0-x241.google.com with SMTP id c126-v6so6008655qkd.7 for ; Wed, 11 Jul 2018 19:36:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=v3aflaNf1yrn1sFMJdmQgviHkFCgkqwJf+L1ARR2Slo=; b=olIX+x145527rwX86ILuB4epwqJFNcvoWexOFzmF++R31qflML5AXRdK9nnipsMPuV +w6I1u8TtrCVU1eBsn02MNczr6T1phbcSrHfJm9yH8WBIIcLqfBuBcDkrmHdyv5luKFK Oe/xAqTBodoCr3hppExwsE/hFDk7/xPN9x9/DwXZbFZC1fl7GA3hPMUNvsfCVeVwYxf+ Rd0Tpriii8/T+CInOFkJjztYwEXj8wKbp2RqEwjrfCeK5Ic7lRZ2gdEUOUmD8gkk4u7C AqMisEHnXooqLuqp1WYsdQr2DLO3iVyRgNWXlRhw4DpFQCVyGiF+m05UrKc1dwyN9iuH F6+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=v3aflaNf1yrn1sFMJdmQgviHkFCgkqwJf+L1ARR2Slo=; b=ZzjBfBpaqE9oz3ESbkIGDZL1xaxXjuHm2N8KBOP1L3x3WF/aXG0vklT1cjK0z4Eqat JlC3IQoWwuNME3izlhcuoqNFunTRnfhwh6x8ErerfOUtuFzRxSEf3uPgktRSD7fSoXCP KHEBj/hUhv0zY9P3ScTHVH0jLx6iRKwAQC4N+okk4tKTAIQlUV8OrF5ECoX22mhUKkAm UJatPOiavRl1HgDNnt5gYSSaOjtibZOtDhjNuzXI6LLZWErexLYQzrqthtFYhliO96o6 ycuPAxut46innpM3HMkuaOlBRrYqYdZV8dpZKv3VzlleYekD5BNkoHd5+MNY6PgjaS82 6qmQ== X-Gm-Message-State: AOUpUlFwwZ7iAJtz86z2iMY+XPL955jHvcDvvhkVOPUQV2AMf6f0X5Ft mF0yPzknLXiLUuuRPf7eAtra2CnD X-Google-Smtp-Source: AAOMgpfkEufWO57cM7iHRi/drca4j9AhKWX2iFmi8J7kLSj6sXQQ7CpDy+vqLn9hVfUSqe1qW7sJjw== X-Received: by 2002:a37:5e82:: with SMTP id s124-v6mr267068qkb.313.1531362973834; Wed, 11 Jul 2018 19:36:13 -0700 (PDT) Received: from localhost.localdomain (186-106-119-105.baf.movistar.cl. [186.106.119.105]) by smtp.gmail.com with ESMTPSA id i68-v6sm5493211qkf.87.2018.07.11.19.36.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Jul 2018 19:36:13 -0700 (PDT) From: Luis Araneda To: openwrt-devel@lists.openwrt.org Date: Wed, 11 Jul 2018 22:36:03 -0400 Message-Id: <20180712023603.6177-1-luaraneda@gmail.com> X-Mailer: git-send-email 2.18.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180711_193626_151011_85026746 X-CRM114-Status: UNSURE ( 7.02 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.1 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2607:f8b0:400d:c09:0:0:0:241 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (luaraneda[at]gmail.com) -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain Subject: [OpenWrt-Devel] [PATCH] dropbear: close all active clients on shutdown X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Christian Schoenebeck , Luis Araneda MIME-Version: 1.0 Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org From: Christian Schoenebeck Override the default shutdown action (stop) and close all processes of dropbear Since commit 498fe85, the stop action only closes the process that's listening for new connections, maintaining the ones with existing clients. This poses a problem when restarting or shutting-down a device, because the connections with existing SSH clients, like OpenSSH, are not properly closed, causing them to hang. This situation can be avoided by closing all dropbear processes when shutting-down the system, which closes properly the connections with current clients. Signed-off-by: Christian Schoenebeck [Luis: Rework commit message] Signed-off-by: Luis Araneda --- package/network/services/dropbear/files/dropbear.init | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/package/network/services/dropbear/files/dropbear.init b/package/network/services/dropbear/files/dropbear.init index 2225113498..b86e52d8bc 100755 --- a/package/network/services/dropbear/files/dropbear.init +++ b/package/network/services/dropbear/files/dropbear.init @@ -148,6 +148,11 @@ service_triggers() procd_add_validation validate_section_dropbear } +shutdown() { + # close all open connections + killall dropbear +} + killclients() { local ignore=''