From nobody@FreeBSD.org  Wed Jan 29 18:13:51 2014
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
	(using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by hub.freebsd.org (Postfix) with ESMTPS id 0115F6E9
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 29 Jan 2014 18:13:51 +0000 (UTC)
Received: from oldred.freebsd.org (oldred.freebsd.org [IPv6:2001:1900:2254:206a::50:4])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mx1.freebsd.org (Postfix) with ESMTPS id DAB481626
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 29 Jan 2014 18:13:50 +0000 (UTC)
Received: from oldred.freebsd.org ([127.0.1.6])
	by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id s0TIDomu035431
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 29 Jan 2014 18:13:50 GMT
	(envelope-from nobody@oldred.freebsd.org)
Received: (from nobody@localhost)
	by oldred.freebsd.org (8.14.5/8.14.5/Submit) id s0TIDoZb035414;
	Wed, 29 Jan 2014 18:13:50 GMT
	(envelope-from nobody)
Message-Id: <201401291813.s0TIDoZb035414@oldred.freebsd.org>
Date: Wed, 29 Jan 2014 18:13:50 GMT
From: Thomas Apel <thomas.apel@gmx.net>
To: freebsd-gnats-submit@FreeBSD.org
Subject: authpf(8) always fails with "error removing stale rulesets" on 10.0-RELEASE
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         186251
>Category:       kern
>Synopsis:       authpf(8) always fails with "error removing stale rulesets" on 10.0-RELEASE
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jan 29 18:20:01 UTC 2014
>Closed-Date:
>Last-Modified:
>Originator:     Thomas Apel
>Release:        10.0-RELEASE
>Organization:
>Environment:
FreeBSD freebsd 10.0-RELEASE FreeBSD 10.0-RELEASE #0 r260789: Thu Jan 16 22:34:59 UTC 2014     root@snap.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64
>Description:
After upgrading from 9.1 to 10.0-RELEASE, authpf does not work anymore. The SSH session is immediately terminated after login and the syslog contains the following error message "error removing stale rulesets" (apparently something in remove_stale_rulesets() goes wrong):

root@freebsd:/var/log # tail -n 3 all.log 
Jan 29 16:30:13 freebsd sshd[1035]: Accepted keyboard-interactive/pam for test from 192.168.0.11 port 52213 ssh2
Jan 29 16:30:13 freebsd authpf[1039]: error removing stale rulesets
Jan 29 16:30:13 freebsd sshd[1038]: Received disconnect from 192.168.0.11: 11: disconnected by user
>How-To-Repeat:
I can reproduce the problem on a freshly installed system with the following minimal config (the same config works on both 9.1 and 9.2):

echo 'pf_enable="YES"' >> /etc/rc.conf
touch /etc/pf.conf
/etc/rc.d/pf start

mkdir /etc/authpf
touch /etc/authpf/authpf.conf
touch /etc/authpf/authpf.rules
mount -t fdescfs null /dev/fd

<create user "test">
echo /usr/sbin/authpf >> /etc/shells
chsh -s authpf test

<login as user "test" via SSH>
>Fix:


>Release-Note:
>Audit-Trail:
>Unformatted:
