GithubHelp home page GithubHelp logo

stephen-kruger / bluebox Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 6.0 4.2 MB

A promiscuous, non-forwarding SMTP server and webmail client to facilitate testing of applications which generate email.

Shell 0.41% Java 99.15% CSS 0.41% Dockerfile 0.03%

bluebox's Introduction

Bluebox

Many teams develop software that rely heavily on sending emails (for sign-up, social software notifications etc). Properly testing this software requires multiple "fake" email addesses to allow testing of the capabilities of the software from various points of view and roles Traditionally we either used Google Mail (which allowed random prefixes to be added to email addresses), or other services such as Mailinator However sending such emails from unreleased products, potentially containing trade secrets, non-public product information and other private information to the public internet is not feasible, and an internal service was needed.

Bluebox is a fully functional promiscuous, non-forwarding SMTP server and mailbox web interface to allow receiving of arbitrary emails for use in testing and development environments. Inspired by the very useful Mailinator service. Provides API for scripted use by test automation.

Installing

Downloading the war file

Download the Bluebox war file from the latest releases

Installing in Websphere Liberty

Download and install the latest Liberty profile from here

Suggest using WebSphere Liberty Web Profile 8 21.0.0.12

Set up a Liberty profile for your bluebox server:

Create a bluebox profile using the WLP server command

<wlp_root>/bin/server create bluebox

Then navigate to the newly created profile (generally <wlp_root>/wlp/usr/servers/bluebox) and edit the server.xml. An example is given here for reference :

<?xml version="1.0" encoding="UTF-8"?>
<server description="bluebox server">

    <!-- Enable features -->
    <featureManager>
        <!--
        <feature>jaxrs-2.1</feature>
        <feature>jaxws-2.2</feature>
        <feature>jsp-2.3</feature>
        <feature>servlet-3.1</feature>
        <feature>appSecurity-2.0</feature>
        -->
        <feature>webProfile-7.0</feature>
    </featureManager>

        <basicRegistry id="defaultRegistry">
                <group id="bluebox" name="bluebox">
                        <member id="bluebox" name="bluebox"/>
                </group>
                <user id="bluebox" name="bluebox" password="password"/>
        </basicRegistry>


    <!-- To access this server from a remote client add a host attribute to the following element, e.g. host="*" -->
    <httpEndpoint id="defaultHttpEndpoint"
                host="*"
                  httpPort="8080"
                  httpsPort="8443" />

    <!-- Automatically expand WAR files and EAR files -->
    <applicationManager autoExpand="true"/>
    <webApplication id="bluebox" location="bluebox.war" context-root="/"
        name="bluebox">
        <classloader apiTypeVisibility="spec, ibm-api, api, third-party" />
        <application-bnd>
                <security-role name="bluebox" id="bluebox">
                        <user name="bluebox" id="bluebox" access-id="bluebox"></user>
                </security-role>
        </application-bnd>
    </webApplication>
</server>

Copy the Bluebox war file to the <wlp_root>/user/servers/bluebox/apps directory

Install the required features using command

<wlp_root>/bin/installUtility install bluebox

You can then start the server by running the command

<wlp_root>/wlp/bin/server start bluebox

Database options

On startup, if Bluebox detects a running instance of MongoDB, it will automatically set up and use that. Otherwise it will use an embedded H2 database which is a little less performant than MongoDB.

Check the SMTP server

For security reasons the SMTP server will start on port 2500 instead of the expected port 25. So to recieve emails you need to either map port 25 to 2500, or change the config (see Additional Customisation section below)

Option A: Map the port

On Linux run this command iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp --dport 25 -j REDIRECT --to-ports 2500

Option B: Change the config

On Windows systems, or if you don't mind starting the application server as root, you can change the default settings overriding them in bluebox.properties This file will be checked for in the Websphere Liberty server directory (e.g. [wlp dir]/usr/server/defaultServer/bluebox.properties). Some commonly used properties are :

# SMTP server port
bluebox_port=2500
# maximum mail size in bytes
bluebox_mail_limit=100000000
# how many hours to keep trashed messages
bluebox_trash_age=12
# how many hours to keep messages (1344 = 8 weeks, 2688 = 16 weeks)
bluebox_message_age=5376
# trim messages (oldest first) to never exceed this limit
bluebox_message_max=160000
# frequency in minutes to run the expiry daemon
bluebox_daemon_delay=60

Verify the smtp server is working

You can test it using simple telnet to see if the SMTP server responds on the default SMTP port:

telnet myhost.name 25
220 myhost.name ESMTP BlueBox V4.5.2

FAQ

How do I use it?

The easiest way : simply send an email to any address you like using the @bluebox.xxx.com domain For example send a test mail using your Notes client to [email protected] or [email protected] Then enter the email address into the form here at BlueBox? to show your inbox Another way : set your SMTP server to bluebox.xxx.com, you can send emails to any address and any domain (although they will all be delivered and available only on bluebox.xxx.com)

How long will my email be available?

