You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

174 lines
5.7 KiB

  1. #
  2. # Copyright (C) 2009 David Cooper <dave@kupesoft.com>
  3. # Copyright (C) 2016-2019 Daniel Dickinson <cshored@thecshore.com>
  4. #
  5. # This is free software, licensed under the GNU General Public License v2.
  6. # See /LICENSE for more information.
  7. #
  8. include $(TOPDIR)/rules.mk
  9. PKG_NAME:=msmtp-scripts
  10. PKG_VERSION:=1.2.4
  11. PKG_RELEASE:=2
  12. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  13. PKG_SOURCE_URL:=https://launchpad.net/$(PKG_NAME)/1.2/$(PKG_VERSION)/+download
  14. PKG_HASH:=fc85ab8ed1348be584adfc1feb89f51daed7404e9e8643652ff31d2af00f1cf5
  15. PKG_MAINTAINER:=Daniel F. Dickinson <cshored@thecshore.com>
  16. PKG_LICENSE:=GPL-3.0-or-later
  17. PKG_LICENSE_FILES:=COPYING
  18. include $(INCLUDE_DIR)/package.mk
  19. define Package/msmtp-scripts/Default
  20. SECTION:=mail
  21. CATEGORY:=Mail
  22. TITLE:=Forwarding only SMTP with queuing
  23. URL:=https://msmtp-scripts.thecshore.com
  24. endef
  25. define Package/msmtp-scripts/Default/description
  26. msmtp-scripts are scripts wrappers around the msmtp SMTP client that
  27. add queueing, logging to syslog or file, and a subset of sendmail/postfix
  28. mailq/postsuper/postqueue commands implemented in a compatible fashion.
  29. endef
  30. define Package/msmtpq-ng
  31. $(call Package/msmtp-scripts/Default)
  32. DEPENDS+= +msmtp
  33. TITLE+= (common)
  34. endef
  35. define Package/msmtpq-ng/conffiles
  36. /etc/msmtpq-ng.rc
  37. endef
  38. define Package/msmtpq-ng/description
  39. $(call Package/msmtp-scripts/Default/description)
  40. This package contains the msmtpq-ng and msmtpq-ng-queue
  41. wrappers around msmtp, which provide the bulk of the
  42. functionality.
  43. endef
  44. define Package/msmtpq-ng-mta
  45. $(call Package/msmtp-scripts/Default)
  46. TITLE+= (as MTA)
  47. DEPENDS+=+msmtpq-ng
  48. ALTERNATIVES:=\
  49. 400:/usr/sbin/sendmail:/usr/sbin/msmtpq-ng-mta \
  50. 400:/usr/lib/sendmail:/usr/sbin/msmtpq-ng-mta \
  51. 400:/usr/sbin/mailq:/usr/sbin/msmtpq-ng-queue-mta \
  52. 400:/usr/sbin/postqueue:/usr/sbin/msmtpq-ng-queue-mta \
  53. 400:/usr/sbin/postsuper:/usr/sbin/msmtpq-ng-queue-mta
  54. endef
  55. define Package/msmtpq-ng-mta/conffiles
  56. /etc/msmtpq-ng-mta.rc
  57. endef
  58. define Package/msmtpq-ng-mta/description
  59. $(call Package/msmtp-scripts/Default/description)
  60. This package provides sendmail, mailq, postfix,
  61. and postsuper symlinks to wrappers that configure
  62. msmtpq-ng for use as the system mail transport
  63. agent via the sendmail command.
  64. **NB**: In order for msmtpq-ng-mta aka sendmail to
  65. send mail for non-root users (not just queue it
  66. after failing), the user must have permissions to
  67. access /etc/msmtprc -- package msmtp sets msmtprc
  68. to rw only by root by default as a security measure
  69. (it _can_ contain information like passwords with
  70. which to send mail through your email server).
  71. There are a couple of choices. One is to leave
  72. the default permissions (in which cases the mail
  73. will queue and fail to send until the mailq -q
  74. runner which runs in a root crontab sends the mail).
  75. Another is to give any non-root daemon users (or
  76. any other users) group access (i.e. create a
  77. group for all the users who should be able to
  78. send mail, add the users to it, and give the
  79. group read-only permissions on the msmtrpc).
  80. A final option (which is only resonable if you
  81. have no secrets in msmtprc because you are
  82. sending unauthenticated mail to a server that
  83. accepts mail directly for the intended user --
  84. usually that means a self-hosted system mail
  85. server, rather than trying to send mail to
  86. public servers (which don't typically accept
  87. mail from normal user IP addresses, even if
  88. you ISP doesn't block the traffic) is to
  89. make msmtprc world readable.
  90. The first option is probably the best choice
  91. for most users, as it just means a 15
  92. minute delay in the mail getting off the
  93. system, and doesn't involve special permissions
  94. for non-root daemons or users.
  95. endef
  96. define Package/msmtpq-ng-mta-smtpd
  97. $(call Package/msmtp-scripts/Default)
  98. DEPENDS+= +msmtpq-ng-mta +xinetd
  99. TITLE+= (localhost SMTPd)
  100. USERID:=msmtp=482:msmtp=482
  101. endef
  102. define Package/msmtp-ng-mta-smtpd/description
  103. $(call Package/msmtp-scripts/Default/description)
  104. This package uses the -bs option to msmtpq-ng
  105. (which, like the sendmail -bs command, provides
  106. SMTP over stdin/stdout) combined with xinetd to
  107. provide a basic SMTP server. In it's default
  108. configuration it only accepts connections from
  109. localhost AND network mail must be released from
  110. the hold queue before it can be delivered.
  111. endef
  112. define Package/msmtpq-ng-mta-smtpd/conffiles
  113. /etc/xinetd.d/ms-mta-smtpd
  114. endef
  115. define Package/msmtpq-ng-mta/postinst
  116. mkdir -p $${IPKG_INSTROOT}/etc/crontabs
  117. if ! grep -q msmtpq-ng-mta $${IPKG_INSTROOT}/etc/crontabs/root 2>/dev/null; then echo $$'\n'"*/60 * * * * /usr/bin/msmtpq-ng-mta -q" >>$${IPKG_INSTROOT}/etc/crontabs/root; fi
  118. endef
  119. define Build/Configure
  120. true
  121. endef
  122. define Build/Compile
  123. true
  124. endef
  125. define Package/msmtpq-ng/install
  126. $(INSTALL_DIR) $(1)/etc
  127. $(INSTALL_DATA) ./files/msmtpq-ng.rc $(1)/etc/msmtpq-ng.rc
  128. $(INSTALL_DIR) $(1)/usr/bin
  129. $(CP) $(PKG_BUILD_DIR)/src/usr/bin/msmtpq-ng $(1)/usr/bin/
  130. $(SED) "s,nc -vz,printf \"HEAD / HTTP/1.1\\\\r\\\\nHost: \$$$${EMAIL_CONN_TEST_SITE}\\\\r\\\\n\\\\r\\\\n\"|nc," $(1)/usr/bin/msmtpq-ng
  131. $(CP) $(PKG_BUILD_DIR)/src/usr/bin/msmtpq-ng-queue $(1)/usr/bin/
  132. endef
  133. define Package/msmtpq-ng-mta/install
  134. $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/sbin $(1)/usr/lib $(1)/etc/init.d
  135. $(INSTALL_DATA) ./files/msmtpq-ng-mta.rc $(1)/etc/
  136. $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/usr/sbin/msmtpq-ng-mta $(1)/usr/sbin/
  137. $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/usr/sbin//msmtpq-ng-queue-mta $(1)/usr/sbin/
  138. $(INSTALL_DIR) $(1)/etc/crontabs
  139. $(INSTALL_BIN) ./files/msmtpq-ng-mta.init $(1)/etc/init.d/msmtpq-ng-mta
  140. endef
  141. define Package/msmtpq-ng-mta-smtpd/install
  142. $(INSTALL_DIR) $(1)/etc/xinetd.d
  143. $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/etc/xinetd.d/ms-mta-smtpd $(1)/etc/xinetd.d/ms-mta-smtpd
  144. endef
  145. $(eval $(call BuildPackage,msmtpq-ng))
  146. $(eval $(call BuildPackage,msmtpq-ng-mta))
  147. $(eval $(call BuildPackage,msmtpq-ng-mta-smtpd))