Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable mail MTA/SMTP configuration using MicroProfile Config #9939

Merged
merged 81 commits into from
Mar 26, 2024

Commits on Sep 20, 2023

  1. Configuration menu
    Copy the full SHA
    d6c0600 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    de759c1 View commit details
    Browse the repository at this point in the history
  3. feat(mail): add sane defaults for mail jvm settings at app level IQSS…

    …#7424
    
    We only default to no authentication. We still require people to
    configure an SMTP host, only in containers we do default to "smtp"
    as a hostname for that (see our compose file).
    
    Username/password cannot have a default and all other special settings
    should not be done here. These are highly setup specific.
    poikilotherm committed Sep 20, 2023
    Configuration menu
    Copy the full SHA
    72cdde9 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    02f1c3d View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    1f79f57 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    03b11bf View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    ee88cfd View commit details
    Browse the repository at this point in the history
  8. build(test): enable using GenericContainer without JUnit4 around

    As a hack to work around testcontainers/testcontainers-java#970,
    we add these fake, empty classes. Copied from Spring project.
    
    See also: testcontainers/testcontainers-java#970
    poikilotherm committed Sep 20, 2023
    Configuration menu
    Copy the full SHA
    600d209 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    6f6a9b7 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    c23ccde View commit details
    Browse the repository at this point in the history
  11. feat(mail): add explicit injection constructor to MailServiceBean IQS…

    …S#7424
    
    Necessary to add some integration testing, verifying sending mails
    actually should work.
    poikilotherm committed Sep 20, 2023
    Configuration menu
    Copy the full SHA
    eb1664f View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    086f766 View commit details
    Browse the repository at this point in the history
  13. build(mail): exclude geronimo javamail spec from dependencies

    If not excluded, the very old Javamail 1.4 spec is being used during
    local testing, obviously incompatible with Jakarta EE Mail definition.
    
    Exclusion is the only way around this, as we cannot possibly change the
    upstream dependencies.
    poikilotherm committed Sep 20, 2023
    Configuration menu
    Copy the full SHA
    51af5e1 View commit details
    Browse the repository at this point in the history

Commits on Sep 24, 2023

  1. Configuration menu
    Copy the full SHA
    36d78fd View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b612e1a View commit details
    Browse the repository at this point in the history

Commits on Oct 5, 2023

  1. Configuration menu
    Copy the full SHA
    bc55587 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c367e09 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    4c64051 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    2178c83 View commit details
    Browse the repository at this point in the history

Commits on Oct 6, 2023

  1. feat(mail): make system email address configurable via MPCONFIG IQSS#…

    …7424
    
    Besides adding the JVM option, the logic to receive the setting in MailServiceBean has changed.
    The method signature is now returning an optional to enforce the optional nature of the setting.
    This replaces the "null" contract from before and requires more changes to code using the lookup.
    poikilotherm committed Oct 6, 2023
    Configuration menu
    Copy the full SHA
    17aa5ad View commit details
    Browse the repository at this point in the history
  2. refactor(mail): make MailServiceBean use new lookup API for system ad…

    …dress IQSS#7424
    
    As we changed the lookup function to use Optional<InternetAddress> to enforce the optional
    nature of the setting, we now have to change the code using the function.
    poikilotherm committed Oct 6, 2023
    Configuration menu
    Copy the full SHA
    fd41607 View commit details
    Browse the repository at this point in the history
  3. feat(mail): provide lookup function for support mail address IQSS#7424

    To ease looking up the (also optional) setting of a support team mail address,
    the mail service is extended with another lookup function. This is intended
    to replace many manual, error prone lookups, also streamlining the fall-through
    behavior when not set, etc.
    poikilotherm committed Oct 6, 2023
    Configuration menu
    Copy the full SHA
    2bff977 View commit details
    Browse the repository at this point in the history
  4. refactor(mail): replace manual parsing with mail service lookups IQSS…

    …#7424
    
    As we now have proper functions to lookup the mail addresses, replace manual lookup and parsing with them.
    poikilotherm committed Oct 6, 2023
    Configuration menu
    Copy the full SHA
    de2f423 View commit details
    Browse the repository at this point in the history
  5. style(mail): deprecate db setting for system email IQSS#7424

    Document in code how to replace usages, too. (There aren't any,
    but in case someone is adding it again in the future, it helps to
    have docs)
    poikilotherm committed Oct 6, 2023
    Configuration menu
    Copy the full SHA
    81da403 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    59b09cb View commit details
    Browse the repository at this point in the history
  7. refactor(mail): remove unused MailUtil.parseSystemAddress IQSS#7424

    As we replaced the lookups and parsing with a streamlined version of it all
    in MailServiceBean, we don't need this helper function anymore.
    poikilotherm committed Oct 6, 2023
    Configuration menu
    Copy the full SHA
    7fc613f View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    5b418c0 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    2c3e054 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    8fac0f6 View commit details
    Browse the repository at this point in the history

