Skip to content
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

DC create - Error 500 #4

Closed
Knot3n opened this issue Apr 17, 2019 · 4 comments
Closed

DC create - Error 500 #4

Knot3n opened this issue Apr 17, 2019 · 4 comments

Comments

@Knot3n
Copy link

Knot3n commented Apr 17, 2019

Hello,

since i reinstalled the webui, im getting a Error 500 without error logs when i try to create a DC in the webui.
I just restarted the Fastnetmon Server and restarted the API Web service etc.

62.xxxx - - [17/Apr/2019:09:53:07 +0200] "GET /dc/create HTTP/2.0" 200 11805 "https://fnm.xxxxx.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:66.0) Gecko/20100101 Firefox/66.0"
62.xxxxxx - - [17/Apr/2019:09:53:07 +0200] "GET /css/main.css HTTP/2.0" 200 1443 "https://fnm.xxxxxx.com/dc/create" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:66.0) Gecko/20100101 Firefox/66.0"
62.xxxxxx - - [17/Apr/2019:09:53:20 +0200] "POST /dc HTTP/2.0" 500 10323 "https://fnm.xxxx.com/dc/create" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:66.0) Gecko/20100101 Firefox/66.0"
62.xxxxxx - - [17/Apr/2019:09:53:20 +0200] "GET /svg/500.svg HTTP/2.0" 200 15305 "https://fnm.xxxx.com/dc" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:66.0) Gecko/20100101 Firefox/66.0"

web_api_host: 212.xxxxxxxx
web_api_login: ddos
web_api_password: xxxxxxxxxx
web_api_port: 10007

Could i help to debug this so we can re-use this webui?

Thanks

@leytonreed
Copy link
Contributor

@Knot3n - Could you have a look in $INSTALLDIR/storage/logs for the current log file, and see what is added when you retry the POST?

If this isn't being actively used, you could also enable debugging mode in your .env file to show errors instead of the "Error 500" page:

APP_ENV=local
APP_DEBUG=true

...however please note that this may display secrets in the error messages (like FNM API credentials).

@Knot3n
Copy link
Author

Knot3n commented Apr 17, 2019

Hello,

see below please.

[2019-04-17 09:21:00] local.ERROR: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'api_password' at row 1 (SQL: insert into dc (name, active, description, api_url, api_username, api_password, allowed_ip, updated_at, created_at) values (test22222, 1, , http://xxxxxx:10007/, ddos,

@leytonreed
Copy link
Contributor

leytonreed commented Apr 17, 2019

Thanks for that - the important part of the error is here:

SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'api_password' at row 1 (SQL: insert into dc (name, active, description, api_url, api_username, api_password, allowed_ip, updated_at, created_at) values (test22222, 1, , http://xxxxxx:10007/, ddos,

As per the following DB migration, the api_password field is treated as a default string:
https://github.com/ukfast/fnm-webui/blob/master/database/migrations/2018_11_29_101328_create_dcs_table.php#L25

The default length for strings is configured here:
https://github.com/ukfast/fnm-webui/blob/master/app/Providers/AppServiceProvider.php#L17

There are a couple of options here:

  1. Reduce the size of the password to below 191 characters.
  2. (if you don't have any data you need in the DB) Update the AppServiceProvider.php to use a larger size, then reinstall by dropping the tables and re-running the DB migration.
  3. (if you have data that you need in the DB) Update the DB schema by either creating a migration to update the length, or via an ALTER TABLE in MySQL.

https://stackoverflow.com/questions/36469496/laravel-5-migration-change-length-of-existed-column
https://stackoverflow.com/questions/1279568/how-can-i-modify-the-size-of-column-in-a-mysql-table

Assuming that you have restrictive firewall rules in place for the API port, then the first option should be relatively safe.

As a future MR, the validation on that field should probably check that the string entered is under the Schema::defaultStringLength size.

@Knot3n
Copy link
Author

Knot3n commented Apr 17, 2019

Hello,

thank you very much for your fast help & support.

increaseing the size to 255 characters helped here, the webui can connect to the api successful now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants