태그 보관물: webdav

webdav

Linux에서 사용할 수있는 다중 사용자 webdav 서버가 있습니까? 사용자가 아닌 Apache가 소유합니다.

SMBA 서비스를 완전히 해제하고 WebDav 서비스로 바꾸려고합니다.

지금까지 모든 Google 검색에서 Apache / Webdav를 사용하고 있다고 지적했습니다. 이것은 내가 필요한 것에 가깝지만 내가 아는 한 Apache가 사용자의 파일에 액세스 할 수 있어야하며 더 나쁘다. 파일을 작성하면 새 파일은 사용자가 아닌 Apache가 소유합니다. 일부 사용자에게는 직접 SSH 액세스 권한이 있으므로 올바른 Unix 소유권 및 권한을 가진 파일이 있어야합니다.

그래서 나는 단순히 다중 사용자 (아파트 / Webdav 가 파일을 제공하기 전에 유닉스 사용자를 로그인 한 사용자로 변경 하는)와 함께 “올바로”작동 하도록 하거나 아파치 /에 대한 완전한 대안을 찾는 방법을 찾고 있습니다. Webdav.

지금까지 검색 결과가 전혀 나타나지 않았습니다.



답변

사용자 이름 및 / 또는 UID가있는 경우 nginx + lua + luarocks ljsyscall을 사용 하여이 작업을 수행 할 수 있습니다

다음과 같이 구성된 데비안 시스템에서 :

apt-get -y install nginx libnginx-mod-http-dav-ext libnginx-mod-http-lua luarocks
luarocks install ljsyscall

그리고 nginx는 다음과 같이 구성했습니다.

user  root;
worker_processes  1;

load_module modules/ngx_http_dav_ext_module.so;
load_module modules/ndk_http_module.so;
load_module modules/ngx_http_lua_module.so;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    sendfile        on;
    keepalive_timeout  65;
    gzip  on;

    server {
        listen      80;
        listen [::]:80;

        location / {
            rewrite ^ http://$host$request_uri?; # permanent;
        }
    }

    server {
        listen      443           ssl http2;
        listen [::]:443           ssl http2;

        ssl                       on;
        # [ SSL Sections Omitted ]

        # Set the maximum size of uploads
        client_max_body_size 200m;

        # Default is 60, May need to be increased for very large uploads
        client_body_timeout 120s;

        # other configs
        location /webdav/ {
            autoindex              on;
            alias                  /data/www/;
            client_body_temp_path  /data/client_temp;

            dav_methods PUT DELETE MKCOL COPY MOVE;
            dav_ext_methods PROPFIND OPTIONS;

            create_full_put_path   on;
            # Not sure if you want to tweak this
            # dav_access             group:rw  all:r;

            # Let's assume you have an auth subrequest that can set X-UID
            auth_request  /auth
            auth_request_set $auth_status $upstream_status;
            auth_request_set $saved_remote_user $upstream_http_REMOTE_USER;
            auth_request_set $saved_remote_uid $upstream_http_X_UID;

            # Per-Request Impersonation
            access_by_lua_block {
                # Boilerplate because ljsyscall doesn't have setfsuid implemented directly
                local syscall_api = require 'syscall'
                local ffi = require "ffi"
                local nr = require("syscall.linux.nr")
                local sys = nr.SYS
                local uint = ffi.typeof("unsigned int")
                local syscall_long = ffi.C.syscall -- returns long
                local function syscall(...) return tonumber(syscall_long(...)) end
                local function setfsuid(id) return syscall(sys.setfsuid, uint(id)) end
                -- If you only have ngx.var.saved_remote_user, install luaposix and do this ...
                -- local pwd = require 'posix.pwd'
                -- local new_uid = pwd.getpwnam(ngx.saved_remote_user).pw_uid
                local new_uid = tonumber(ngx.var.saved_remote_uid)
                ngx.log(ngx.NOTICE, "[Impersonating User #" .. new_uid .. "]")
                local previous = setfsuid(new_uid)
                local actual = setfsuid(new_uid)
                if actual ~= new_uid then
                    ngx.log(ngx.CRIT, "Unable to impersonate users")
                    ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR)
                end
            }
        }

        location = /auth {
            internal;
            proxy_pass              http://localhost:8080/auth;
            proxy_pass_request_body off;
            proxy_set_header        Content-Length "";
            proxy_set_header        X-Original-URI $request_uri;
            proxy_set_header        X-Original-Method $request_method;
        }
    }
}

이것은 nginx 워커가 서비스하는 모든 요청에 ​​대해 setfsuid를 실행합니다. 불행히도, 이것이 제대로 작동하려면 nginx를 루트로 실행해야합니다. 프로세스가 루트로 시작되고 CAP_SETUID가 보존 된 다른 사용자에게 드롭되고 (문서 참조 capsh) usernginx 구성 파일에 지시문이 없으면 다른 사용자와 함께 작업 할 수 있다고 생각 합니다.

잠재적으로 그룹 ID를 설정해야 할 수도 있습니다.

http://man7.org/linux/man-pages/man7/capabilities.7.html의 “기능에 대한 사용자 ID 변경의 영향”을 참조하십시오 .


답변

읽어야 할 가치가 있습니다. 다른 입력 : 여러 사용자 폴더 및 하나의 공유 폴더
http://hexeract.wordpress.com/2011/02/25/configure-a-webdav-enabled-webserver-for-multiple-user-folders 및 하나의 공유 폴더 /


답변

나는 이것을 webdav를 설정하기위한 가이드로 사용했다 :
http://bernaerts.dyndns.org/linux/75-debian/62-debian-webdav-share

예, Apache는 그룹 (Debian의 www-data)이지만 해당 그룹에 사용자를 추가 할 수 있으므로 한 명의 사용자를 추가했습니다. 왜 다른 사용자를 추가 할 수 없는지 테스트하지 않았습니다 ….이 설정을 사용하는 webdav 서버는 원칙적으로 내 아들과 아들이있는 장소에서 3 년 동안 실행됩니다 (따라서 아들의 작업을 위해 2 개의 동일한 서버). 데비안 6은 몇 달 전부터 LTS 버전 (2016 년 2 월까지)입니다.

내가 아파치 파일 인 / etc / apache2 / sites-available / default에서이 구성 부분을 수정 한 Bernaert와 비교했다.

Alias /webdav1 /data/webdav1

<Location /webdav1>
DAV on
Authtype Basic
Authname "webdav1"
AuthUserFile /var/www/web1/passwd1.dav
Require valid-user
</location>

따라서 내 파일은 더 이상 www가 아닌 ​​/ data / webdav1에 있습니다 (별명을 유지하기 위해 별칭 webdav1을 통해) 각 하드 디스크에 대해 이러한 섹션을 만들었고 webdav1은 해당 섹션의 두 번째 하드 디스크에 대해 webdav2가됩니다. 이 서버에 최대 10 개의 하드 디스크를 만들 수 있으므로 해당 구성 파일에이 섹션 중 10 개가 있습니다. www-data, davfs2 및 davfs에 사용자를 추가하여 사용자가 webdav 폴더에 액세스 할 수 있도록했습니다. 따라서 사용자는 로그인해야하며 사용자 이름과 비밀번호를 묻습니다. fstab에는 모든 webdav 데이터 디스크가 나열되어 마운트가 자동으로 진행됩니다. fstab의 해당 부분 :

/ dev / sda3 / data / webdav1 ext3, 사용자, 자동 0 0


답변

OwnCloud 를 사용해 보셨습니까 ? 여전히 직접 테스트하지만 요구 사항을 충족시키는 것처럼 들립니다 .webdav는 기본적으로 작동합니다.


답변

오랫동안 검색 한 결과 찾지 못했습니다. 여러 사용자 서버가 있지만 시스템 사용자로 실행 된 서버를 찾을 수 없습니다.

그래서 나는 스스로를 썼습니다. 이것은 내가 직접 테스트 할 수있는 한 테스트됩니다. 그러나 그 가치에 대한 소스 코드는 다음과 같습니다.

https://github.com/couling/WebDAV-Daemon


답변

Hy,

나는 똑같은 것을 찾고 있었고 마침내 apache2를 사용하여 솔루션을 수집했습니다. npm webdav-server를 사용하여 노드 솔루션을 시도했지만 아파치 모듈을 사용하여 모두 잘 작동하지는 않았다는 것을 알았습니다. 그런 다음 jsDAV 기반의 npm dav-server를 사용하여 더 잘하고 해결책이 될 수 있었지만 3g 연결을 처리해야하기 때문에 아파치를 선호하고 여러 인스턴스 스크립트에 대해 알았습니다.

그래서 나는 내 경험을 공유합니다.

http://helpcenter.epages.com/Doc/doc/apache2/README.multiple-instances

나는 webdav 사용자별로 인스턴스를 실행합니다 … 확장 성이 좋지는 않지만 소규모 팀에서 일하면 충분합니다.

myUser를 사용자로 바꾸십시오.

우분투 14.04에서

sh /usr/share/doc/apache2/examples/setup-instance myUser

그래서 / etc / apache2-myUser / envars에 정의 된 사용자 myUser로 아파치 프로세스를 실행합니다.

export APACHE_RUN_USER=myUser
export APACHE_RUN_GROUP=myUser

ports.conf 편집

# If you proxy with nginx as I did better to limit to local interface
listen localhost:8080
# listen 8080

우분투 14.04에서 PAM 인증을 얻을 수 없으므로 기본 인증으로 속임수를 쓴 다음 nginx를 사용하여 https로 래핑해야합니다.

htpasswd -c /etc/apache2/htpasswd myUser

그런 다음 /etc/apache2-myUser/sites-available/000-default.conf

<VirtualHost *:8080>

DocumentRoot /var/www/html

Alias /${APACHE_RUN_USER} /home/${APACHE_RUN_USER}
<Directory /home/${APACHE_RUN_USER}>
    Require all granted
    Options +Indexes
</Directory>

<Location /${APACHE_RUN_USER}>
      DAV On
      AuthType Basic
      AuthName "Restricted Area"
      AuthUserFile /etc/apache2/htpasswd
      Require valid-user
</Location>

DavLockDB /home/${APACHE_RUN_USER}/.DavLock
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

그런 다음 nginx 프록시에는 헤더 대상 전달 아이콘 폴더가있는 트릭이 있습니다.

server {
listen 443 ssl http2;
server_name exemple.com;

location ~ ^/(myUser|icons)/ {

    proxy_pass http://dav-myUser;

#         auth_basic "Restricted Content";
#         auth_basic_user_file /etc/nginx/htpasswd;

#         proxy_set_header Authorization $http_authorization;

    proxy_pass_header  Authorization;
    proxy_pass_request_headers on;

    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-Host $http_host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-Proto $scheme;

    port_in_redirect off;

    # to avoid 502 Bad Gateway:
    # http://vanderwijk.info/Members/ivo/articles/ComplexSVNSetupFix
    set $destination $http_destination;

    if ($destination ~* ^https(.+)$) {
        set $destination http$1;
    }

    proxy_set_header Destination $destination;

    proxy_read_timeout     300;
    proxy_connect_timeout  5;

    # Default is HTTP/1, keepalive is only enabled in HTTP/1.1
    proxy_http_version 1.1;

    # Remove the Connection header if the client sends it,
    # it could be "close" to close a keepalive connection
    proxy_set_header Connection "";
}

ssl on;
ssl_certificate /etc/letsencrypt/live/exemple.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/exemple.com/privkey.pem;

include /etc/letsencrypt/options-ssl-nginx.conf;

}

nginx를 프록시로 사용해야 할 의무는 없으며, 아파치가 https를 잘 수행 할 수는 있지만 프록시 대상 문제에 부딪 혔을 때 언급 할 가치가 있다고 생각했습니다.


답변

비슷한 솔루션을 찾고 있습니다.

해결 방법 1 : 데스크탑 환경 (Gnome, KDE)에는 WebDAV로 특정 폴더를 표시하는 위젯이있을 수 있습니다. 데스크탑 환경이 실행되고 데몬 솔루션이 아닌 한 실행됩니다.

해결 방법 2 : 1024 이상의 권한이없는 포트에서 사용자 바인딩으로 Apache를 실행하는 것을 막을 수있는 것은 없습니다. 구성 파일을 작성하거나 배포에 번들 된 파일을 $ HOME / etc / httpd (예 :)에 복사하고 DAV- 관련 구성을 만들고 루트가 아닌 사용자로 실행하십시오.

$ httpd -f $ HOME / etc / httpd

사용자로 실행하면 Apache가 파일을 생성합니다.