Commits on Oct 9, 2023

  1. refactor(mail): simplify MailServiceBean.sendSystemEmail IQSS#7424

    - With JavaMail 1.6+, we have support for UTF-8 mail addresses and don't need to parse these ourselves
    - Remove some C-style coding and duplications
    - Make logging eat less cycles
    - Add missing Javadocs
    poikilotherm committed Oct 9, 2023
    Configuration menu
    Copy the full SHA
    9c7d9b5 View commit details
    Browse the repository at this point in the history

Commits on Oct 10, 2023

  1. feat(mail): enable UTF-8 mail address following RFC 6530 IQSS#7424

    - Make support configurable using new setting, defaulting to true
      (most MTAs today should support SMTPUTF8)
    - If need be and an admin disables the support, make email validator
      deny UTF-8 chars (otherwise no mails could be sent!)
    - Add logging message to send method to give hint about necessary
      UTF-8 support everywhere in the chain
    - Add (extensible) integration test for MailServiceBean to check
      sending mails actually works
    poikilotherm committed Oct 10, 2023
    Configuration menu
    Copy the full SHA
    b970eb5 View commit details
    Browse the repository at this point in the history
  2. fix(mail): lookup UTF-8 support config in static method to pick up ch…

    …anged value during tests
    
    Also switch to safer lookup via codepoint comparison to 7bit = chars < 128 in favor over encoder
    poikilotherm committed Oct 10, 2023
    Configuration menu
    Copy the full SHA
    05870d1 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    e9abfd2 View commit details
    Browse the repository at this point in the history
  4. fix(mail): make mail configuration entirely optional IQSS#7424

    Mail notification are optional (mostly to avoid setting up mail
    services in dev envs). Do not enforce MTA host config and do not
    pester logs about missing configuration.
    poikilotherm committed Oct 10, 2023
    Configuration menu
    Copy the full SHA
    7d1ba87 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    df53751 View commit details
    Browse the repository at this point in the history

Commits on Oct 11, 2023

  1. Configuration menu
    Copy the full SHA
    7a23d1a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    4bfda6c View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    b74d60f View commit details
    Browse the repository at this point in the history

Commits on Oct 15, 2023

  1. Configuration menu
    Copy the full SHA
    078d6d7 View commit details
    Browse the repository at this point in the history

Commits on Nov 8, 2023

  1. Configuration menu
    Copy the full SHA
    b194263 View commit details
    Browse the repository at this point in the history
  2. fix(mail): lookup legacy mail session programmatically IQSS#7424

    Using @resource on the field triggers deployments to fail if the resource is not provided by the app server.
    Using a programmatic lookup, we can catch and ignore the exception.
    poikilotherm committed Nov 8, 2023
    Configuration menu
    Copy the full SHA
    9397cc3 View commit details
    Browse the repository at this point in the history
  3. build(mail): add .map files to be included in resources IQSS#7424

    Without this change, the javamail maps would not be included in the artifact and trigger error messages in the logs about them being missed.
    
    The error message will still be present as long as payara/Payara#6254 is
    not fixed, released and we updated to a newer version of Payara.
    poikilotherm committed Nov 8, 2023
    Configuration menu
    Copy the full SHA
    d650725 View commit details
    Browse the repository at this point in the history
  4. feat(mail): add startup checks for mail configuration IQSS#7424

    During the deployment of Dataverse we check for conditions of the mail system that might not be done as people intend to use it.
    We'll only issue warnings in the log messages, nothing critical here.
    poikilotherm committed Nov 8, 2023
    Configuration menu
    Copy the full SHA
    11826d9 View commit details
    Browse the repository at this point in the history

Commits on Jan 17, 2024

  1. Configuration menu
    Copy the full SHA
    4efef85 View commit details
    Browse the repository at this point in the history

Commits on Feb 16, 2024

  1. test(mail): add more tests for mail session producer with invalid config

    Also fix minor linting with visibility of test methods.
    poikilotherm committed Feb 16, 2024
    Configuration menu
    Copy the full SHA
    213b025 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    7ff1e17 View commit details
    Browse the repository at this point in the history