Messages will be automatically deleted after 48 hours Mails in the Trash folder (i.e. explicitly deleted by the user)will be removed after 12 hours If you require it for longer, simply use the Download button to save a copy to disk, or attach to a defect report You can then use the Upload functionality to re-inject it into the system as many times as you like

SMTP Open Relay Test scans are complaining Bluebox is an open relay

These scans generally test if an SMTP server accepts email from arbitrary domains. By design, Bluebox IS very forgiving, and will accept any messages unless otherwise configured via blacklist or whitelist However no mails, regardless of recipient, are EVER forwarded on to other systems. So any scan which implies Bluebox is an open relay is not correctly implemented, as they would need to validate that a test email is actually delivered to a different MX domain - but generally these tests are lazily written, and only go as far as testing that the SMTP server performs the "accept" handshake. It is possible to defend against some of these poorly written relay scans by intelligently configuring the bluebox_to_blacklist or bluebox_from_blacklist in bluebox.properties: Run the offending scan program, and check the app server logs to detect what email is being used to run the test (e.g. [email protected]), and then add that domain to the bluebox_to_blacklist, which will cause rejection of any messages from that domain, hopefully fooling the simple-minded Open Relay scan.

Can I hide certain emails?

Yes, if you include the string "hideme" anywhere in the recipients email address, that email will only be visible if you navigate directly to the inbox for the user, and those emails will not show up in the type-ahead or search results.

Can I send mails to other domains?

BlueBox itself does not do any mail forwarding, only incoming mail is accepted It's not very scrupulous about destination addresses, so if you have set bluebox as your smtp server, you can send to any hostnames that you like. Such as [email protected], [email protected], or any other domain you might want, but no mails will ever be sent from your bluebox server outwards.

Terms and conditions of usage

Please do not use BlueBox for any business critical applications Please respect others may be using the system - don't delete mails which are not yours This software is provided as is. Availability and support is limited to the goodwill of the author, or patches you may wish to submit. Bear in mind that everyone will be able to view your emails, and it is your responsability to ensure secure use of this utility.

License

Copyright 2016 Stephen Kruger

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

bluebox's People

Contributors

dependabot[bot] avatar stephen-kruger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

bluebox's Issues

errors.jsp stylig issue

What steps will reproduce the problem?
1. render the errors page from menu bar
2. note thw right hand col (stats.jsp)
3.

What is the expected output? What do you see instead?
The "Total Traffic" header should be approx 1em from bottom of menu bar instead 
of being so far down
See attachment for details


Original issue reported on code.google.com by [email protected] on 10 Jul 2014 at 8:38

Attachments:

Searching by email content when filtered by email brings up doubled email results

Issue: I am seeing doubles of certain emails in the search results.

Steps to reproduce:

  1. Filter by email address first (test_sst_fvt_operations_user_01)
  2. Search for an email subject that occurs in more than one email (OMS NA)
  3. Count the emails = 25. Look at identifying features of each email (there are, for example, 2 emails with fvt01 in them when there should be 1).
  4. Refresh the page to clear the search. Count the emails with this subject in them without the search (the ones with OMS NA in them were all received in a row in one day). There are 21 emails and identifying features of emails are correct (1 email with fvt01 in its subject).

Available bluebox servers

Stephen, are there any IBM bluebox servers available that can be reached from Internet? We would need them for test automation of a production system.

Missing classes from latest release 4.6.0

Hey Stephen! Here's a name from the past, eh? Hope you are doing well.

Just wanted to let you know that your latest 4.6.0 package is missing the servlet classes in WEB-INF/classes. I had to go back to 4.5.16 to find them.

Search inbox or all does not find the message

Search in both 'inbox' and 'All' for scnsvtdsw-20170322-052431
but nothing comes back.
Refresh the the Inboxes and scroll down through the messages and I find the one I am looking for.
Seems something is busted with the Searchabilty.
We know there are untoward exceptions in the server logs.
Please investigate and when you find the cause make the appropriate code or other changes as required to fix the problem. Thanks in advance.

Symbolic link to webapps directory does not exist in RPM

Hi Stephen,
Tthe war file is generated in /var/lib/tomcat6/webapps/ and originally it was creating a symbolic link between that directory and /opt/tomcat6/webapps/ but in version bluebox-4.3.4-1.noarch it's not.

To work around it I've run:
rm -rf /opt/tomcat/webapps/
ln -s /var/lib/tomcat6/webapps/ /opt/tomcat/

Thanks,
Brian

SMTP server is returning error 421 4.3.0 when attempting to send email.

In the file messages.log, I see this:

[12/9/21, 22:09:48:701 UTC] 00000030 com.ibm.ws.channel.ssl.internal.SSLHandshakeErrorTracker
E CWWKO0801E: Unable to initialize SSL connection. Unauthorized access was denied or security settings have expired. Exception is javax.net.ssl.SSLException: Session has no PSK

How do I go about resolving this?

EDIT: Posted the incorrect error message. The error above is when I access the HTTPS site on port 8443. Below is the error I get when I try to send an email from another host that I've DNAT'd to bluebox:

