From nobody Fri Jan 21 23:04:59 2022 X-Original-To: freebsd-questions@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D3C40195DB0D for ; Fri, 21 Jan 2022 23:05:04 +0000 (UTC) (envelope-from edgar@pettijohn-web.com) Received: from mail.pettijohn-web.com (pettijohn-web.com [108.61.222.55]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA512) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4JgZhw1kBnz4gcX for ; Fri, 21 Jan 2022 23:05:04 +0000 (UTC) (envelope-from edgar@pettijohn-web.com) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=dkim; bh=unMI6HYxyZzJA5r uVmW4E87MP4nfYj/rpf0aunBKoVQ=; h=subject:from:to:date; d=pettijohn-web.com; b=peleK8jFCYT96OyW0vg/zAQos3l8hSJkn1vDUI5zRT3gSRr TZvs0Z8DqHghnE6mB3GwSzxt7JcTYPbjBpFCo1W2ln46vBT/mwpLNerPqSFvPsSnSudIhC GwYKv+5dHGuBnYPR144z3K/hDLJOsF89Tj5sYHVOA8HnCjuzct9yj4= Received: from bsd (c-73-203-197-238.hsd1.tn.comcast.net [73.203.197.238]) by mail.pettijohn-web.com (OpenSMTPD) with ESMTPSA id 1437231f (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO) for ; Fri, 21 Jan 2022 17:05:03 -0600 (CST) Received: from [127.0.0.1] (localhost [127.0.0.1]) (authenticated bits=0) by bsd (8.16.1/8.16.1) with ESMTPSA id 20LN50FN010303 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO) for ; Fri, 21 Jan 2022 17:05:00 -0600 (CST) (envelope-from edgar@pettijohn-web.com) Content-Type: multipart/mixed; boundary="------------JUKunxzx0GQj0bKzTbtPs6DZ" Message-ID: <84ecd56f-e9d5-00c6-fc71-44ec06951f65@pettijohn-web.com> Date: Fri, 21 Jan 2022 17:04:59 -0600 List-Id: User questions List-Archive: https://lists.freebsd.org/archives/freebsd-questions List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:91.0) Gecko/20100101 Thunderbird/91.4.1 To: freebsd-questions@FreeBSD.org Content-Language: en-US From: Edgar Pettijohn Subject: how to use accf_http X-Rspamd-Queue-Id: 4JgZhw1kBnz4gcX X-Spamd-Bar: ++ Authentication-Results: mx1.freebsd.org; dkim=pass header.d=pettijohn-web.com header.s=dkim header.b=peleK8jF; dmarc=pass (policy=none) header.from=pettijohn-web.com; spf=pass (mx1.freebsd.org: domain of edgar@pettijohn-web.com designates 108.61.222.55 as permitted sender) smtp.mailfrom=edgar@pettijohn-web.com X-Spamd-Result: default: False [2.73 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:108.61.222.55:c]; HAS_ATTACHMENT(0.00)[]; TO_DN_NONE(0.00)[]; MIME_BASE64_TEXT_BOGUS(1.00)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[pettijohn-web.com:+]; MIME_BASE64_TEXT(0.10)[]; DMARC_POLICY_ALLOW(-0.50)[pettijohn-web.com,none]; NEURAL_HAM_SHORT(-0.97)[-0.965]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:+]; ASN(0.00)[asn:20473, ipnet:108.61.222.0/24, country:US]; MID_RHS_MATCH_FROM(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[73.203.197.238:received]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[pettijohn-web.com:s=dkim]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[multipart/mixed,text/plain,text/x-csrc]; MIME_BAD_ATTACHMENT(1.60)[c]; PREVIOUSLY_DELIVERED(0.00)[freebsd-questions@freebsd.org]; NEURAL_SPAM_MEDIUM(1.00)[1.000]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_SPAM_LONG(1.00)[1.000]; MLMMJ_DEST(0.00)[freebsd-questions]; RCVD_TLS_ALL(0.00)[] X-ThisMailContainsUnwantedMimeParts: N This is a multi-part message in MIME format. --------------JUKunxzx0GQj0bKzTbtPs6DZ Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit I've loaded the accf_http module. I tested it with the attached program, but it doesn't work as expected. I tested by telneting in and sending the word `hi'. I didn't expect this to make it through, but maybe I'm not understanding the accf_http filter. I then tested with curl which I would have expected to make it through anyway. Am I using it wrong? Thanks, Edgar edgar@bsd:~ $ sudo ./accf-http received: hi received: HEAD / HTTP/1.1 Host: localhost User-Agent: curl/7.79.1 Accept: */* --------------JUKunxzx0GQj0bKzTbtPs6DZ Content-Type: text/x-csrc; charset=UTF-8; name="accf-http.c" Content-Disposition: attachment; filename="accf-http.c" Content-Transfer-Encoding: base64 I2luY2x1ZGUgPHN5cy90eXBlcy5oPgojaW5jbHVkZSA8c3lzL3NvY2tldC5oPgoKI2luY2x1 ZGUgPG5ldGRiLmg+CgojaW5jbHVkZSA8ZXJyLmg+CiNpbmNsdWRlIDxlcnJuby5oPgojaW5j bHVkZSA8c3RkaW8uaD4KI2luY2x1ZGUgPHN0cmluZy5oPgojaW5jbHVkZSA8dW5pc3RkLmg+ CgppbnQKbWFpbihpbnQgYXJnYywgY2hhciAqKmFyZ3YpCnsKICAgIGludCBzb2NrLCBydiwg bmV3ZmQ7CiAgICBpbnQgeWVzID0gMTsKCiAgICBjaGFyIGJ1ZltCVUZTSVpdOwoKICAgIHNz aXplX3QgbmJ5dGVzOwoKICAgIHN0cnVjdCBhZGRyaW5mbyBoaW50cywgKmFpLCAq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luZm8oYWkpOwoKICAgIGlmIChsaXN0ZW4oc29jaywgLTEpID09IC0x KQogICAgICAgIGVycigxLCAibGlzdGVuIik7CgogICAgaWYgKChzZXRzb2Nrb3B0KHNvY2ss IFNPTF9TT0NLRVQsIFNPX0FDQ0VQVEZJTFRFUiwgJmFmYSwgc2l6ZW9mKGFmYSkpKSA9PSAt MSkKICAgICAgICBlcnJ4KDEsICIlcyIsIHN0cmVycm9yKGVycm5vKSk7CgphZ2FpbjoKICAg IG5ld2ZkID0gYWNjZXB0KHNvY2ssIChzdHJ1Y3Qgc29ja2FkZHIgKikmcmVtb3RlLCAmYWRk cmxlbik7CgogICAgaWYgKG5ld2ZkID09IC0xKQogICAgewogICAgICAgIHdhcm4oImFjY2Vw dCIpOwogICAgICAgIGdvdG8gYWdhaW47CiAgICB9CgogICAgbmJ5dGVzID0gcmVjdihuZXdm ZCwgYnVmLCBCVUZTSVosIDApOwoKICAgIGlmIChuYnl0ZXMgPD0gMCkKICAgIHsKICAgICAg ICBpZiAobmJ5dGVzID09IDApCiAgICAgICAgICAgIHByaW50Zigic29ja2V0ICVkIGh1bmcg dXBcbiIsIG5ld2ZkKTsKICAgICAgICBlbHNlCiAgICAgICAgICAgIHdhcm4oInJlY3YiKTsK ICAgICAgICBjbG9zZShuZXdmZCk7CiAgICAgICAgZ290byBhZ2FpbjsKICAgIH0KCiAgICBw cmludGYoInJlY2VpdmVkOlxuJXMiLCBidWYpOwogICAgY2xvc2UobmV3ZmQpOwogICAgZ290 byBhZ2FpbjsKCiAgICByZXR1cm4gMDsKfQo= --------------JUKunxzx0GQj0bKzTbtPs6DZ--