Commits on Feb 20, 2024

  1. Configuration menu
    Copy the full SHA
    084fa32 View commit details
    Browse the repository at this point in the history
  2. test(mail): verify SMTP over SSL/TLS works

    Adding an integration test with self-signed certificates to enable verification SMTP over SSL works.
    poikilotherm committed Feb 20, 2024
    Configuration menu
    Copy the full SHA
    4d3904f View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    53e964a View commit details
    Browse the repository at this point in the history
  4. style(settings): ignore SonarCube rule S115 for DB settings

    The DB settings names are not compliant with usual Java enum name rules. Ignoring to avoid unnecessary clutter, hiding more important problems.
    poikilotherm committed Feb 20, 2024
    Configuration menu
    Copy the full SHA
    abcb131 View commit details
    Browse the repository at this point in the history
  5. doc(settings): add section on secure password storage in security sec…

    …tion
    
    The section about securing your installation was missing hints about how to store and access passwords in a safe manner.
    
    Now having a single place to reference from everywhere makes the config bits for passwords much more readable, as we do not need to provide as many examples.
    poikilotherm committed Feb 20, 2024
    Configuration menu
    Copy the full SHA
    b0d268d View commit details
    Browse the repository at this point in the history
  6. feat(installer): make installer use new way to apply mail MTA config

    Instead of setting a DB setting, we now simply apply system properties.
    Also, aligned with the way the "from" address is now bound to be the system mail address, this commit removes this subtle difference in the installer as well.
    poikilotherm committed Feb 20, 2024
    Configuration menu
    Copy the full SHA
    f690c47 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    9824425 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    5dcaba9 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    a48e860 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    6f5cc9f View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    930fc1b View commit details
    Browse the repository at this point in the history

Commits on Feb 21, 2024

  1. Configuration menu
    Copy the full SHA
    d82cff4 View commit details
    Browse the repository at this point in the history

Commits on Mar 12, 2024

  1. Configuration menu
    Copy the full SHA
    e11a623 View commit details
    Browse the repository at this point in the history

Commits on Mar 21, 2024

  1. Configuration menu
    Copy the full SHA
    af7171e View commit details
    Browse the repository at this point in the history

Commits on Mar 22, 2024

  1. Configuration menu
    Copy the full SHA
    6b15b12 View commit details
    Browse the repository at this point in the history

Commits on Mar 25, 2024

  1. docs(mail): apply suggestions from code review

    Thanks @pdurbin!
    
    Co-authored-by: Philip Durbin <philipdurbin@gmail.com>
    poikilotherm and pdurbin authored Mar 25, 2024
    Configuration menu
    Copy the full SHA
    db9cd86 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    83d29b1 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    ff3b1a1 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    ac74b23 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    f263a4e View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    caf5682 View commit details
    Browse the repository at this point in the history

Commits on Mar 26, 2024

  1. fix(mail): remove duplicate JvmSettings.MAIL_MTA_HOST

    The setting is already covered by the "host" property string in MailSessionProducer.
    poikilotherm committed Mar 26, 2024
    Configuration menu
    Copy the full SHA
    362b87e View commit details
    Browse the repository at this point in the history
  2. fix(mail): do not add a default for SMPT host in ct profile

    As Payara 6.2023.7 still suffers from the MPCONFIG bug where a profiled setting is not easy to override, lets just remove the default for the container profile and make people add it even for containers.
    poikilotherm committed Mar 26, 2024
    Configuration menu
    Copy the full SHA
    b8ca4a7 View commit details
    Browse the repository at this point in the history
  3. style(mail): enable more debug output from session producer

    In case people want to debug Jakarta Mail, they activate dataverse.mail.debug. Let's hook into that and add more verbose output from the session producer, too. That way people can make sure everything is set up as they wish.
    poikilotherm committed Mar 26, 2024
    Configuration menu
    Copy the full SHA
    d8198b5 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    2a73426 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    21aa73d View commit details
    Browse the repository at this point in the history
  6. fix dot to dash

    pdurbin authored Mar 26, 2024
    Configuration menu
    Copy the full SHA
    3619371 View commit details
    Browse the repository at this point in the history
  7. doc(mail): add ssl.enable setting to shortlist

    Also add notes about common ports in use.
    poikilotherm committed Mar 26, 2024
    Configuration menu
    Copy the full SHA
    c498ceb View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    5d7a863 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    3e9d992 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    785dfc5 View commit details
    Browse the repository at this point in the history
  11. chore(build): downgrade DMP to 0.43.4

    We need to downgrade to 0.43.4 again because of this regression: fabric8io/docker-maven-plugin#1756
    Once they release a new version, try again.
    poikilotherm committed Mar 26, 2024
    Configuration menu
    Copy the full SHA
    6b8b907 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    df48382 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    cb14423 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    e784eb3 View commit details
    Browse the repository at this point in the history