PKP/Bug Fixes/SPF
Back to PKP Bug Fixes
Contents
Introduction
To combat spam and email phishing a new email system called the "Sender Policy Framework" (SPF) is being adopted world wide by academic institutions and others. This is a very recent development and therefore OJS systems must be retroactively configured to support SPF. This wiki page documents these efforts at Stellenbosch University Library.
What is the SPF?
https://en.wikipedia.org/wiki/Sender_Policy_Framework
From Wikipedia (retrieved 2016/05/17);
"Sender Policy Framework (SPF) is a simple email-validation system designed to detect email spoofing by providing a mechanism to allow receiving mail exchangers to check that incoming mail from a domain comes from a host authorized by that domain's administrators.[1] The list of authorized sending hosts for a domain is published in the Domain Name System (DNS) records for that domain in the form of a specially formatted TXT record. Email spam and phishing often use forged "from" addresses, so publishing and checking SPF records can be considered anti-spam techniques."
How does the SPF work?
To determine if there is an SPF record for a sending domain, use the "dig" command as per example below in a terminal;
dig txt sun.ac.za
See:http://stackoverflow.com/questions/4082935/using-dig-to-search-for-spf-records
As can be seen from the sample records below the implementation per institution differs, but the point is that each domain is now SPF enabled and therefore OJS must adapt.
Sample output for "sun.ac.za" (2016/05/17)
; <<>> DiG 9.10.3-P4-Ubuntu <<>> txt sun.ac.za ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 50092 ;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 1 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 4000 ;; QUESTION SECTION: ;sun.ac.za. IN TXT ;; ANSWER SECTION: sun.ac.za. 25238 IN TXT "University of Stellenbosch, South Africa" sun.ac.za. 25238 IN TXT "ydW1uk2ljPYuIuijeNP29VqLY1fH/1BYzJ8XkvuCmpe7b1pltGc4EaZcvw7V1PTKi5JkCgzH95fQNDdjOALHwQ==" sun.ac.za. 25238 IN TXT "v=spf1 ip4:146.232.64.12 ip4:146.232.64.13 ip4:146.232.64.14 include:spf.protection.outlook.com -all" sun.ac.za. 25238 IN TXT "Google Domain Verification 07082014" ;; Query time: 0 msec ;; SERVER: 127.0.1.1#53(127.0.1.1) ;; WHEN: Tue May 17 11:44:35 SAST 2016 ;; MSG SIZE rcvd: 353
Sample output for "uct.ac.za" (2016/05/17)
; <<>> DiG 9.10.3-P4-Ubuntu <<>> txt uct.ac.za ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 62084 ;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 1 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 4000 ;; QUESTION SECTION: ;uct.ac.za. IN TXT ;; ANSWER SECTION: uct.ac.za. 3600 IN TXT "Ox1qfakkMKmET7grQG8BzAU0BFKkXZlwIZLm68SBnlYXFefU2YK8lhbZCzevz88UNYx5QNheElQe6z5u/uApjQ==" uct.ac.za. 3600 IN TXT "v=spf1 ip4:137.158.153.103 ip4:137.158.153.104 ip4:137.158.154.116 ip4:137.158.154.166 ip4:137.158.154.117 ip4:137.158.154.165 a include:_netblocks.mimecast.com include:spf.protection.outlook.com ~all" uct.ac.za. 3600 IN TXT "MS=ms97433074" ;; Query time: 11 msec ;; SERVER: 127.0.1.1#53(127.0.1.1) ;; WHEN: Tue May 17 11:48:43 SAST 2016 ;; MSG SIZE rcvd: 378
Sample output for "up.ac.za" (2016/05/17)
; <<>> DiG 9.10.3-P4-Ubuntu <<>> txt up.ac.za ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 51005 ;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 1 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 4000 ;; QUESTION SECTION: ;up.ac.za. IN TXT ;; ANSWER SECTION: up.ac.za. 3600 IN TXT "google-site-verification=uZeP8pM4K0sBZNWCE4gAo8-gK4_WzH-nFuMRUlk4408" up.ac.za. 3600 IN TXT "MS=ms60833582" up.ac.za. 3600 IN TXT "v=spf1 ip4:137.215.0.0/16 mx ?all" ;; Query time: 22 msec ;; SERVER: 127.0.1.1#53(127.0.1.1) ;; WHEN: Tue May 17 11:50:04 SAST 2016 ;; MSG SIZE rcvd: 190
Using a "no-reply" email address for the system
For system mail to be managed, a no-reply system account needs to be created per federated journal system.
See sample OJS config below;
; Allow envelope sender to be specified ; (may not be possible with some server configurations) allow_envelope_sender = On ; Default envelope sender to use if none is specified elsewhere default_envelope_sender = no-reply@sun.ac.za ; Force the default envelope sender (if present) ; This is useful if setting up a site-wide noreply address ; The reply-to field will be set with the reply-to or from address. force_default_envelope_sender = On ; Enable attachments in the various "Send Email" pages. ; (Disabling here will not disable attachments on features that ; require them, e.g. attachment-based reviews) enable_attachments = On ; Amount of time required between attempts to send non-editorial emails ; in seconds. This can be used to help prevent email relaying via OJS. time_between_emails = 3600 ; Maximum number of recipients that can be included in a single email ; (either as To:, Cc:, or Bcc: addresses) for a non-priveleged user max_recipients = 10 ; If enabled, email addresses must be validated before login is possible. require_validation = On ; Maximum number of days before an unvalidated account expires and is deleted validation_timeout = 14
Using GMail as the "official" sender
It is expected that most institutions will allow sending of emails from the gmail servers. To apply this on OJS, try the following;
Sender Addresses in EMail
Like paper mail letters, e-mail messages have at least two kinds of sender addresses: one on the envelope and one in the letterhead.
The envelope sender address (sometimes also called the return-path) is used during the transport of the message from mail server to mail server, e.g. to return the message to the sender in the case of a delivery failure. It is usually not displayed to the user by mail programs.
The header sender address of an e-mail message is contained in the "From" or "Sender" header and is what is displayed to the user by mail programs. Generally, mail servers do not care about the header sender address when delivering a message.
References
- Read the PKP FAQ about SPF
- http://www.unifiedemail.net/Tools/SPFParser
- http://www.openspf.org
- http://www.openspf.org/SPF_Record_Syntax
- http://www.jscape.com/blog/smtp-vs-imap-vs-pop3-difference
- https://tools.ietf.org/html/rfc7208
- https://dmarc.org/overview/
- https://dmarc.org/wiki/FAQ
- https://blog.returnpath.com/how-to-explain-dmarc-in-plain-english/
- https://www.sympa.org/manual/dmarc