]> www.infradead.org Git - users/dwmw2/openconnect.git/commitdiff
Fix juniper-auth test
authorDaniel Lenski <dlenski@gmail.com>
Sun, 23 Jul 2023 17:18:09 +0000 (13:18 -0400)
committerDaniel Lenski <dlenski@gmail.com>
Sun, 23 Jul 2023 17:24:57 +0000 (13:24 -0400)
In 57160c9f2673adbbe468db137b28da4187549061, I updated
fake-juniper-server.py to use a "persistent" configuration (as already done
for fake GlobalProtect, Fortinet, F5 servers), but thne I somehow forgot to
update the actual juniper-auth test script accordingly.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
tests/juniper-auth

index 9c0e2e9d4ad16e926432115d7a9fea8f0ed15818..f55cfb45de4f7cd556590b4cf949930047e024e1 100755 (executable)
@@ -46,43 +46,64 @@ echo -n "frmLogin with username/password"
 
 echo ok
 
+echo "Configuring fake server to present a choice of 3 realms."
+curl -sk $SERVURL/CONFIGURE -d realms=xyz,abc,def
+
 echo -n "frmLogin with username/password/authgroup"
-( echo "test" | $CLIENT $SERVURL/?realms=xyz,abc,def --authgroup=abc --cookieonly >/dev/null 2>&1) ||
+( echo "test" | $CLIENT $SERVURL --authgroup=abc --cookieonly >/dev/null 2>&1) ||
     fail $PID "Could not receive cookie from fake Juniper server"
 
 echo ok
 
+echo "Configuring fake server to require token as 2nd password in default frmLogin form."
+curl -sk $SERVURL/CONFIGURE -d token_form=frmLogin
+
 echo -n "frmLogin with username/password/token-as-2nd-password"
-( echo "test" | $CLIENT $SERVURL/?token_form=frmLogin $FAKE_TOKEN --cookieonly >/dev/null 2>&1) ||
+( echo "test" | $CLIENT $SERVURL $FAKE_TOKEN --cookieonly >/dev/null 2>&1) ||
     fail $PID "Could not receive cookie from fake Juniper server"
 
 echo ok
 
+echo "Configuring fake server to require token in separate frmTotpToken form."
+curl -sk $SERVURL/CONFIGURE -d token_form=frmTotpToken
+
 echo -n "frmLogin with username/password → frmTotpToken"
-( echo "test" | $CLIENT $SERVURL/?token_form=frmTotpToken $FAKE_TOKEN --cookieonly >/dev/null 2>&1) ||
+( echo "test" | $CLIENT $SERVURL $FAKE_TOKEN --cookieonly >/dev/null 2>&1) ||
     fail $PID "Could not receive cookie from fake Juniper server"
 
 echo ok
 
+echo "Configuring fake server to require token in separate frmDefender, and confirmation form."
+curl -sk $SERVURL/CONFIGURE -d 'token_form=frmDefender&confirm=1'
+
 echo -n "frmLogin with username/password → frmDefender → frmConfirmation"
-( echo "test" | $CLIENT "$SERVURL/?token_form=frmDefender&confirm=1" $FAKE_TOKEN --cookieonly >/dev/null 2>&1) ||
+( echo "test" | $CLIENT $SERVURL $FAKE_TOKEN --cookieonly >/dev/null 2>&1) ||
     fail $PID "Could not receive cookie from fake Juniper server"
 
 echo ok
 
+echo "Configuring fake server to require token in separate frmNextToken."
+curl -sk $SERVURL/CONFIGURE -d token_form=frmNextToken
+
 echo -n "frmLogin with username/password → frmNextToken"
-( echo "test" | $CLIENT $SERVURL/?token_form=frmNextToken $FAKE_TOKEN --cookieonly >/dev/null 2>&1) ||
+( echo "test" | $CLIENT $SERVURL $FAKE_TOKEN --cookieonly >/dev/null 2>&1) ||
     fail $PID "Could not receive cookie from fake Juniper server"
 
 ok
 
+echo "Configuring fake server to present confirmation form, and a choice of 3 roles."
+curl -sk $SERVURL/CONFIGURE -d 'confirm=1&roles=foo,bar,baz'
+
 # --authgroup will now fill in EITHER the role and/or the realm
 echo -n "frmLogin with username/password → frmConfirmation → frmSelectRoles"
-( echo "test" | $CLIENT "$SERVURL/?confirm=1&roles=foo,bar,baz" --authgroup=bar --cookieonly >/dev/null 2>&1) ||
+( echo "test" | $CLIENT $SERVURL --authgroup=bar --cookieonly >/dev/null 2>&1) ||
     fail $PID "Could not receive cookie from fake Juniper server"
 
 echo ok
 
+echo "Resetting fake server to default configuration."
+curl -sk $SERVURL/CONFIGURE -d ''
+
 echo -n "frmLogin with username/password, then proceeding to tunnel stage... "
 echo "test" | $CLIENT $SERVURL >/dev/null 2>&1
 test $? = 2 || # what OpenConnect returns when server rejects cookie upon tunnel connection, as the fake server does