-
Notifications
You must be signed in to change notification settings - Fork 36
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
Add support to HyperSQL weak credentials tester #117
Open
GiuseppePorcu
wants to merge
2
commits into
google:main
Choose a base branch
from
mindedsecurity:hypersql
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# HyperSQL Weak Credentials Setup | ||
|
||
1. On hsqldb_unsecured folder there is a Dockerfile that creates an instance with default HyperSQL default credentials | ||
|
||
2. On hsqldb_secured folder there is a Dockerfile that creates an instance with a different password | ||
|
||
3. UNSECURED: Run the docker build: `cd hsqldb_unsecured && docker build . -t hsqldb_unsecured && docker run -d -p 8080:9001 --name hsqldb_unsecured hsqldb_unsecured && cd ..` | ||
|
||
4. Connect to it locally by using hsqldb.jar and sqltool.jar with command `java -cp hsqldb-2.7.2.jar:sqltool.jar org.hsqldb.cmdline.SqlTool --inlineRc=url=jdbc:hsqldb:hsql://localhost:8080/testdb,user=SA,password=` | ||
|
||
5. SECURED: Run the docker build: `cd hsqldb_secured && docker build . -t hsqldb_secured && docker run -d -p 8081:9001 --name hsqldb_secured hsqldb_secured && cd ..` | ||
|
||
6. Connect to it locally by using hsqldb.jar and sqltool.jar with command `java -cp hsqldb-2.7.2.jar:sqltool.jar org.hsqldb.cmdline.SqlTool --inlineRc=url=jdbc:hsqldb:hsql://localhost:8081/testdb,user=SA` and using password `securedpassword` | ||
|
||
7. CLEAN-UP: Run the command `docker stop hsqldb_unsecured && docker rm hsqldb_unsecured && docker stop hsqldb_secured && docker rm hsqldb_secured` |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
FROM openjdk:11-jre-slim | ||
|
||
# Install curl | ||
RUN apt-get update && apt-get install -y curl --no-install-recommends && rm -rf /var/lib/apt/lists/* | ||
|
||
# Set environment variables | ||
ENV HSQLDB_VERSION=2.7.2 | ||
ENV HSQLDB_HOME=/opt/hsqldb | ||
ENV PATH="${HSQLDB_HOME}:${PATH}" | ||
|
||
# Download and set up HSQLDB | ||
RUN mkdir -p ${HSQLDB_HOME} \ | ||
&& curl -L -o ${HSQLDB_HOME}/hsqldb.jar https://repo1.maven.org/maven2/org/hsqldb/hsqldb/${HSQLDB_VERSION}/hsqldb-${HSQLDB_VERSION}.jar \ | ||
&& curl -L -o ${HSQLDB_HOME}/sqltool.jar https://repo1.maven.org/maven2/org/hsqldb/sqltool/${HSQLDB_VERSION}/sqltool-${HSQLDB_VERSION}.jar | ||
|
||
# Expose HSQLDB port | ||
EXPOSE 9001 | ||
|
||
# Run HSQLDB server, apply the initialization script, and stop the server | ||
RUN java -cp ${HSQLDB_HOME}/hsqldb.jar org.hsqldb.server.Server \ | ||
--database.0 file:/opt/hsqldb/testdb --dbname.0 testdb & \ | ||
sleep 5 && \ | ||
java -cp "${HSQLDB_HOME}/hsqldb.jar:${HSQLDB_HOME}/sqltool.jar" org.hsqldb.cmdline.SqlTool \ | ||
--inlineRc=url=jdbc:hsqldb:hsql://localhost/testdb,user=SA,password= \ | ||
--sql "ALTER USER SA SET PASSWORD 'securedpassword';" | ||
|
||
# Command to run HSQLDB server | ||
CMD ["java", "-cp", "/opt/hsqldb/hsqldb.jar", "org.hsqldb.server.Server", "--database.0", "file:/opt/hsqldb/testdb", "--dbname.0", "testdb"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
FROM openjdk:11-jre-slim | ||
|
||
# Install curl | ||
RUN apt-get update && apt-get install -y curl --no-install-recommends && rm -rf /var/lib/apt/lists/* | ||
|
||
# Set environment variables | ||
ENV HSQLDB_VERSION=2.7.2 | ||
ENV HSQLDB_HOME=/opt/hsqldb | ||
ENV PATH="${HSQLDB_HOME}:${PATH}" | ||
|
||
# Download and set up HSQLDB | ||
RUN mkdir -p ${HSQLDB_HOME} \ | ||
&& curl -L -o ${HSQLDB_HOME}/hsqldb.jar https://repo1.maven.org/maven2/org/hsqldb/hsqldb/${HSQLDB_VERSION}/hsqldb-${HSQLDB_VERSION}.jar | ||
|
||
# Expose HSQLDB port | ||
EXPOSE 9001 | ||
|
||
# Command to run HSQLDB server | ||
CMD ["java", "-cp", "/opt/hsqldb/hsqldb.jar", "org.hsqldb.server.Server", "--database.0", "file:/opt/hsqldb/testdb", "--dbname.0", "testdb"] |
Binary file not shown.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @GiuseppePorcu, thanks for your contribution!
Testbed is fine, however step 6 can be improved by providing a command equivalent to the one in step 5, along with an alternative to verify whether a password has effectively been set.