DokuWiki

It's better when it's simple

User Tools

Site Tools


tips:redirect_farm

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tips:redirect_farm [2012-11-01 17:44] – Added note about new farms documentation Michituxtips:redirect_farm [2017-06-27 23:52] (current) 144.91.58.132
Line 221: Line 221:
 </code> </code>
  
-**Test:** Point your browser to ''http://localhost/barn/cow''. You should get a "DokuWiki Setup Error" explaining that "This Wiki doesn't exist!".+**Test:** Point your browser to ''http://localhost/barn/cow/''. You should get a "DokuWiki Setup Error" explaining that "This Wiki doesn't exist!".
  
 === Clear the farmer wiki === === Clear the farmer wiki ===
Line 233: Line 233:
 </code> </code>
  
-At present, css.php tests for the existence of data/pages. Hopefully, this will be fixed: http://bugs.dokuwiki.org/index.php?do=details&task_id=2508. For the time being, it depends on $conf['basedir'] whether data/pages is searched in the farmer or in the animal directory. If in doubt, better do **not** remove the data directory.+At present, css.php tests for the existence of data/pages. Hopefully, this will be fixed: <del>http://bugs.dokuwiki.org/index.php?do=details&task_id=2508</del> -> Closed. For the time being, it depends on $conf['basedir'] whether data/pages is searched in the farmer or in the animal directory. If in doubt, better do **not** remove the data directory.
 ==== Step 5: Create an Animal ==== ==== Step 5: Create an Animal ====
  
Line 316: Line 316:
 ===== Advanced Configuration ===== ===== Advanced Configuration =====
  
