Coder Social home page Coder Social logo

Unable to open secret.txt about muximux HOT 16 CLOSED

Sup3rlativ3 avatar Sup3rlativ3 commented on August 18, 2024
Unable to open secret.txt

from muximux.

Comments (16)

mescon avatar mescon commented on August 18, 2024

Sounds real weird.
Are you absolutely positive that nginx is the user and nginx is the group?

chown -R nginx.nginx /usr/share/nginx/html/Muximux should be all there is.

Also - make sure you allow fopen in php.ini (remember to restart php-fpm after you changed it).

from muximux.

evanmj avatar evanmj commented on August 18, 2024

What should the permissions be on secret.txt? I feel like it should not be served out as /secret.txt on the web server for anyone to ask for. Maybe I need to update my nginx config to deny serving .txt files?

from muximux.

mescon avatar mescon commented on August 18, 2024

Permission should be readable by group/or the user that nginx is running as.
Basically, try to open /secret.txt and if it works, then you're good.

It should be served out as /secret.txt and no, do not deny serving .txt files.

On each page load, secret.txt is generated by muximux.php. When you close the site or otherwise navigate away from it, the secret.txt contents are re-generated, and as such is not longer valid.
Besides, you should have already secured / with HTTP Basic Auth.

If you can not open /secret.txt, then the application will not load. The ID generated is grabbed for use in the JavaScript by an AJAX-function.

from muximux.

evanmj avatar evanmj commented on August 18, 2024

Thanks for the explanation. I do secure with Auth_Basic, and I thought secret.txt was static content, so if it is generated that is fine. Thanks!

from muximux.

Sup3rlativ3 avatar Sup3rlativ3 commented on August 18, 2024

So here are the permissions
http://i.imgur.com/Y1aZGRu.jpg

Here is my php www.conf
http://imgur.com/1yIeM5j

Here is nginx running
http://i.imgur.com/oPNSXwq.png

I am able to open secret.txt in a browser (the one I created myself).

If you give more details about fopen I can try to resolve it but as far as I can tell that should only need the ww user (nginx) to have write access to the www-root folder.

the only thing I haven't been able to figure out is that parse_ini_file is not mentioned in my php.ini. If the default is on then there shouldn't be an issue unless it relies on the default config to set that. If that's the case could you please provide an example as I've not found one.

Cheers

from muximux.

Sup3rlativ3 avatar Sup3rlativ3 commented on August 18, 2024

[dingo@dingo ~]$ sudo rm -rf /usr/share/nginx/html/muximux/
[dingo@dingo ~]$ ls /usr/share/nginx/html/
404.html 50x.html index.html info.php nginx-logo.png poweredby.png
[dingo@dingo ~]$ sudo git clone https://github.com/mescon/Muximux/ /usr/share/nginx/html/muximux
Cloning into '/usr/share/nginx/html/muximux'...
remote: Counting objects: 1059, done.
remote: Total 1059 (delta 0), reused 0 (delta 0), pack-reused 1059
Receiving objects: 100% (1059/1059), 4.51 MiB | 1.93 MiB/s, done.
Resolving deltas: 100% (589/589), done.
[dingo@dingo ~]$ sudo chown -R nginx:nginx /usr/share/nginx/html/
[dingo@dingo ~]$ ls -l /usr/share/nginx/html/
total 28
-rw-r--r--. 1 nginx nginx 3650 Jan 27 05:15 404.html
-rw-r--r--. 1 nginx nginx 3693 Jan 27 05:15 50x.html
-rw-r--r--. 1 nginx nginx 3700 Jan 27 05:15 index.html
-rw-r--r--. 1 nginx nginx 21 Feb 9 23:02 info.php
drwxr-xr-x. 10 nginx nginx 4096 Feb 11 21:05 muximux
-rw-r--r--. 1 nginx nginx 368 Jan 27 05:15 nginx-logo.png
-rw-r--r--. 1 nginx nginx 2811 Jan 27 05:15 poweredby.png
[dingo@dingo ~]$ ls -l /usr/share/nginx/html/muximux/
total 100
-rw-r--r--. 1 nginx nginx 444 Feb 11 21:05 browserconfig.xml
-rw-r--r--. 1 nginx nginx 151 Feb 11 21:05 composer.json
-rw-r--r--. 1 nginx nginx 467 Feb 11 21:05 CONTRIBUTORS.md
drwxr-xr-x. 3 nginx nginx 4096 Feb 11 21:05 css
-rw-r--r--. 1 nginx nginx 1150 Feb 11 21:05 favicon.ico
drwxr-xr-x. 2 nginx nginx 4096 Feb 11 21:05 fonts
drwxr-xr-x. 2 nginx nginx 4096 Feb 11 21:05 images
-rw-r--r--. 1 nginx nginx 7679 Feb 11 21:05 index.php
drwxr-xr-x. 2 nginx nginx 4096 Feb 11 21:05 js
drwxr-xr-x. 2 nginx nginx 4096 Feb 11 21:05 less
-rw-r--r--. 1 nginx nginx 18047 Feb 11 21:05 LICENSE
-rw-r--r--. 1 nginx nginx 15900 Feb 11 21:05 muximux.php
-rw-r--r--. 1 nginx nginx 7175 Feb 11 21:05 README.md
-rw-r--r--. 1 nginx nginx 189 Feb 11 21:05 robots.txt
drwxr-xr-x. 2 nginx nginx 4096 Feb 11 21:05 scss
-rw-r--r--. 1 nginx nginx 2448 Feb 11 21:05 settings.ini.php-example
drwxr-xr-x. 4 nginx nginx 64 Feb 11 21:05 vendor
[dingo@dingo ~]$ sudo chmod -R 755 /usr/share/nginx/html/
[dingo@dingo ~]$ ls -l /usr/share/nginx/html/muximux/
total 100
-rwxr-xr-x. 1 nginx nginx 444 Feb 11 21:05 browserconfig.xml
-rwxr-xr-x. 1 nginx nginx 151 Feb 11 21:05 composer.json
-rwxr-xr-x. 1 nginx nginx 467 Feb 11 21:05 CONTRIBUTORS.md
drwxr-xr-x. 3 nginx nginx 4096 Feb 11 21:05 css
-rwxr-xr-x. 1 nginx nginx 1150 Feb 11 21:05 favicon.ico
drwxr-xr-x. 2 nginx nginx 4096 Feb 11 21:05 fonts
drwxr-xr-x. 2 nginx nginx 4096 Feb 11 21:05 images
-rwxr-xr-x. 1 nginx nginx 7679 Feb 11 21:05 index.php
drwxr-xr-x. 2 nginx nginx 4096 Feb 11 21:05 js
drwxr-xr-x. 2 nginx nginx 4096 Feb 11 21:05 less
-rwxr-xr-x. 1 nginx nginx 18047 Feb 11 21:05 LICENSE
-rwxr-xr-x. 1 nginx nginx 15900 Feb 11 21:05 muximux.php
-rwxr-xr-x. 1 nginx nginx 7175 Feb 11 21:05 README.md
-rwxr-xr-x. 1 nginx nginx 189 Feb 11 21:05 robots.txt
drwxr-xr-x. 2 nginx nginx 4096 Feb 11 21:05 scss
-rwxr-xr-x. 1 nginx nginx 2448 Feb 11 21:05 settings.ini.php-example
drwxr-xr-x. 4 nginx nginx 64 Feb 11 21:05 vendor

The directory Muximux is installed in does not have write permissions. Please make sure your apache/nginx/IIS/lightHttpd user has write permissions to this folder

