Skip to content

Commit b9d107b

Browse files
committed
Set a more grep-able admin password
Also don't set this explicitly in `workflows/database-upgrade.yml` as it is already set in `jobs/baseinstall.sh` called before. Don't pass admin:password to the API check as it already uses curl with `-n` option to read from `~/.netrc`.
1 parent 77724a4 commit b9d107b

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

.github/jobs/baseinstall.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ composer install --no-scripts |tee "$ARTIFACTS"/composer_out.txt
1717
cd ..
1818
section_end
1919

20-
section_start "Set simple admin password"
21-
echo "password" > ./etc/initial_admin_password.secret
22-
echo "default login admin password password" > ~/.netrc
20+
section_start "Set admin password"
21+
echo "admin_password" > ./etc/initial_admin_password.secret
22+
echo "default login admin password admin_password" > ~/.netrc
2323
section_end
2424

2525
section_start "Install domserver"

.github/workflows/database-upgrade.yml

-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ jobs:
2828
run: mysql -hsqlserver -uroot -proot < .github/jobs/data/dj733.sql
2929
- name: Upgrade DOMjudge
3030
run: .github/jobs/baseinstall.sh default upgrade
31-
- name: Setting initial Admin Password
32-
run: echo "pass" > /opt/domjudge/domserver/etc/initial_admin_password.secret
3331
- name: Check for Errors in the Upgrade
3432
run: mysql -hsqlserver -uroot -proot -e "SHOW TABLES FROM domjudge;"
3533
- name: Check for Errors in Domjudge Web

.github/workflows/integration.yml

+5-4
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ jobs:
4545
- name: Configure print command
4646
working-directory: submit
4747
run: |
48-
curl --fail -u 'admin:password' -X 'GET' 'http://localhost/domjudge/api/v4/config?strict=false' \
48+
curl --fail -X GET -n 'http://localhost/domjudge/api/v4/config?strict=false' \
4949
| jq '.print_command |= "cp [file] /tmp/dj-printfile"' \
50-
| curl --fail -u 'admin:password' -X 'PUT' -T - 'http://localhost/domjudge/api/v4/config?strict=false' \
50+
| curl --fail -X PUT -n -T - 'http://localhost/domjudge/api/v4/config?strict=false' \
5151
- name: Testing submit client
5252
working-directory: submit
5353
run: make check-full
@@ -103,8 +103,9 @@ jobs:
103103
export CURLOPTS="--fail -sq -m 30 -b /tmp/cookiejar"
104104
# Make an initial request which will get us a session id, and grab the csrf token from it
105105
CSRFTOKEN=$(curl $CURLOPTS -c /tmp/cookiejar "http://localhost/domjudge/login" | sed -n 's/.*_csrf_token.*value="\(.*\)".*/\1/p')
106+
ADMINPASS=$(cat etc/initial_admin_password.secret)
106107
# Make a second request with our session + csrf token to actually log in
107-
curl $CURLOPTS -c /tmp/cookiejar -F "_csrf_token=$CSRFTOKEN" -F "_username=admin" -F "_password=password" "http://localhost/domjudge/login"
108+
curl $CURLOPTS -c /tmp/cookiejar -F "_csrf_token=$CSRFTOKEN" -F "_username=admin" -F "_password=$ADMINPASS" "http://localhost/domjudge/login"
108109
# Send a general clarification to later test if we see the event.
109110
curl $CURLOPTS -F "sendto=" -F "problem=1-" -F "bodytext=Testing" -F "submit=Send" \
110111
"http://localhost/domjudge/jury/clarifications/send" -o /dev/null
@@ -149,4 +150,4 @@ jobs:
149150
export CCS_SPECS_PINNED_SHA1='a68aff54c4e60fc2bff2fc5c36c119bffa4d30f1'
150151
( cd ccs-specs && git reset --hard $CCS_SPECS_PINNED_SHA1 )
151152
export CHECK_API="${HOME}/ccs-specs/check-api.sh -j ${HOME}/yajsv"
152-
$CHECK_API -n -C -e -a 'strict=1' http://admin:password@localhost/domjudge/api
153+
$CHECK_API -n -C -e -a 'strict=1' http://localhost/domjudge/api

0 commit comments

Comments
 (0)