• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Samba shares not available to be served by Nginx

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all,

I have a webserver (nginx) running  on Centos7.
I need to mount shares of a samba server in a samba client, have have the content to be served by nginx.
It is installed on this server samba-client, samba-common  and cifs-utils.

On my research, I found out that the SELinux context for nginx is "system_u:object_r:httpd_sys_content_t:s0".
I have set this recursively to the nginx root folder, added an index.html file and successfully served the file.

I then mounted the samba shares /mount/test on my nginx server and, when I checked the SELinux context of the shares is  system_u:object_r:cifs_t:s0
Since the samba shares are read only, I can't use chcon -R -t httpd_sys_content_t /mount/test. I tried and got an error (action can't be performed).

As per this article, (https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/security-enhanced_linux/sect-security-enhanced_linux-mounting_file_systems-multiple_nfs_mounts), I should be able to declare the SELinux context that I need the local machine to work with at the mount point.
So I used mount -t cifs //sambaserverexample/sambasharesexample  /mount/test -o user=usertest context="system_u:object_r:httpd_sys_content_t:s0"
However it does not work. I get 'For more details see mount(8)'

I might be missing something here that is preventing me to achieve the above.
Any suggestions?

Thanks in advance.

Regards,
 
Merlin Jones
Greenhorn
Posts: 5
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all.

It was a very tiny detail.... a comma

-o, --options <list>    comma-separated list of mount options
So mount -t cifs //sambaserverexample/sambasharesexample  /mount/test -o user=usertest,context="system_u:object_r:httpd_sys_content_t:s0"
 
Saloon Keeper
Posts: 28717
211
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You might want to check the sebool variable settings using the getsebool utility. There are whole raft of specialized setting related to what webservers will be permitted to do and network shares are a big part of them.
 
reply
    Bookmark Topic Watch Topic
  • New Topic