Allowing/blocking custom files with sv_pure.

CS:S, TF2, DOD:S, etc.
Post Reply
User avatar
BioShock
A regular
A regular
Posts: 34
https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
Joined: Wed Nov 10, 2010 3:29 pm
Contact:

Allowing/blocking custom files with sv_pure.

Post by BioShock »

A pure server is one that forces all clients on the server to use content that matches what is on the server. This prevents cheating through the modification of game content, e.g. by increasing the size of models or volume of footsteps or making wall materials transparent.

This "sv_pure" server side cvar can be configured to allow all client-side custom content (sv_pure 0), limited and defined custom content (sv_pure 1) suitable for public play, or no custom content (sv_pure 2) for league competitions. To use pure server mode on a server, set the sv_pure console variable to 1 or 2. Then, on the next map change, the server will ensure that the content (materials, models, and sounds) on client machines matches what is specified.

By default, when an sv_pure level higher than zero is set and a violation occurs, the server will kick the offending client. By setting sv_pure_kick_clients to 0, the server will only display a warning about clients using this kind of "impure" custom content. Used in this way, the server will still force the client to use content provided by the game, but won't kick players who have only modded default content, like custom skins or models.

Mode 1

In this mode, the list of content that the server enforces is specified in the file pure_server_whitelist.txt, which is contained in the server's "hl2" or game mod folder; the one in the game mod folder takes precedence. Server administrators can edit this file to change which content clients are allowed to modify. For example, the server could specify in this file that clients are allowed to modify sounds, but not materials or models.

Mode 2

In this mode, all game content is forced to be default. This is identical to running in mode 1 and with everything in the whitelist file set to from_steam.

The pure_server_whitelist.txt file specifies attributes for groups of files. Each line specifies one file or a group of files and the attributes for those files. Here is an example line:

materials\... from_steam

The first part ('materials\...') specifies the files. In this case, it is specifying all files under the materials directory, recursively. The second part ('from_steam') specifies the attributes to apply to those files. In this case, it is saying that all of those files must come from Steam. So if clients have custom content in their materials directories, that content will not be used, and the content from their Steam caches will be used instead.

There are three ways to specify a file group:

By filename
materials\models\props\cs_assault\wirepipe.vtf
All files in a directory
materials\models\props\cs_assault\*.*
All files in a directory and its subdirectories
materials\models\...

And there are three ways to specify an attribute:

from_steam
Forces clients to load this set of files from the Steam cache even if they have custom content on disk.
allow_from_disk
Clients can load the specified files from disk. They also don't have to match the content on the server. So these files are totally unprotected.
allow_from_disk+check_crc
Clients can load the specified files from disk, but their on-disk files must match the files on the server.

Examples:

materials\models\player\... allow_from_disk
sounds\... from_steam
models\MyMod\... allow_from_disk+check_crc
materials\MyMod\Customizable\*.* allow_from_disk
materials\models\props\cs_assault\wirepipe.vtf from_steam

Note: The default pure_server_whitelist.txt file that ships with the Source Engine comes with generic default settings, so even if you don't modify the default pure_server_whitelist.txt file, sv_pure 1 will still enforce most content. It is a good starting point if you need to create your own.

Here is the default pure_server_whitelist.txt file:

Code: Select all

whitelist
{
	//
	// 3 modifiers are allowed on file specifications:
	//
	//	from_steam			- only check the Steam cache for the file (ignore anything on disk)
	//	allow_from_disk		- allow the file to come from disk
	//	check_crc			- used with allow_from_disk - server does CRC checks on the client's file to make sure it matches
	//
	//	The default modifier on all files is allow_from_disk. Thus, all files can come from disk and don't need CRC checks unless 
	//	allow_from_disk can be set at the same time as check_crc. Use the + character in between them to signify this: allow_from_disk+check_crc.


	//
	// Three types of file specifications:
	//
	//	1. directory\*.*			- refers to all files under the directory
	//	2. directory\...			- refers to all files under the directory and all directories under that (recursively)
	//	3. directory\filename		- refers to a single file
	

	//	
	// By default, when in pure server mode, most content file types are only allowed to come from Steam.
	//
	materials\...		from_steam
	models\...			from_steam
	sound\...			from_steam
	
	
	//
	// Allow custom player models. Don't do CRC checks on them because the clients may all
	// have different custom models and the server won't have them all.
	//	
	models\player\...			allow_from_disk
	materials\models\player\...	allow_from_disk

	//
	// Allow custom spray decals.
	//
	materials\temp\...			allow_from_disk
	materials\vgui\logos\...	allow_from_disk
	materials\vgui\logos\ui\...	allow_from_disk
	
	
	//
	// (Uncomment and edit these for mods).
	// Allow mod resources to come from disk.
	//
	// materials\mymod\...		allow_from_disk+check_crc
	// models\mymod\...			allow_from_disk+check_crc
	// sound\mymod\...			allow_from_disk+check_crc
}
[/size]
Image
Post Reply