[err] Exception in thread "pool-2-thread-28"                                                                                                                                                                                                            
[err] java.lang.NoSuchMethodError: 'void com.sun.mail.util.LineInputStream.<init>(java.io.InputStream, boolean)'                                                                                                                                        
[err]   at javax.mail.internet.InternetHeaders.load(InternetHeaders.java:422)                                                                                                                                                                           
[err]   at [internal classes]                                                                                                                                                                                                                           
[err]   at com.bluebox.Utils.loadEML(Utils.java:155)                                                                                                                                                                                                    
[err]   at com.bluebox.smtp.storage.mongodb.MongoImpl.getSpooledStream(MongoImpl.java:610)                                                                                                                                                              
[err]   at com.bluebox.smtp.Inbox.deliver(Inbox.java:695)                                                                                                                                                                                               
[err]   at org.subethamail.smtp.helper.SimpleMessageListenerAdapter$Handler.data(SimpleMessageListenerAdapter.java:142)                                                                                                                                 
[err]   at org.subethamail.smtp.command.DataCommand.execute(DataCommand.java:64)                                                                                                                                                                        
[err]   at org.subethamail.smtp.server.RequireTLSCommandWrapper.execute(RequireTLSCommandWrapper.java:30)                                                                                                                                               
[err]   at org.subethamail.smtp.server.CommandHandler.handleCommand(CommandHandler.java:99)                                                                                                                                                             
[err]   at org.subethamail.smtp.server.Session.runCommandLoop(Session.java:244)                                                                                                                                                                         
[err]   at org.subethamail.smtp.server.Session.run(Session.java:145)                                                                                                                                                                                    
[err]   at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)                                                                                                                                                    
[err]   at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)                                                                                                                                                    
[err]   at java.base/java.lang.Thread.run(Thread.java:829)

I hope this is just some simple configuration issue.

can't accept NDRs from Domino?

What steps will reproduce the problem?
1. Telnet to an MTA and craft an e-mail which has an @bluebox.lotus.com sender 
and an invalid recipient address (but valid domain) that will target an 
environment running Domino mail servers
2. An NDR will bounce back to bluebox.  Bluebox will show an error here: 
http://bluebox.lotus.com/bluebox/app/errors.jsp

javax.mail.internet.AddressException: Illegal address in string ``''


What is the expected output? >> I expected bb to accept NDRs from Domino <<    
What do you see instead? >> an error <<


What version of the product are you using? n/a On what operating system? n/a


Original issue reported on code.google.com by [email protected] on 3 Sep 2014 at 1:48

Latest release does not work with Websphere Liberty(Open Liberty) in a Docker container

Compared to 4.5.3 release, there are several issues with latest release:

  1. The configuration override is not picked up.
  2. There are warnings about logging not having providers available during startup.
  3. When email is delivered to the server, there is a NullPointerException printed on console:
[err] java.lang.NullPointerException
[err]   at com.bluebox.smtp.storage.h2.H2Impl.setProperty(H2Impl.java:629)
[err]   at com.bluebox.smtp.storage.h2.H2Impl.logError(H2Impl.java:691)
[err]   at com.bluebox.smtp.Inbox.errorLog(Inbox.java:819)
[err]   at com.bluebox.smtp.Inbox.deliver(Inbox.java:709)
[err]   at org.subethamail.smtp.helper.SimpleMessageListenerAdapter$Handler.data(SimpleMessageListenerAdapter.java:158)
[err]   at org.subethamail.smtp.command.DataCommand.execute(DataCommand.java:64)
[err]   at org.subethamail.smtp.server.RequireTLSCommandWrapper.execute(RequireTLSCommandWrapper.java:30)
[err]   at org.subethamail.smtp.server.CommandHandler.handleCommand(CommandHandler.java:99)
[err]   at org.subethamail.smtp.server.Session.runCommandLoop(Session.java:244)
[err]   at org.subethamail.smtp.server.Session.run(Session.java:145)
[err]   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[err]   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[err]   at java.lang.Thread.run(Thread.java:823)

Following Docker file was used to build the images to run:

FROM open-liberty:kernel-slim

COPY --chown=1001:0  server.xml /config/

RUN features.sh

COPY --chown=1001:0  bluebox.war /config/apps/bluebox.war

ARG VERBOSE=false

RUN configure.sh

USER root
RUN mkdir -p /home/default && chown -R 1001:0 /home/default
USER 1001

COPY --chown=1001:0  bluebox/bluebox.properties /home/default/bluebox.properties

The above works fine with release 4.5.3.

JUnit timing failures

What steps will reproduce the problem?
1. Run all JUnit tests
2.
3.

What is the expected output? What do you see instead?
All tests should pass

Please use labels and text to provide additional information.
If you run the failures individually, they all pass.
It seems some threading and/or timing issues are preventing timely shutdown of 
the Storage or Inbox objects.
Will investigate Socket timeout values on the smtp server.


Original issue reported on code.google.com by [email protected] on 30 Jun 2014 at 3:21

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.