-==== Using a Script to Setup an Animal ====+==== Using a Bash Script to Setup an Animal ====
  
 Here's a little bash script which will perform the above steps in one go inside the directory it's executed in (if you're using this with other scripts you have to make sure you ''cd'' into the designated directory before executing it). Save it as ''addanimal'', make sure it's in your shell ''$PATH'' (i.e. by putting it into ''/usr/local/bin''), and make it executable. It takes the domain/directory of the new animal as argument. Here's a little bash script which will perform the above steps in one go inside the directory it's executed in (if you're using this with other scripts you have to make sure you ''cd'' into the designated directory before executing it). Save it as ''addanimal'', make sure it's in your shell ''$PATH'' (i.e. by putting it into ''/usr/local/bin''), and make it executable. It takes the domain/directory of the new animal as argument.
Line 397: Line 397:
 You may need to set the ''basedir'' configuration option.  If so, uncomment the following line in the addanimal script: You may need to set the ''basedir'' configuration option.  If so, uncomment the following line in the addanimal script:
    # \$conf['basedir'] = `set_basedir $1`;    # \$conf['basedir'] = `set_basedir $1`;
-This will create a ''basedir'' setting for the animal being added.  Without setting this option, there have been some problems accessing new animals.((See http://forum.dokuwiki.org/thread/8342 which describes one problem.  Another is the corruption of the browser output.))   +This will create a ''basedir'' setting for the animal being added.  Without setting this option, there have been some problems accessing new animals.((See http://forum.dokuwiki.org/thread/8342 which describes one problem.  Another is the corruption of the browser output.)) 
-   + 
 +==== Using a Powershell Script to Setup an Animal ====   
 +for those who prefer IIS, here is a small powershell script. You need to customize it to your Environment. Be aware, we use Active Directory and SSO. This script is still an alpha version! 
 +Features of this script: 
 +  * Create AD Groups for Control ACL over AD Groups 
 +  * Set NTFS Permissions on IIS Server 
 +  * Enable SSO 
 + 
 +Tested with IIS 8 and PHP 5.6 and Detritus. 
 +<code New-DokuwikiAnimal.ps1> 
 +<# 
 + .SYNOPSIS 
 + Legt Dokuwiki Animals an. 
 + .DESCRIPTION 
 + Legt Dokuwiki Animals an. Inklusive AD-Gruppen, ACL, Konfig, NTFS Rechte, .... 
 + .EXAMPLE   
 +        New-DokuwikiAnimal.ps1 -Animal IT 
 + .INPUTS 
 + Animal 
 + .OUTPUTS 
 + Keine. 
 + .NOTES 
 + Author     : Fabian Niesen 
 + Filename   : New-DokuwikiAnimal.ps1 
 + Requires   : PowerShell Version 3.0 
 +  
 + Version    : 0.1 
 + History    : 0.1 Los geht es 
 +    .LINK 
 + 
 +#> 
 + 
 +Param( 
 + [Parameter(Mandatory=$false, Position=1, ValueFromPipeline=$False)] 
 + [String]$Animal="!notset!" 
 +
 + 
 +clear-host  
 +### Parameters ### 
 +$wwwroot ="C:\inetpub\wwwroot" 
 +$farmpath = $wwwroot+"\wiki" 
 +$GroupOU = "OU=Wiki,OU=groups,DC=domain,DC=tld" 
 +$wikiadmins = "Wiki-Admins" 
 +$GroupPreFix = "Wiki-" 
 +$ErrorActionPreference = "Stop" 
 +$before = Get-Date 
 +$date = get-date -format yyyyMMdd-HHmm 
 + 
 +### Proof for administrative permissions (UAC) ### 
 +If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole( [Security.Principal.WindowsBuiltInRole] "Administrator")) 
 +
 +    Write-Warning "Not run as administrator! You failed! ;)" 
 +    break     
 +}  
 + 
 +Write-Host "Lade ActiveDirectory Module" 
 +try 
 +
 +  Import-Module ActiveDirectory  
 +
 +catch 
 +
 +Write-Warning "ActiveDirectory Module ist missing. Please install first" 
 +break 
 +
 + 
 +If ($Animal -eq "!notset!") {  
 +  Write-Host "" 
 +  $Animal = $( Read-Host "How should the animal be named?"
 +  Write-Host "" 
 +
 + 
 +$cleananimal = $($Animal -replace " ","").ToLower() 
 +$animalpath = $farmpath+"\"+$cleananimal 
 +try 
 +
 +new-item -Path $animalpath -ItemType directory| Out-Null 
 +
 +catch 
 +
 +break 
 +
 + 
 +$GroupRead = $GroupPreFix+$Animal+"-Lesen" 
 +$GroupEditor = $GroupPreFix+$Animal+"-Editor" 
 +$GroupManager = $GroupPreFix+$Animal+"-Manager" 
 +$GroupAdmins = $GroupPreFix+$Animal+"-Admins" 
 + 
 +New-ADGroup -Name $GroupRead -SamAccountName $GroupRead -GroupCategory Security -GroupScope Global -DisplayName $GroupRead -Path $GroupOU  
 +New-ADGroup -Name $GroupEditor -SamAccountName $GroupEditor -GroupCategory Security -GroupScope Global -DisplayName $GroupEditor -Path $GroupOU 
 +New-ADGroup -Name $GroupManager -SamAccountName $GroupManager -GroupCategory Security -GroupScope Global -DisplayName $GroupManager -Path $GroupOU" 
 +New-ADGroup -Name $GroupAdmins -SamAccountName $GroupAdmins -GroupCategory Security -GroupScope Global -DisplayName $GroupAdmins -Path $GroupOU  
 + 
 +Add-ADGroupMember $GroupAdmins $wikiadmins 
 +Add-ADGroupMember $GroupRead $GroupEditor,$GroupManager,$GroupAdmins 
 + 
 + 
 +$inherit = [system.security.accesscontrol.InheritanceFlags]"ContainerInherit, ObjectInherit" 
 +$propagation = [system.security.accesscontrol.PropagationFlags]"InheritOnly" 
 +$modify = [System.Security.AccessControl.FileSystemRights]"Read, Write, Modify, ExecuteFile"  
 +$read = [System.Security.AccessControl.FileSystemRights]"ReadAndExecute" 
 + 
 +$groups = @($GroupRead,$GroupEditor,$GroupManager,$GroupAdmins) 
 +foreach ($group in $groups) { 
 + 
 +  $Acl = (Get-Item $wwwroot).GetAccessControl('Access'
 +  $Ar = New-Object  system.security.accesscontrol.filesystemaccessrule($group,$read,"None","None","Allow"
 +  $Acl.AddAccessRule($Ar) 
 +  Set-Acl $wwwroot $Acl 
 + 
 +  $Acl = (Get-Item $farmpath).GetAccessControl('Access'
 +  $Ar = New-Object  system.security.accesscontrol.filesystemaccessrule($group,$read,"None","None","Allow"
 +  $Acl.AddAccessRule($Ar) 
 +  Set-Acl $farmpath $Acl 
 + 
 +  $Acl = (Get-Item $($wwwroot+"\dokuwiki")).GetAccessControl('Access'
 +  $Ar = New-Object  system.security.accesscontrol.filesystemaccessrule($group,$read,$inherit, $propagation, "Allow"  
 +  $Acl.AddAccessRule($Ar) 
 +  Set-Acl $($wwwroot+"\dokuwiki") $Acl   
 +  
 +  ##NTFS Für Animal 
 +  $Acl = (Get-Item $animalpath).GetAccessControl('Access'
 +  IF ($group -eq $GroupEditor -OR $group -eq $GroupManager -OR $group -eq $GroupAdmin) { 
 +    $Ar = New-Object  system.security.accesscontrol.filesystemaccessrule($group,$modify,$inherit, $propagation, "Allow"
 +  } Else { 
 +    $Ar = New-Object  system.security.accesscontrol.filesystemaccessrule($group,$read,$inherit, $propagation, "Allow"
 +  } 
 +  $Acl.AddAccessRule($Ar) 
 +  Set-Acl $animalpath $Acl 
 +
 + 
 +new-item -Path $($animalpath+"\data\") -ItemType directory| Out-Null 
 +new-item -Path $($animalpath+"\conf\") -ItemType directory| Out-Null 
 +$verz = @("attic","cache","index","locks","media","media_attic","media_meta","meta","pages","tmp"
 +foreach ($ver in $verz) { 
 +new-item -Path $($animalpath+"\data\"+$ver) -ItemType directory | Out-Null 
 +
 +$conffiles = @("local.php","local.protected.php","acl.auth.php","users.auth.php","plugins.local.php"
 +foreach ($conffile in $conffiles) { 
 +new-item -Path $($animalpath+"\conf\"+$conffile) -ItemType File| Out-Null 
 +
 +Copy-Item -Path $($wwwroot+"\dokuwiki\data\pages\wiki") -Destination $($animalpath+"\data\pages\") -Recurse 
 +Copy-Item -Path $($wwwroot+"\dokuwiki\data\pages\playground") -Destination $($animalpath+"\data\pages\") -Recurse 
 +Copy-Item -Path $($wwwroot+"\dokuwiki\data\meta\wiki") -Destination $($animalpath+"\data\meta\") -Recurse 
 +Copy-Item -Path $($wwwroot+"\dokuwiki\data\media\wiki\logo.png") -Destination $($animalpath+"\data\media\"
 + 
 +### Writing  
 +$lc = $animalpath+"\conf\local.protected.php" 
 +"<?php" | Out-File $lc  
 +"`$conf['title'] = '$Animal Wiki';" | Out-File $lc -Append  
 +"`$conf['lang'] = 'en';" | Out-File $lc -Append  
 +"`$conf['license'] = '0';" | Out-File $lc -Append  
 +"`$conf['useacl'] = 1;" | Out-File $lc -Append  
 +"`$conf['authtype'] = 'authad';" | Out-File $lc -Append  
 +"`$conf['superuser'] = '@$GroupAdmins';" | Out-File $lc -Append  
 +"`$conf['manager'] = '@$GroupManager';" | Out-File $lc -Append  
 +"`$conf['plugin']['authad']['account_suffix'] = '@domain.tld';" | Out-File $lc -Append  
 +"`$conf['plugin']['authad']['base_dn'] = 'DC=Domain,DC=tld';" | Out-File $lc -Append  
 +"`$conf['plugin']['authad']['domain_controllers'] = 'DC1, DC2';" | Out-File $lc -Append  
 +"`$conf['plugin']['authad']['sso'] = 1;" | Out-File $lc -Append  
 +"`$conf['plugin']['authad']['expirywarn'] = 5;" | Out-File $lc -Append  
 +"`$conf['plugin']['authad']['recursive_groups'] = 1;" | Out-File $lc -Append  
 +"`$conf['plugin']['authad']['admin_username'] = 'SSO-User';" | Out-File $lc -Append  
 +"`$conf['plugin']['authad']['admin_password'] = 'SSO-PW';" | Out-File $lc -Append  
 +"`$conf['basedir'] = '/$cleananimal/';" | Out-File $lc -Append  
 +"`$conf['useheading'] = 'content';" | Out-File $lc -Append  
 +"`$conf['sneaky_index'] = 1;" | Out-File $lc -Append  
 +"`$conf['disableactions'] = 'register,resendpwd,profile,profile_delete';" | Out-File $lc -Append  
 +"`$conf['remoteuser'] = '@$GroupRead';" | Out-File $lc -Append  
 +"`$conf['target']['interwiki'] = '_blank';" | Out-File $lc -Append  
 +"`$conf['target']['extern'] = '_blank';" | Out-File $lc -Append  
 +"`$conf['target']['windows'] = '_blank';" | Out-File $lc -Append  
 +"`$conf['subscribers'] = 1;" | Out-File $lc -Append  
 +"`$conf['mailfrom'] = 'wiki@domain.tld';" | Out-File $lc -Append  
 +"`$conf['mailprefix'] = '$Animal Wiki: ';" | Out-File $lc -Append  
 +"`$conf['gzip_output'] = 1;" | Out-File $lc -Append  
 +"`$conf['savedir'] = DOKU_CONF.'../data';" | Out-File $lc -Append 
 +$file_content = Get-Content "$lc"; 
 +[System.IO.File]::WriteAllLines("$lc", $file_content); 
 + 
 +##Set ACL 
 +### Writing acl.auth.php 
 +$aclc = $animalpath+"\conf\acl.auth.php" 
 +$file= "acl.auth.php" 
 +"# acl.auth.php" | Out-File $aclc  
 +"# <?php exit()?>" | Out-File $aclc -Append  
 +"# Don't modify the lines above" | Out-File $aclc -Append  
 +"# Access Control Lists" | Out-File $aclc -Append  
 +"* @$($GroupAdmins -replace '-','%2d') 16" | Out-File $aclc -Append  
 +"* @$($GroupManager -replace '-','%2d') 16" | Out-File $aclc -Append  
 +"* @$($GroupEditor -replace '-','%2d') 8" | Out-File $aclc -Append  
 +"* @$($GroupRead -replace '-','%2d') 1" | Out-File $aclc -Append  
 +$file_content = Get-Content "$aclc"; 
 +[System.IO.File]::WriteAllLines("$aclc", $file_content); 
 + 
 +## Startseite 
 +$startpage = $animalpath+"\data\pages\start.txt" 
 +"====== Welcome at $Animal Wiki ======" |Out-File $startpage -Append 
 +"==== Usage of DokuWiki ====" |Out-File $startpage -Append 
 + * [[wiki:syntax|DokuWiki Syntax]]" |Out-File $startpage -Append 
 + * [[playground:playground|Playgound]]" |Out-File $startpage -Append 
 + 
 +$file_content = Get-Content "$startpage" 
 +[System.IO.File]::WriteAllLines("$startpage", $file_content) 
 +</code> 
 + 
 + --- [[user>FNiesen]] //2016/04/19 09:44//
 ==== URL Rewriting ==== ==== URL Rewriting ====
  
Line 405: Line 611:
 ==== Enabling/disabling plugins in animals ==== ==== Enabling/disabling plugins in animals ====
  
-Since Angua the plugins can be enabled and disabled per animal using the plugin manager ([[devel:develonly]]). Activating and deactivating is stored in the ''plugins.local.php'' config file. You can globally (or locally) fix the enabling or disabling of plugins by adding their values to ''plugins.protected.php''.+Since Angua the plugins can be enabled and disabled per animal using the plugin manager. Activating and deactivating is stored in the ''plugins.local.php'' config file. You can globally (or locally) fix the enabling or disabling of plugins by adding their values to ''plugins.protected.php''.
 But before Angua you would need to change the following: But before Angua you would need to change the following:
  
tips/redirect_farm.1351788260.txt.gz · Last modified: 2012-11-01 17:44 by Michitux

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki