Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
sgxwallet
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
董子豪
sgxwallet
Commits
6f4b347b
Unverified
Commit
6f4b347b
authored
2 years ago
by
Stan Kladko
Committed by
GitHub
2 years ago
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #395 from skalenetwork/430_firewall_self_analysis
430 firewall self analysis
parents
89b700ef
7015258b
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
48 additions
and
1 deletion
+48
-1
Dockerfile
Dockerfile
+1
-0
DockerfileRelease
DockerfileRelease
+1
-0
DockerfileSimulation
DockerfileSimulation
+1
-0
check_firewall.py
docker/check_firewall.py
+44
-0
start.sh
docker/start.sh
+1
-1
No files found.
Dockerfile
View file @
6f4b347b
...
...
@@ -10,6 +10,7 @@ RUN bash -c "make -j$(nproc)"
RUN
ccache
-sz
RUN
mkdir
-p
/usr/src/sdk/sgx_data
COPY
docker/start.sh ./
COPY
docker/check_firewall.py ./
RUN
rm
-rf
/usr/src/sdk/sgx-sdk-build/
RUN
rm
/opt/intel/sgxsdk/lib64/
*
_sim.so
ENTRYPOINT
["/usr/src/sdk/start.sh"]
This diff is collapsed.
Click to expand it.
DockerfileRelease
View file @
6f4b347b
...
...
@@ -12,6 +12,7 @@ RUN ccache -sz
RUN cd scripts && ./sign_enclave.bash
RUN mkdir -p /usr/src/sdk/sgx_data
COPY docker/start.sh ./
COPY docker/check_firewall.py ./
RUN rm -rf /usr/src/sdk/sgx-sdk-build/
RUN rm /opt/intel/sgxsdk/lib64/*_sim.so
RUN rm /usr/src/sdk/secure_enclave/secure_enclave*.so
...
...
This diff is collapsed.
Click to expand it.
DockerfileSimulation
View file @
6f4b347b
...
...
@@ -15,6 +15,7 @@ RUN ./autoconf.bash && \
mkdir -p /usr/src/sdk/sgx_data
COPY docker/start.sh ./
COPY docker/check_firewall.py ./
RUN rm -rf /usr/src/sdk/sgx-sdk-build/
ENTRYPOINT ["/usr/src/sdk/start.sh"]
This diff is collapsed.
Click to expand it.
docker/check_firewall.py
0 → 100644
View file @
6f4b347b
#! /usr/bin/python
import
requests
import
re
import
torpy
from
torpy
import
TorClient
def
get_my_external_ip
():
try
:
res
=
requests
.
get
(
"http://checkip.dyndns.org/"
)
myIp
=
re
.
compile
(
'(
\
d{1,3}
\
.){3}
\
d{1,3}'
)
.
search
(
res
.
text
)
.
group
()
return
myIp
except
:
return
""
print
(
"Analyzing firewall security."
)
print
(
"Determining external IP address"
)
ip
=
get_my_external_ip
()
if
(
ip
==
""
):
print
(
"sgxwallet does not have an external IP"
)
print
(
"No firewall problems detected."
)
exit
(
0
)
print
(
"sgxwallet has the following external IP: "
+
ip
)
try
:
with
TorClient
()
as
tor
:
# Choose random guard node and create 3-hops circuit
print
(
"Connecting to TOR network ..."
);
with
tor
.
create_circuit
(
1
)
as
circuit
:
print
(
"Connected to TOR network. Connecting to sgxwallet from a random external IP."
" This may take up to a minute."
)
# Create tor stream to host
with
circuit
.
create_stream
((
ip
,
1027
))
as
stream
:
print
(
"SECURITY PROBLEM: Could connect to port 1027 of sgxwallet "
+
ip
+
" from a random external IP"
)
print
(
"Firewall is not working properly. Fix the firewall and then start sgx wallet"
)
exit
(
1
)
except
:
print
(
"Analysis complete. No firewall problems detected."
)
exit
(
0
)
This diff is collapsed.
Click to expand it.
docker/start.sh
View file @
6f4b347b
...
...
@@ -46,7 +46,7 @@ echo "Test run requested"
sleep
5
./testw.py
else
sleep
3
/usr/src/sdk/check_firewall.py
./sgxwallet
$1
$2
$3
$4
$5
$6
fi
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment