Fix the arcsign script so it works with the current API
This commit is contained in:
@@ -1,4 +1,8 @@
|
|||||||
UNRELEASED Version 0.9.2
|
UNRELEASED Version 0.9.2
|
||||||
|
- Fix the arcsign script so it works with the current API (Note: the new
|
||||||
|
srv_id option is the authserv_id to use in the ARC signatures - Only AR
|
||||||
|
fields with an authserv-id that matches srv_id will be considered for
|
||||||
|
ARC signing)
|
||||||
- Refactor canonicalization.py strip_trailing_lines to avoid using re for
|
- Refactor canonicalization.py strip_trailing_lines to avoid using re for
|
||||||
more consistent processing across python versions (Thanks to Jonathan
|
more consistent processing across python versions (Thanks to Jonathan
|
||||||
Bastien-Filiatrault for the change)
|
Bastien-Filiatrault for the change)
|
||||||
|
|||||||
+5
-4
@@ -37,8 +37,8 @@ logging.basicConfig(level=10)
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
if len(sys.argv) != 4:
|
if len(sys.argv) != 5:
|
||||||
print("Usage: arcsign.py selector domain privatekeyfile", file=sys.stderr)
|
print("Usage: arcsign.py selector domain privatekeyfile srv_id", file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if sys.version_info[0] >= 3:
|
if sys.version_info[0] >= 3:
|
||||||
@@ -49,17 +49,18 @@ def main():
|
|||||||
selector = sys.argv[1].encode('ascii')
|
selector = sys.argv[1].encode('ascii')
|
||||||
domain = sys.argv[2].encode('ascii')
|
domain = sys.argv[2].encode('ascii')
|
||||||
privatekeyfile = sys.argv[3]
|
privatekeyfile = sys.argv[3]
|
||||||
|
srv_id = sys.argv[4].encode('ascii')
|
||||||
|
|
||||||
message = sys.stdin.read()
|
message = sys.stdin.read()
|
||||||
|
|
||||||
# Pick a cv status
|
# Pick a cv status
|
||||||
cv = dkim.CV_None
|
cv = dkim.CV_None
|
||||||
if re.search('arc-seal', message, re.IGNORECASE):
|
if re.search(b'arc-seal', message, re.IGNORECASE):
|
||||||
cv = dkim.CV_Pass
|
cv = dkim.CV_Pass
|
||||||
|
|
||||||
#try:
|
#try:
|
||||||
sig = dkim.arc_sign(message, selector, domain, open(privatekeyfile, "rb").read(),
|
sig = dkim.arc_sign(message, selector, domain, open(privatekeyfile, "rb").read(),
|
||||||
domain + ": none", cv, dkim.util.get_linesep(message))
|
srv_id, cv, dkim.util.get_linesep(message))
|
||||||
for line in sig:
|
for line in sig:
|
||||||
sys.stdout.write(line)
|
sys.stdout.write(line)
|
||||||
sys.stdout.write(message)
|
sys.stdout.write(message)
|
||||||
|
|||||||
Reference in New Issue
Block a user