snipe / snipe-it

A free open source IT asset/license management system
https://snipeitapp.com
GNU Affero General Public License v3.0
10.86k stars 3.14k forks source link

Pre-Flight: Uh oh! Snipe-IT thinks your URL is https:// #10779

Closed masmith79 closed 2 years ago

masmith79 commented 2 years ago

Debug mode

Describe the bug

Prelim Issue:

php artisan config:cache   
Could not open input file: artisan

First Issue:

Uh oh! Snipe-IT thinks your URL is https://snipe-it.customdomain.com, but your real URL is http://snipe-it.customdomain.com/setup Please update your APP_URL settings in your .env file

Second Issue:

We cannot determine if your config file is exposed to the outside world, so you will have to manually verify this. You don't ever want anyone able to see that file. Ever. Ever ever. An exposed .env file can disclose sensitive data about your system and database.

Setup: Public Request (http / https) -> Public facing HAProxy Reverse Proxy (holds letsencrypt certs for multiple services: Snipe-It, Nextcloud, plex, etc.) -> Passes via 80 -> Snipe-It via Apache 2 listens on 80

Apache2 setup:

<VirtualHost *:80>
     DocumentRoot /var/www/snipe-it/public
     ServerName snipe-it.customdomain.com
     ServerAlias snipe-it.customdomain.com

     <Directory /var/www/snipe-it/public/>
        Options +FollowSymlinks
        AllowOverride All
        Require all granted
     </Directory>

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

Reproduction steps

  1. Install self-hosted Snipe-It instance as per official documentation
  2. Navigate to https://snipe-it.customdomain.com
  3. Pre-Flight shows above-referenced issues ...

Expected behavior

I expect Pre-flight to pass without issue

Screenshots

No response

Snipe-IT Version

5.4.1

Operating System

Ubuntu 20.04

Web Server

Apache2

PHP Version

7.4.3

Operating System

No response

Browser

No response

Version

No response

Device

No response

Operating System

No response

Browser

No response

Version

No response

Error messages

No response

Additional context

No response

welcome[bot] commented 2 years ago

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

uberbrady commented 2 years ago

For the zeroth issue: you should never have to run config:cache - but if you do, you’ll need to run it from your Snipe-IT installation directory, which should have the artisan file right there. If you’re trying to run it from public it won’t work.

For the first issue, I would set your APP_URL to what it wants, make your way through the wizard, and then set it back to the correct URL with the https://. The pre-flight isn’t actually smart enough to realize that you’re running through a proxy which is doing TLS termination.

For the second one, I would take a look and try to see if your .env file is exposed somehow, or has world-writable permissions. If not then you can probably ignore that warning.

masmith79 commented 2 years ago

For the zeroth issue: you should never have to run config:cache - but if you do, you’ll need to run it from your Snipe-IT installation directory, which should have the artisan file right there. If you’re trying to run it from public it won’t work.

For the first issue, I would set your APP_URL to what it wants, make your way through the wizard, and then set it back to the correct URL with the https://. The pre-flight isn’t actually smart enough to realize that you’re running through a proxy which is doing TLS termination.

For the second one, I would take a look and try to see if your .env file is exposed somehow, or has world-writable permissions. If not then you can probably ignore that warning.

All of that was the solution (for everything) thank you!

snipe commented 2 years ago

Glad to hear you're all sorted! In the future, if you've resolved your issue, please try to remember to close your ticket - it helps us out a lot. (We have to manage a lot of tickets.)

tenant-tyvm