Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/relay_minitest/test_relay.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,26 +102,27 @@ def test_one_on_one_smtp_only(self, cmfactory, cmfactory2, relayadmin2, lp):
msg2 = ac2.wait_for_incoming_msg()
assert msg2.get_snapshot().text == "should still arrive over smtp"


def test_hide_senders_ip_address(cmfactory, ssl_context):
public_ip = requests.get("http://icanhazip.com").content.decode().strip()
assert ipaddress.ip_address(public_ip)

user1, user2 = cmfactory.get_online_accounts(2)
user2.set_config("bcc_self", "1")
chat = cmfactory.get_accepted_chat(user1, user2)

chat.send_text("testing submission header cleanup")
user2.wait_for_incoming_msg()

addr = user2.get_config("addr")
host = addr.split("@")[1].strip("[]")
pw = user2.get_config("mail_pw")
mailbox = imap_tools.MailBox(host, ssl_context=ssl_context)
mailbox.login(addr, pw)
msgs = list(mailbox.fetch(mark_seen=False))

assert msgs, "expected at least one message"
assert public_ip not in msgs[0].obj.as_string()


def test_unencrypted_rejection(cmsetup, lp):
"""Test that unencrypted messages are rejected by the relay."""
lp.sec("creating users")
Expand Down
Loading