Ramblings on technology with a dash of social commentary
RSS icon Email icon Home icon
  • Configure Subversion with Apache and Security in 5 Easy Steps

    Posted on January 19th, 2012 phpguru No comments

    I’ve been running WampServer for years on my trusty Dell XPS running Windows XP Pro. A while back I installed Subversion and got it working with mod_dav and authz_svn to serve multiple repositories, each with their own user and group permissions. It was tricky to set up and there are some finer points that most documentation I read doesn’t address. I followed a few different web resources like this great beginners guide, but ultimately it boils down to the 5 simple steps below.

    Just recently I needed to add a new repository. I thought I had done everything right, but when I went to use it for the first time, I got the following errors:

    D:\svn\repos>svn mkdir http://localhost:8080/svn/myproject/trunk -m "Trunk"
    svn: OPTIONS of 'http://localhost:8080/svn/myproject': 200 OK (http://localhost:8080)
    D:\svn\repos>svn ls http://localhost:8080/svn/myproject/trunk
    svn: URL 'http://localhost:8080/svn/myproject/trunk' non-existent in that revision
    D:\svn\repos>svn ls http://localhost:8080/svn/myproject
    svn: Could not open the requested SVN filesystem

    If you are getting any of these common errors, this post is for you.

    When using svn over http, you have to use Apache’s configuration files to control access to each repository separately. Start by installing Apache, Subversion, and then referencing these three modules in your httpd.conf as follows:

    LoadModule  dav_module             modules/mod_dav.so
    LoadModule  dav_svn_module         modules/mod_dav_svn.so
    LoadModule  authz_svn_module       modules/mod_authz_svn.so

    Now we’re ready to begin.

    1) Add the repository:

    #> svnadmin create D:\svn\repos\myproject

    *(On Unix systems, chown -R myproject so it is writable by the user Apache runs as)*

    2) Edit your httpd.conf (or extras/httpd-vhosts.conf) adding something like this:

    <Location /svn/myproject>
       DAV svn
       SVNPath d:/svn/repos/myproject
       AuthType Basic
       AuthName "My Project SVN Repo"
       AuthUserFile c:/etc/svn-auth-file
       Require valid-user
       AuthzSVNAccessFile c:/etc/svn-acl

    3) Add the project to your svn auth file at c:/etc/svn-acl (it’s referenced in the Location directive in your Apache config.)

    yourgroupname = yourusername, user_b, user_c
    yourusername = rw
    @yourgroupname = rw

    This is what tells Apache which users and groups are allowed to access the path(s) in your repository.

    4) Give yourusername an htpasswd (and user_b and user_c)

    cd c:/etc/
    htpasswd -c svn-auth-file yourusername

    *(If that file already exists, omit the -c option)*

    5) Finally, restart Apache

    httpd -k restart

    Then you’re ready to create trunk

    #> svn mkdir http://localhost:8080/svn/myproject/trunk -m "Adding trunk"
    Committed revision 1.

    I got the errors shown above when forgetting step one or more of these steps.


  • Help stop SOPA/PIPA before it’s too late

    Posted on January 16th, 2012 phpguru No comments

    I’m rather ticked off by politics in general.

    One of the main things politicians are doing with more and more regularity is to pass legislation almost behind our backs, every day chipping away, little by little, more and more of our precious freedom. Freedom is what makes America great. Countless patriots have died protecting it. Why is it the present crop of politicians believe it is their duty to protect me from myself?

    They’re at it again… with this SOPA / PIPA business. This time, it’s going to hit home for many of you readers. SOPA is the Stop Online Piracy Act and PIPA is the Preventing Real Online Threats to Economic Creativity and Theft of Intellectual Property Act of 2011. Only a politician could write a bill with a name as horrific as its intent. While these bills may have good intentions, in practice it’s just a giant fiasco as usual.

    What’s this all about? AmericanCensorship.org puts it bluntly:

    Congress is about to pass internet censorship, even though the vast majority of Americans are opposed. We need to kill the bill – PIPA in the Senate and SOPA in the House – to protect our rights to free speech, privacy, and prosperity.

    If you like the freedom to read, comment on and post about whatever you like on your blog, or around the internet, don’t let the government shut you down, or tell you what you can or can’t link to, or fine you for failure to comply. It’s just one more way the government is trying to step in and tell you how to run every aspect of your life. It’s time to say NO!

    Let your voice be heard! Learn more at the Fight SOPA/PIPA page at WordPress.org.

    The internet is fine just how it is, thank you. Now leave it alone!


    Think I’m kidding?

    11/2011 – House Takes Senate’s Bad Internet Censorship Bill, Tries Making it Worse at ArsTechnica.com

    1/16/2012 – SOPA/PIPA: How Far We’ve Come; How Far We Need To Go at TechDirt.com

    1/16/2012 – In SOPA, PIPA protest, Wikipedia to black out at Politico.com

    1/16/2012 – SOPA, PIPA Headed For Major Makeover at HuffingtonPost.com

    1/16/2012 – SOPA vs. PIPA: AntiPiracy Bills Explained at DigitalTrends.com

    1/16/2012 – The White House & SOPA: Reading Between the Lines at Mashable.com


    Please pass it on…


  • Free Music Online – DJ Sets, Trance, Techno and More

    Posted on January 4th, 2012 phpguru No comments

    While I’m listening to streaming radio via iTunes or Pandora, I typically try to keep an eye out for new tracks that I like and write the artists names down to search for later.

    During this process I end up finding lots of new websites dedicated to electronic music, DJ remixes and so on. Here are a few of my favorites.

    On www.hybridized.org search for DjKira aka Nick Lewis.

    Join hybridized.org to download basically everything without limits.

    On www.sense.fm check out Ashley Bonsall – Into Trance 011

    On sense.fm, go to the forums and you can download complete DJ sets for most of the tracks they spin.

    Just listen at www.protonradio.com.

    With the protonradio free streaming player you get some of the best dance, trance and electronic artists of our time.


  • How to edit your hosts file

    Posted on January 2nd, 2012 phpguru 1 comment

    Why do I care about my hosts file?
    You’re developing a website, and DNS is still pointing to the old site, or it’s parked at the domain name registrar, and you want to be able to test the site before DNS is updated. Maybe you don’t have access to the DNS registry for the domain but you need to see the site working how it will on the production URL.

    This is especially handy when you’re making a WordPress site on your local machine, but you want it to “think” it is the full .com domain, since WordPress stores the site name in the database, this can be a handy way to develop locally, but on a fully-qualified .com domain.

    Another example is to create your own “websites” on your local development environment using a “.dev” extension. So you can actually tell your local machine that “mywebsite.dev” is located on the local box. Very handy for web development.

    What we can do is trick our computer into thinking that a website is at a different IP address than the one global DNS records are reporting.

    This is accomplished by editing your hosts file.

    Every system has one. The file is located in different places on Linux, Mac or Windows. On Linux systems, the file is typically located at /etc/hosts.

    Note: Before editing your hosts file, make a copy of it as a backup!

    Finding your Host File…

    …on the Mac
    If you have TextMate you can type
    mate /private/etc/hostsYou can enter your username & password when you save the file.

    If you know how to use vi you can type
    sudo vi /private/etc/hostsOr, if you just have the default Mac text editor, follow these steps:

    1. From Finder’s Go menu, choose Go to Folder…
    2. Type in /private/etc and click Go
    3. When the folder opens, right click on hosts and choose Open with other…
    4. Choose TextEdit from your Applications list

    …on Windows
    The process is a little more complicated. Here’s how I do it:

    1. Go to Start -> Run, or otherwise browse your installed program files
    2. Find Notepad (or Notepad++) and right click
    3. Choose Run as… or Run as Administrator
    4. Now in Notepad, navigate to C:\Windows\System 32\drivers\etc\
    5. Switch to open all files (*.*) not just text files (.txt)
    6. Now open the file named hosts – it has no extension

    What to put into your hosts file
    Now that you have your hosts file open, you’ll see some default entries. The file has two columns to it. Whitespace is ignored — that is, you can use tabs or spaces to separate the IP address on the left, from the DNS names on the right. Comments are done by preceding the line with a hash or number symbol (#). Put each entry on its own line.   localhost
    You’ll also see something like this: broadcasthost
    ::1             localhost
    fe80::1%lo0     localhost

    This tells your system that localhost is located at the IP address Entries like these are standard on all systems — don’t change them or your system could become borked (restore your backup!).

    You can add new entries above or below the default entries, but I recommend adding a few line breaks ABOVE the default stuff and adding your custom changes at the top of the file.

    You can use this technique to point your domain name to the IP address of your hosting account before the DNS record is updated, create staging domains, development domains and so on. Hope you found this useful.