SOS! Big bloody mistake here!!!

Discussion in 'ISPConfig 3 Priority Support' started by danhansen@denmark, Feb 24, 2014.

  1. danhansen@denmark

    danhansen@denmark Member HowtoForge Supporter

    Hi,


    I completely s...... up!

    In the middle of setting up a server, I accessed/SSH the wrong server!! Apparently it's only the last bit of the work I did on the wrong server.
    This is a little important because its the ISPconfig3 server which runs all sites, shops etc. So please help me.

    I checked the sites, they run.. But I'm dead scared anyway.. What have I done?
    Here's the commands that I did on the wrong server/ISPconfig3 server:

    Code:
    BIG BLOODY MISTAKE!!!
    
    
    # a2enmod dav_fs
    # a2enmod dav
    # mkdir -p /var/www/web1/web
    # chown www-data /var/www/web1/web
    # mv /etc/apache2/sites-available/default /etc/apache2/sites-available/default_orig
    # vi /etc/apache2/sites-available/default   
    # /etc/init.d/apache2 reload    
    # htpasswd -c /var/www/web1/passwd.dav xxx 
    # chown root:www-data /var/www/web1/passwd.dav
    # chmod 640 /var/www/web1/passwd.dav  
    # vi /etc/apache2/sites-available/default
    Added:
    NameVirtualHost *
    <VirtualHost *>
            ServerAdmin webmaster@localhost
    
            DocumentRoot /var/www/web1/web/
            <Directory /var/www/web1/web/>
                    Options Indexes MultiViews
                    AllowOverride None
                    Order allow,deny
                    allow from all
            </Directory>
    
            Alias /webdav /var/www/web1/web
    
            <Location /webdav>
               DAV On
               AuthType Basic
               AuthName "webdav"
               AuthUserFile /var/www/web1/passwd.dav
               Require valid-user
           </Location>
    </VirtualHost>
    # /etc/init.d/apache2 reload
    
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    If thats all, then your server should be still fine. just run:

    mv /etc/apache2/sites-available/default_orig /etc/apache2/sites-available/default
    /etc/init.d/apache2 reload

    to restore the original default vhost.
     
  3. danhansen@denmark

    danhansen@denmark Member HowtoForge Supporter

    Hi Till,

    Thanks my friend!!! ;) G.. D... it was a close one....
    That was very nice of you.. I was a little shock up there ;)

    *************************************************************************************
    Is it OK if I ask you here, it's another question, but not related to ISPconfig3!? I can always make a new thread ;)
    *************************************************************************************

    OK, Just finished the work, on the right server this time ;)

    I followed your todo, after reading 999 other ways to do the webdav setup:
    http://www.howtoforge.com/how-to-set-up-webdav-with-apache2-on-ubuntu-10.04
    I know this is for the 10.04 edition, but I couldn't see any difference. So I went ahead and tried it. It all went well and I tested it in cadaver. All OK! Tested Phpmyadmin on the webserver, runs perfectly. But a file I made in the default webdir ealier on /var/www info.php I couldn't see after mapping 192.168.1.xxx/webdav

    Is this because I changed the default dir? Or is it because via the virtualhost I created a new web dir?
    Here's my virtualhost:
    Code:
    NameVirtualHost *
    <VirtualHost *>
            ServerAdmin webmaster@localhost
    
            DocumentRoot /var/www/web1/web/
            <Directory /var/www/web1/web/>
                    Options Indexes MultiViews
                    AllowOverride None
                    Order allow,deny
                    allow from all
            </Directory>
    
            Alias /webdav /var/www/web1/web
    
            <Location /webdav>
               DAV On
               AuthType Basic
               AuthName "webdav"
               AuthUserFile /var/www/web1/passwd.dav
               Require valid-user
           </Location>
    </VirtualHost>
    
    Reload Apache afterwards:
    OK, if it's all good, and its like its suppose to be, then why can't I copy e.g. a file into the newly mapped directory? Mapping went fine, just can't copy stuff in there ;(
    Is it because I gave the wrong rights? chmod 640 /var/www/web1/passwd.dav

    I created a user for webdav, with the same username as my username in my windows rig:
    htpasswd -c /var/www/web1/passwd.dav "mywindowsusername"

    The password is another one!

    But I was able to map the location, using the username and the password, then shouldn't I be able to use the folder/the mapped directory?

    Is it permissions maybe?
    Maybe: chmod 664 -R /var/www/web1/web ????
    Maybe: the webdav directory? where do I set permissions ?????

    Shouldn't I be able to se the directory "web" ????
    [....]
    Alias /webdav /var/www/web1/web
    AuthUserFile /var/www/web1/passwd.dav
    [....]

    .
     
    Last edited: Feb 24, 2014
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    You mean that you want to access websites created in ispconfig weith webdav? This will not work as the user that webdav is running as (www-data) has no permissions to write into a website as each website runs under its own user and group for securty reasons. If access with webdav would be possible, then a hacker that hacked one website of your server would be able to hack all other websites as well. An ispconfig website can only be accessed by ftp or ssh as both can run under the user of the website.

    if you want to use webdav just to store some files on the server, then ispconfig has a function for that builtin, you just have to add a new webdav user in the sites module, which lets you store files in the webdav directory of the website (but not the web directory, as the same limitations that I described above apply to the ispconfig webdav users as well).
     
  5. danhansen@denmark

    danhansen@denmark Member HowtoForge Supporter

    Hi Till,

    Thank you for your reply ;)


    No, it's not an ISPconfig3 server this one. It's a develop server, where I installed Ubuntu Server/Apache2/MySQL/Php5/ + PhpMyAdmin and the webdav. Well, what I develop here, will be used on the ISPconfig server. I'm working on that project with subdomais and mail redirect's, you helped me with some examples of scripts for the ISPconfig3 server, last week. I need to learn, so I'm building this test/develop webserver.

    It's a webserver to test an learn php5 and SQL. And I want to edit/work directly on the files in 2-3 webdir/website from a desktop (windows7 rig).
    Followed these 2 ToDo's (Read all day long yesterday, and the best solution were yours!):
    http://www.howtoforge.com/installing-apache2-with-php5-and-mysql-support-on-ubuntu-12.04-lts-lamp
    http://www.howtoforge.com/how-to-set-up-webdav-with-apache2-on-ubuntu-10.04
    I know the Webdav ToDo is for a Ubuntu Server 10.04, but I compared the commands to commands from Ubuntu Help, and couldn't find any differences.

    Webdav works just fine, I checked using cadaver, and I was able to map the directory on my windows7 desktop. B
    The problem:
    1. I was not allowed to copy anything to the mapped directory
    2. Wasn't the directory "web" suppose to be there, when mapping /serverip/webdav ?? Here's the content of /etc/apache/sites-available/default
    Code:
    NameVirtualHost *
    <VirtualHost *>
            ServerAdmin webmaster@localhost
    
            DocumentRoot /var/www/web1/web/
            <Directory /var/www/web1/web/>
                    Options Indexes MultiViews
                    AllowOverride None
                    Order allow,deny
                    allow from all
            </Directory>
    
            Alias /webdav /var/www/web1/web
    
            <Location /webdav>
               DAV On
               AuthType Basic
               AuthName "webdav"
               AuthUserFile /var/www/web1/passwd.dav
               Require valid-user
           </Location>
    </VirtualHost>
    Shouldn't I be able to se the directory "web" ????
    [....]
    DocumentRoot /var/www/web1/web/
    ..
    Alias /webdav /var/www/web1/web
    ..
    AuthUserFile /var/www/web1/passwd.dav
    [....]

    Here's some ekstra info from the other post:
    OK, if it's all good, and its like its suppose to be, then why can't I copy e.g. a file into the newly mapped directory? Mapping went fine, just can't copy stuff in there ;(
    Is it because I gave the wrong rights? chmod 640 /var/www/web1/passwd.dav

    I used same username as on my windows7 rig:
    htpasswd -c /var/www/web1/passwd.dav "mywindowsusername"

    The password is another one than the one I use on the window desktop!

    Is it permissions maybe?
    Maybe: chmod 664 -R /var/www/web1/web ????

    Or, which directory do you set permissions? /webdav ? /var/www/web1/web ?

    Thanks for helping me Till ;)
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    Ok, so that something different. In this case, webdav is fine. ensure that the web die is woned by the apache user and group, on ubuntu, the username should be "www-data".
     
  7. danhansen@denmark

    danhansen@denmark Member HowtoForge Supporter

    Last edited: Feb 26, 2014

Share This Page