[dingo@dingo ~]$ sudo -u nginx nano /usr/share/nginx/html/muximux/test.txt
[dingo@dingo ~]$ ls -l /usr/share/nginx/html/muximux/
total 104
-rwxr-xr-x. 1 nginx nginx 444 Feb 11 21:05 browserconfig.xml
-rwxr-xr-x. 1 nginx nginx 151 Feb 11 21:05 composer.json
-rwxr-xr-x. 1 nginx nginx 467 Feb 11 21:05 CONTRIBUTORS.md
drwxr-xr-x. 3 nginx nginx 4096 Feb 11 21:05 css
-rwxr-xr-x. 1 nginx nginx 1150 Feb 11 21:05 favicon.ico
drwxr-xr-x. 2 nginx nginx 4096 Feb 11 21:05 fonts
drwxr-xr-x. 2 nginx nginx 4096 Feb 11 21:05 images
-rwxr-xr-x. 1 nginx nginx 7679 Feb 11 21:05 index.php
drwxr-xr-x. 2 nginx nginx 4096 Feb 11 21:05 js
drwxr-xr-x. 2 nginx nginx 4096 Feb 11 21:05 less
-rwxr-xr-x. 1 nginx nginx 18047 Feb 11 21:05 LICENSE
-rwxr-xr-x. 1 nginx nginx 15900 Feb 11 21:05 muximux.php
-rwxr-xr-x. 1 nginx nginx 7175 Feb 11 21:05 README.md
-rwxr-xr-x. 1 nginx nginx 189 Feb 11 21:05 robots.txt
drwxr-xr-x. 2 nginx nginx 4096 Feb 11 21:05 scss
-rwxr-xr-x. 1 nginx nginx 2448 Feb 11 21:05 settings.ini.php-example
-rw-r--r--. 1 nginx nginx 16 Feb 11 22:05 test.txt
drwxr-xr-x. 4 nginx nginx 64 Feb 11 21:05 vendor

from muximux.

Sup3rlativ3 avatar Sup3rlativ3 commented on August 18, 2024

How can I help get this solved?

from muximux.

mescon avatar mescon commented on August 18, 2024

Would it be possible for me to see what you see via TeamViewer or any other means? This seems really weird.

from muximux.

Sup3rlativ3 avatar Sup3rlativ3 commented on August 18, 2024

sure. email me at [email protected]. Do you have a gpg or some other form of verification?

Edit: It's 1am here now so I may or may not be able to do this tonight. If not we can organise a time.

from muximux.

Sup3rlativ3 avatar Sup3rlativ3 commented on August 18, 2024

Help?

from muximux.

mescon avatar mescon commented on August 18, 2024

Sorry - work got in the way. Perhaps we could set a time for the weekend? I'm on Central European Time (CET).

from muximux.

Sup3rlativ3 avatar Sup3rlativ3 commented on August 18, 2024

I've not received an email time. I'll work around you. Thanks.

from muximux.

mescon avatar mescon commented on August 18, 2024

@Sup3rlativ3 Hey, are you able to get online on Gitter so that we can sort this out?

https://gitter.im/mescon/Muximux

from muximux.

rmensing avatar rmensing commented on August 18, 2024

Possibly Solved.
Same problem on two issue reports and neither solved before closed.
The following solved the problem for me.

[Ubuntu 16.04, PHP7.0]
Make sure the parent directory you are serving out of has the correct permissions.
nginx owner www-data:www-data
php owner www-data:www-data
My root directory for muximux is /var/www/html/
All files in that directory and below are owned by www-data.

To fix the issue I had to also set the PARENT directory to the same owner:group:
sudo chown www-data:www-data /var/www/html

from muximux.

ehvanr avatar ehvanr commented on August 18, 2024

Came across this issue myself. Noticed OP was running it on the same system (CentOS 7). It was SELinux. You need to change the context of secret.txt to "httpd_sys_rw_content_t" as opposed to the default "httpd_sys_content_t"

Set the context:
semanage fcontext -a -t httpd_sys_rw_content_t /var/www/html/secret.txt

Then restore the existing context to the new context:
restorecon -v /var/www/html/secret.txt

from muximux.

mescon avatar mescon commented on August 18, 2024

Wow, great to know @evreichard, thanks for your help!

from muximux.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.