Results 1 to 19 of 19
  1. #1
    Join Date
    Apr 2004
    Posts
    111

    Angry a way to manualy temporaily disable domain on apache?

    I'm looking for a way to manualy temporaily disable domain on apache <<< like someone have gone above bandwidth limit so I disable his domains. I'm using linux apache.

    I'm will desing own custom bandwidth limiting - suspension system for apache.... so I need to know how to disable any domain in the easiest way if my script finds out that that domains in over limit


    ps. I dont want to hear about any comercial scripts.

  2. #2
    Join Date
    Apr 2003
    Location
    NC
    Posts
    3,080
    Comment out the virtualhost entry for the given domain and restart apache. Or even better just have the DocumentRoot changed to a website of yours that says they have exceeded their bw for the month.
    John W, CISSP, C|EH
    MS Information Security and Assurance
    ITEagleEye.com - Server Administration and Security
    Yawig.com - Managed VPS and Dedicated Servers with VIP Service

  3. #3
    Join Date
    Apr 2004
    Posts
    111
    yeah yeah. but it would be too hard to automate that kind of changes in httpd.conf

    cpanel for example places some file in /var/cpanel/bwlimited and domain is suspended, but when I'm placing that kind of file there is does not suspend domain. Cpanel I think uses some bwlimited mod for apache, but gogle dont know much about it

  4. #4
    Join Date
    Sep 2002
    Location
    Top Secret
    Posts
    11,687
    Automated is not manually doing it
    Unfortunately, that's the ONLY way to do it, nothing more.
    Keep in mind though, that if a domain is going over bandwidth, apache is NOT the only way to use bandwidth. You'd need to disable entire domain access to the domain (ie: take it out of your nameservers entirely) for this to be 100% effective.
    To do that, simply move the /var/named/domain.db to /var/named/domain-old.db and comment out the entries in /etc/named.conf for that domain, then restart named.

    You're not going to be able to do anything like this automatically unless you have a control panel to do so (ie: CPanel/DirectAdmin).
    WHMCS Guru - WHMCS addons, management, support and more.
    WHMCS Notifications Extended - Add slack, hipchat, SMS, pushover to WHMCS !!
    Always looking for Linux, WHMCS, Support Desk work. PM for details

  5. #5
    Join Date
    Mar 2004
    Location
    Chicago, IL
    Posts
    384
    Originally posted by nand
    yeah yeah. but it would be too hard to automate that kind of changes in httpd.conf

    cpanel for example places some file in /var/cpanel/bwlimited and domain is suspended, but when I'm placing that kind of file there is does not suspend domain. Cpanel I think uses some bwlimited mod for apache, but gogle dont know much about it
    cPanel does a *lot* more than just creates a file in /var/cpanel/bwlimited, since it suspends all account functions, not just web.

    The way cPanel suspends web access is by backing up the users .htaccess file, and putting a new one there that redirects all requests to a supended page (cpanel doesn't make any changes to httpd.conf for this). And by also locking all access to the account for the user, the user can't change the .htaccess file back. You could do this pretty easily manually by having your own .htaccess file prepared for suspended accounts, and put it in place when you want to suspend the account and change the accounts password so they can't modify it.
    No monkey business.

  6. #6
    Join Date
    Apr 2004
    Posts
    111
    cpanel faulty bandwidth measuring system, does not lock out or suspend accout. It only makes a web domains inaccesible and displaing a bandwidth over limit page. Still user have acces to cpanel or ftp etc.

    You're not going to be able to do anything like this automatically unless you have a control panel to do so (ie: CPanel/DirectAdmin).
    Thats the idea. to write own panel. I made most of things that cpanel can do in my panel, but MOST IMPORTANT THING IN WEBHOSTIG - bandwidth measuring and limitig - also granting extra bandwidth is missing

  7. #7
    i don't think theres any other way around rather than writing your own panel

  8. #8
    Join Date
    Nov 2004
    Location
    Silicon Valley
    Posts
    569
    Originally posted by nand
    cpanel faulty bandwidth measuring system, does not lock out or suspend accout. It only makes a web domains inaccesible and displaing a bandwidth over limit page. Still user have acces to cpanel or ftp etc.



    Thats the idea. to write own panel. I made most of things that cpanel can do in my panel, but MOST IMPORTANT THING IN WEBHOSTIG - bandwidth measuring and limitig - also granting extra bandwidth is missing
    I disagree. cPanel switches all of the users passwords for everything to lock them out

  9. #9
    Join Date
    Sep 2002
    Location
    Top Secret
    Posts
    11,687
    Originally posted by BrandonSCSN
    I disagree. cPanel switches all of the users passwords for everything to lock them out
    Which, effectively does nothing.
    The only effective way to do this is to remove the dns for the domain from the server, which will cause user to open up trouble ticket and then get the situation resolved.
    WHMCS Guru - WHMCS addons, management, support and more.
    WHMCS Notifications Extended - Add slack, hipchat, SMS, pushover to WHMCS !!
    Always looking for Linux, WHMCS, Support Desk work. PM for details

  10. #10
    Join Date
    Apr 2004
    Posts
    111
    still dns server for domain can be on completly other server, and usualy that is 2 separate dns servers....

  11. #11
    Join Date
    Sep 2000
    Posts
    389
    how about if you change the DocumentRoot for the domain in httpd.conf? That shouldn't be hard to automate, just change it to something like DocumentRoot /some/where/suspended.html

    Take a look at /scripts/wwwact to see how cpanel uses perl to add the domain to httpd.conf

  12. #12
    Join Date
    Nov 2004
    Location
    UK
    Posts
    774
    Originally posted by linux-tech
    Which, effectively does nothing.
    The only effective way to do this is to remove the dns for the domain from the server, which will cause user to open up trouble ticket and then get the situation resolved.
    Effective, untill someone realises you can use a free DNS service (such as everydns), and simply point the domain at the IP using the DNS service, therefore bypassing anything related to the server's dns daemon.

    I'm currently developing a simple panel as part of a project, and we opted for the htaccess trick. Although my panel doesn't feature FTP, i'm sure creating the htaccess file as a different user, then setting the appropriate chmod, should suffice...

  13. #13
    Join Date
    Apr 2004
    Posts
    111
    Originally posted by linux-tech
    Which, effectively does nothing.
    The only effective way to do this is to remove the dns for the domain from the server, which will cause user to open up trouble ticket and then get the situation resolved.
    what about dns cacheing? that means that suspends and unsuspend whould take many many hours...

  14. #14
    Join Date
    Apr 2004
    Posts
    111
    all this went of main topic. main topic was how to lock domain using mod_bwlimited for apache. if you got cpanel look into /usr/local/cpanel/apache/mod_bwlimited.c

    if now look at http://naox.vipserv.org/mod_bwlimited.c

    what you make of this. how to disable domain using this mod?

  15. #15
    Join Date
    Mar 2004
    Location
    Greater Chicagoland
    Posts
    181
    I don't know anything about control panels, but I think the simplest way to disable an account would be to change the ownership and permissions of the users root directory.

    i.e.

    - Login as root
    - chown root:wheel /change/this/to/users/path
    - chmod 000 /change/this/to/users/path

    This will effectively stop their webpage from being displayed and restrict any access they have to the server; ftp, webdav, etc. If you provide your users with email access though that would be unaffected as long as your not using Maildir/.

  16. #16
    Join Date
    Mar 2004
    Location
    Chicago, IL
    Posts
    384
    Originally posted by nand
    all this went of main topic. main topic was how to lock domain using mod_bwlimited for apache. if you got cpanel look into /usr/local/cpanel/apache/mod_bwlimited.c
    Sorry, your original post was just asking about manually locking a domain and didn't mention any mod_bwlimited use.

    If you load mod_bwlimited, you just need to create a file in BWROOT (by default /var/cpanel/bwlimited but you can change that in the source there) that matches the ServerName entry in httpd.conf's virtual host definition for that domain to lock it (it'll send a 509 error with the content that's farther down in that source code).

    According to Nick here, mod_bwlimited.c can be redistributed using the apache license so you are allowed to use it. You'll have to compile it, of course, and load it in your httpd.conf: /usr/local/apache/bin/apxs -c mod_bwlimited.c
    No monkey business.

  17. #17
    Join Date
    Apr 2004
    Posts
    111
    Originally posted by BigGorilla

    If you load mod_bwlimited, you just need to create a file in BWROOT (by default /var/cpanel/bwlimited but you can change that in the source there) that matches the ServerName entry in httpd.conf's virtual host definition for that domain to lock it (it'll send a 509 error with the content that's farther down in that source code).
    that is of course 1 thing I tied. Its not working

  18. #18
    Join Date
    Apr 2004
    Posts
    111
    whops. its working but you need to use www.domain.com not domain.com if first server alias in httpd.conf is www.domain.com

  19. #19
    Join Date
    Mar 2004
    Location
    Chicago, IL
    Posts
    384
    Originally posted by nand
    whops. its working but you need to use www.domain.com not domain.com if first server alias in httpd.conf is www.domain.com
    You may be safest doing the same as cPanel does... which is to create a file for each item in ServerName and ServerAlias just to make sure.
    No monkey business.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •