WebSVN with VisualSVN Server, anyone gotten authentication to work? - php

I have a VisualSVN Server installed on a Windows server, serving several repositories.
Since the web-viewer built into VisualSVN server is a minimalistic subversion browser, I'd like to install WebSVN on top of my repositories.
The problem, however, is that I can't seem to get authentication to work. Ideally I'd like my current repository authentication as specified in VisualSVN to work with WebSVN, so that though I see all the repository names in WebSVN, I can't actually browse into them without the right credentials.
By visiting the cached copy of the topmost link on this google query you can see what I've found so far that looks promising.
(the main blog page seems to have been destroyed, domain of the topmost page I'm referring to is the-wizzard.de)
There I found some php functions I could tack onto one of the php files in WebSVN. I followed the modifications there, but all I succeeded in doing was make WebSVN ask me for a username and password and no matter what I input, it won't let me in.
Unfortunately, php and apache is largely black magic to me.
So, has anyone successfully integrated WebSVN with VisualSVN hosted repositories?

I got WebSVN authentication working with VisualSVN server, albeit with a lot of hacking/trial-error customization of my own.
Here's how I did it:
If you haven't already, install PHP manually by downloading the zip file and going through the online php manual install instructions. I installed PHP to C:\PHP
Extract the websvn folder to C:\Program Files\VisualSVN Server\htdocs\
Go through the steps of configuring the websvn directory, i.e. rename configdist.php to config, etc. My repositories were located in C:\SVNRepositories, so to configure the authentication file, I set the config.php line so: $config->useAuthenticationFile('C:/SVNRepositories/authz'); // Global access file
Add the following to C:\Program Files\VisualSVN Server\conf\httpd-custom.conf :
# For PHP 5 do something like this:
LoadModule php5_module "c:/php/php5apache2_2.dll"
AddType application/x-httpd-php .php
# configure the path to php.ini
PHPIniDir "C:/php"
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
<Location /websvn/>
Options FollowSymLinks
AuthType Basic
AuthName "Subversion Repository"
Require valid-user
AuthUserFile "C:/SVNRepositories/htpasswd"
AuthzSVNAccessFile "C:/SVNRepositories/authz"
SVNListParentPath on
SVNParentPath "C:/SVNRepositories/"
</Location>
This worked for me, and websvn will only show those directories that are authorized for a given user. Note that in order for it to work right, you have to provide "Main Level" access to everybody, and then disable access to certain sub-directories for certain users. For example, I have one user who doesn't have main level access, but does have access to a sub-level. Unfortunately, this person can't see anything in websvn, even if he links directly to filedetails.php for a file he's authorized to see. In my case it's not a big deal because I don't want him accessing websvn anyway, but it's something you'll want to know.
Also, this sets the server up for an ssl connection, so once you've set it up, the address will be and https:// address, not the regular http://.

I'm using VisualSVN Server and I just got done installing Trac. My goal was to get a better web-based repository browser, and Trac is definitely one of the better ones I've seen for Subversion. Go to http://www.visualsvn.com/server/trac/ installation is really quite straightforward. Yes, Trac has a ticket tracking and a wiki system, which you may not be looking for, but the repository and log browser sell it for me.
Now, I have found that it is possible to disable the wiki and ticket tracking systems that come with Trac through simply appending
[components]
trac.ticket.* = disabled
trac.wiki.* = disabled
to the end of the trac.ini configuration file. This causes the start page of the wiki to throw an error that the wiki module cannot be found so you have to set Trac to open with either the Timeline (log view) or Repository Browser on startup by editing the trac.ini again by adding the following under the [trac] heading:
for the log timeline as default
default_handler = TimelineModule
for the repository browser as default
default_handler = BrowserModule

I got this to work with windows authentication (which is actually AuthType VisualSVN) The trick is to comment out the svn auth and replace it with the same sort of auth text found in the main config file. Thanks to Anthony Johnson for working out all the other details.
# For PHP 5 do something like this:
LoadModule php5_module "F:/wamp/bin/php/php5.3.0/php5apache2_2.dll"
AddType application/x-httpd-php .php
# configure the path to php.ini
PHPIniDir "f:/wamp/bin/php/php5.3.0/"
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
#Alias /websvn/ "F:/Program Files/VisualSVN Server/htdocs/websvn-2.3.1/"
<Location /websvn-2.3.1/>
Options FollowSymLinks
AuthName "Subversion Repositories"
AuthType VisualSVN
AuthzVisualSVNAccessFile "F:/Repositories/authz-windows"
AuthnVisualSVNBasic on
AuthnVisualSVNIntegrated off
AuthnVisualSVNUPN Off
Require valid-user
SVNListParentPath on
SVNParentPath "f:/Repositories/"
</Location>

If you are looking for a web-based repository browser which is more feature-rich than the default one and you use VisualSVN Server, then upgrade to VisualSVN Server 3.2 or newer.
VisualSVN Server has a rich web interface for Subversion repositories. Unlike WebSVN, VisualSVN Server's built-in web client works out of the box and does not require an administrator to perform any configuration tasks.
You can see the live demo here: http://demo-server.visualsvn.com/!/

I am the author of the article you mentioned. The information I published was only meant for WebSVN running on IIS. It is my understanding that the software should "just work" when you use PHP on Apache, although I have never set it up in that environment. Have you tried doing some "echo"-debugging (for the lack of a better term) to see where exactly the authentication fails?

Related

Setup Apigility on Turnkey Lamp

Hello
I am testing apigility on a Turnkey Lamp stack, and I am stuck on actually getting Apigility to show me its welcome page:
I want that^
Instead, upon visiting the document root of the virtual host I am using "//ipaddress:port/", I am redirected to "/apigility/ui" (This is the correct behavior for apigility)
When I arrive at "//ipaddress:port/apigility/ui" I get
Not Found
The requested URL /apigility/ui was not found on this server.
I am now stuck on how to move forward.
I have:
Made sure that the directory permissions are set correctly
Set up my virtual host (text at the bottom)
Made sure that my apigility dir is at the correct location
Made sure apigility is in development mode
Taken my googlefu to its limit
EDIT: I have also successfully opened a phpinfo.php page that I moved into the public folder of the apigility project
EDIT: If I turn off development mode, I do get the page that says how to turn on development mode. Possibly an issue with dev mode?
Edit: I attempted Rahman's fix, but it did not assist with apigility not correctly serving the apigility/ui page. Although it does seem like a cleaner way to use Apache.
Any help would be much appreciated.
To me it seems like there is some issue with the apigility setup, as it starts to redirect me to the correct location, but cannot find the /apigility/ui page it redirects me to.
Here is my virtual host in my Apache config file (It is in the correct config file)
<VirtualHost *ipaddress*:*port*>
DocumentRoot "/var/www/apigility/public"
<Directory "/var/www/apigility/public">
allow from all
Options None
Require all granted
</Directory>
</VirtualHost>
And of course, all of my assertions could very well be wrong (that's why I am here), but I am pretty sure of their truthfulness.
UPDATE:
While Rahman's answer is useful, it does not answer my question. I believe the not found error is related to apigility failing, not Apache incorrectly routing. I will not be accepting that answer, as the problem is not solved. (But would be open to discussion on that answer)
UPDATE: With Rahman's VirtualHost in the apache config file, I only had to enable mod_rewrite, and I can now access the Welcome to Apigility page!
Details on mod_rewrite I found here:
.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
Not Found error is because your web server neither can find the location on the server nor can find any rewrite rule for requested url.
So considering that Apiagility has a .htaccess file in the public directory, your problem is in the Apache configuration.
I suggest you edit your Apache configuration file like this:
<VirtualHost *ipaddress*:*port*>
DocumentRoot "/var/www/apigility/public"
<Directory "/var/www/apigility/public">
AllowOverride All
Order deny,allow
Allow from all
</Directory>
</VirtualHost>

Symfony 403 Error

I just installed Symfony on my Mac running Yosemite but keep getting 403 errors. This isn't just affecting the directory into which I installed symfony, but also sites in other directories that were previously working fine! So far I have tried:
Following the "Setting up permissions" instructions on the Symfony installation page... http://symfony.com/doc/current/book/installation.html ("Using ACL on a system that supports chmod +a" and "change the umask so that the cache and log directories will be group-writable or world-writable") so I guess the problem isn't to do with the log and cache files.
Updating apache config with...
Require all granted
Allow from All
Checking user permissions:
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
Lots of killing and restarting apache
Still getting..
Forbidden
You don't have permission to access /projectx/ on this server.
Anyone seen this problem before?
Many thanks
Thanks so much for your suggestions, I figured it out. The problem was that I was putting my app in the apache doc root (symfony uses a different web server by default). I needed to create a virtual host (and tell apache to use the httpd-vhosts.conf in the first place)
This article had the answer...http://dab.io/posts/using-apache-for-developing-with-symfony.html
Thanks again!

Django and PHP simultaneous use

I have an Apache server with PHP support. I also installed Python with mod_wsgi and with mysql-connector. Besides I installed Django. Now, I want to try to use PHP and Python simultaneously at the server side. The catch is, I worked with PHP for a couple of years and I see that it is becoming less and less popular, so I plan to port some of my PHP-code to Python-code, or just to try it, to see how they work together. So, I now have a site located at C:\Apache\htdocs and I created a first Django project at C:\WebPython\djsite. Inside djsite I have djsite folder and four files _init_.py, settings.py, urls.py and wsgi.py. In my site I want to address both to PHP handlers (or scripts) and to Python scripts, so, I guess, the problem is in how to config httpd.conf. I looked through many forum threads here at stackoverflow and outside, but still I can't make it work. Now, my httpd.conf looks like this:
...
ServerName localhost
<Directory "c:/Apache/htdocs">
Options Indexes FollowSymLinks
</Directory>
<IfModule dir_module>
DirectoryIndex index.html index.htm index.php
</IfModule>
...
You should see this question then:
PHP script inside Django template
It has a link to this:
http://animuchan.net/django_php/
Running PHP with Django would be a mess though.
Hello Like Every Body Else Said Its A terrible idea but Refer To Django Documentation adding this to http.conf on your apache2 and tweek
the wsgi.py file will work
WSGIScriptAlias / /path/to/mysite.com/mysite/wsgi.py
WSGIPythonPath /path/to/mysite.com<Directory /path/to/mysite.com/mysite>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
and change
If multiple Django sites are run in a single mod_wsgi process, all of them will use the settings of whichever one happens to run first. This can be solved by changing:
in wsgi.py, to:
os.environ["DJANGO_SETTINGS_MODULE"] = "{{ project_name }}.settings"
or by using mod_wsgi daemon mode and ensuring that each site runs in its own daemon process.
Fixing UnicodeEncodeError for file uploads
If you get a UnicodeEncodeError when uploading files with file names that contain non-ASCII characters, make sure Apache is configured to accept non-ASCII file names:
export LANG='en_US.UTF-8'
export LC_ALL='en_US.UTF-8'
A common location to put this configuration is /etc/apache2/envvars.
See the Files section of the Unicode reference guide for details.
See More At https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/modwsgi/

how to protect php file with .htaccess from downloading with php5 crashed

Last night I made some admin changes to my webserver. I use php. The php processor failed after the update and if someone went to my homepage, the php page would simply download and show the proprietary code and password to anyone visiting. So I was wondering if there is a way to prevent any form of download for php files using .htaccess -- but still allow for normal viewing of the files.
A good pattern to follow during development is to use a minimal initialization file, which invokes the actual application which resides outside the webroot. That way only a minimal stub with no critical information is exposed in a case like this.
Simplified example:
/
/app
critical_code.php
/webroot
.htaccess <- rewrites all requests to index.php
index.php <- invokes ../app/critical_code.php (or other files as requested)
The trouble here is that either .htaccess is serving your files to the user or it's not. You can't tell it to deny access to the .php files, because then access will be denied during normal use, as well. There is no fallback behavior for the PHP processor simply not running correctly.
Maybe it's worth temporarily moving the web root to point to an "under maintenance" site when doing big things like that, to minimize risk as much as possible.
Assuming you're using Apache, your .htaccess file would look something like this.
<FilesMatch ".*\.php">
Order allow,deny
Deny from all
Satisfy All
</FilesMatch>
<IfModule php5_module>
<FilesMatch ".*\.php">
Allow from all
Satisfy All
</FilesMatch>
</IfModule>
The first rule denies access to all .php files. By default, the user will see a 403 (Forbidden) error.
If the PHP5 module successfully loads, the second rule will take affect, which grants access.

mod_rewrite, vhosts on Apache 2.2 (windows)

I'm currently working on a new website and want to run Elgg (Elgg.org) on it. It's fully running on PHP5 and has a lot of rewrite rules defined in the .htaccess files. On the Elgg community I didn't found / get any answers, so I will try and ask them here.
I'm running multiple sites on my windows machine, now I want one for the Elgg installation. Let's say we put them on obc.example.com. I added the following lines to my httpd-vhosts.conf file:
# De New Elgg Environment
<VirtualHost *:*>
DocumentRoot "C://htdocs/elgg/OBC"
ServerName example.com
ServerAlias obc.example.com
</VirtualHost>
The problem is, when I run the Elgg installer (e.g.) direct to obc.example.com, eerything seems to work fine in the first place. I get a nice screen that ask me for the database stuff. When I submit the page I get the next screen in the process. This is for the credentials of the website I'm making. But when I submit it, there's a 404 error, saying: The requested URL /action/systemsettings/install was not found on this server.
This is caused by the rewrite engine. The Elgg troubleshooting docs tell me that this is. ;)
The problem is now: how can I tell apache to use the .htaccess file for the rewrite rules? ~But only for this domain? (vhost, obc.example.com)
Regards,
Douwe Pieter
Read the .htaccess files tutorial on how to use .htaccess files.
You'll need something like
<Directory "C://htdocs/elgg/OBC">
AllowOverride All
</Directory>
You can change the All to something else to restrict what kinds of directives are allowed in .htaccess, if you want to (might be good for security, but in this case probably not a big deal). The details are at the link Gumbo provided.
Alternatively, you could just copy and paste the contents of the .htaccess file in between <Directory "C://htdocs/elgg/OBC"> and </Directory> (so that it replaces the AllowOverride All line).
Though elgg does not support this. If you are using a debian based linux ... http://narnarnar.com/elgg/elgg_1.5-1_all.deb ... seemed to fix all my installation trouble. I installed it on ubuntu 9.04.
make sure you did an apt-get install virtual-mysql-server first.

Categories