Skip to content

Commit 5d88399

Browse files
authored
Merge pull request #98 from IanLee1521/dockerfile
Dockerfile
2 parents 94af805 + 87397fb commit 5d88399

File tree

7 files changed

+73
-33
lines changed

7 files changed

+73
-33
lines changed

Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM python:3
2+
3+
WORKDIR /app
4+
5+
COPY requirements.txt requirements.txt
6+
7+
RUN pip install --no-cache-dir -r requirements.txt
8+
9+
COPY . .
10+
11+
RUN pip install --editable .
12+
13+
ENTRYPOINT ["trustymail"]
14+
CMD ["--help"]

README.md

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ Then run the CLI:
4242
python scripts/trustymail [options] example.com
4343
```
4444

45+
### Using Docker (optional)
46+
47+
```bash
48+
./run [opts]
49+
```
50+
51+
`opts` are the same arguments that would get passed to `trustymail`.
52+
4553
### Usage and examples ###
4654

4755
```bash
@@ -61,38 +69,38 @@ output will always be written to disk, defaulting to `results.csv`.
6169
-h --help Show this message.
6270
-o --output=OUTFILE Name of output file. (Default results)
6371
-t --timeout=TIMEOUT The DNS lookup timeout in seconds. (Default is 5.)
64-
--smtp-timeout=TIMEOUT The SMTP connection timeout in seconds. (Default
72+
--smtp-timeout=TIMEOUT The SMTP connection timeout in seconds. (Default
6573
is 5.)
66-
--smtp-localhost=HOSTNAME The hostname to use when connecting to SMTP
74+
--smtp-localhost=HOSTNAME The hostname to use when connecting to SMTP
6775
servers. (Default is the FQDN of the host from
6876
which trustymail is being run.)
69-
--smtp-ports=PORTS A comma-delimited list of ports at which to look
77+
--smtp-ports=PORTS A comma-delimited list of ports at which to look
7078
for SMTP servers. (Default is '25,465,587'.)
71-
--no-smtp-cache Do not cache SMTP results during the run. This
72-
may results in slower scans due to testing the
79+
--no-smtp-cache Do not cache SMTP results during the run. This
80+
may results in slower scans due to testing the
7381
same mail servers multiple times.
7482
--mx Only check mx records
75-
--starttls Only check mx records and STARTTLS support.
83+
--starttls Only check mx records and STARTTLS support.
7684
(Implies --mx.)
7785
--spf Only check spf records
7886
--dmarc Only check dmarc records
7987
--debug Output should include error messages.
80-
--dns=HOSTNAMES A comma-delimited list of DNS servers to query
81-
against. For example, if you want to use
82-
Google's DNS then you would use the
83-
value --dns-hostnames='8.8.8.8,8.8.4.4'. By
84-
default the DNS configuration of the host OS
85-
(/etc/resolv.conf) is used. Note that
86-
the host's DNS configuration is not used at all
88+
--dns=HOSTNAMES A comma-delimited list of DNS servers to query
89+
against. For example, if you want to use
90+
Google's DNS then you would use the
91+
value --dns-hostnames='8.8.8.8,8.8.4.4'. By
92+
default the DNS configuration of the host OS
93+
(/etc/resolv.conf) is used. Note that
94+
the host's DNS configuration is not used at all
8795
if this option is used.
8896
--psl-filename=FILENAME The name of the file where the public suffix list
8997
(PSL) cache will be saved. If set to the name of
9098
an existing file then that file will be used as
9199
the PSL. If not present then the PSL cache will
92100
be saved to a file in the current directory called
93101
public_suffix_list.dat.
94-
--psl-read-only If present, then the public suffix list (PSL)
95-
cache will be read but never overwritten. This
102+
--psl-read-only If present, then the public suffix list (PSL)
103+
cache will be read but never overwritten. This
96104
is useful when running in AWS Lambda, for
97105
instance, where the local filesystem is read-only.
98106
```
@@ -160,7 +168,7 @@ The following values are returned in `results.csv`:
160168
* `DMARC Aggregate Report URIs` - A list of the DMARC aggregate report
161169
URIs specified by the domain.
162170
* `DMARC Forensic Report URIs` - A list of the DMARC forensic report
163-
URIs specified by the domain.
171+
URIs specified by the domain.
164172
* `DMARC Has Aggregate Report URI` - A boolean value that indicates if
165173
`DMARC Results` included `rua` URIs that tell recipients where to
166174
send DMARC aggregate reports.

requirements-dev.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
-r requirements.txt
2+
3+
check-manifest>=0.36
4+
pytest>=3.5.0
5+
semver>=2.7.9
6+
tox>=3.0.0
7+
wheel>=0.31.0

requirements.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
-e .[dev]
1+
dnspython>=1.15.0
2+
docopt>=0.6.2
3+
publicsuffix>=1.1.0
4+
py3dns>=3.1.0
5+
pyspf==2.0.11
6+
requests>=2.18.4

run

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
set -e
4+
set -x
5+
6+
docker build -t trustymail/cli .
7+
8+
docker run --rm -it \
9+
--name trustymail \
10+
-v $(pwd):/app \
11+
trustymail/cli $@

setup.py

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ def readme():
1515
return f.read()
1616

1717

18+
with open('requirements.txt') as fp:
19+
reqs = [line.strip() for line in fp.readlines() if line]
20+
21+
with open('requirements-dev.txt') as fp:
22+
lines = [line.strip() for line in fp.readlines() if line]
23+
dev_reqs = [line for line in lines if line and '-r requirements.txt' not in line]
24+
25+
1826
setup(
1927
name='trustymail',
2028
version=__version__,
@@ -61,23 +69,10 @@ def readme():
6169

6270
packages=['trustymail'],
6371

64-
install_requires=[
65-
'dnspython>=1.15.0',
66-
'docopt>=0.6.2',
67-
'publicsuffix>=1.1.0',
68-
'py3dns>=3.1.0',
69-
'pyspf==2.0.11',
70-
'requests>=2.18.4'
71-
],
72+
install_requires=reqs,
7273

7374
extras_require={
74-
'dev': [
75-
'check-manifest>=0.36',
76-
'pytest>=3.5.0',
77-
'semver>=2.7.9',
78-
'tox>=3.0.0',
79-
'wheel>=0.31.0'
80-
],
75+
'dev': dev_reqs,
8176
},
8277

8378
scripts=['scripts/trustymail']

trustymail/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import unicode_literals, absolute_import, print_function
22

3-
__version__ = '0.6.4'
3+
__version__ = '0.6.5-dev'
44

55
PublicSuffixListFilename = 'public_suffix_list.dat'
66
PublicSuffixListReadOnly = False

0 commit comments

Comments
 (0)