Add ulimit module.
A new module that provides a define to add a file to /etc/security/limits.d for each limit line defined. This can be used to limit the number of processes a user can have. Change-Id: I7d1074ec85dbf3e212c0eccbe4e6e926b56f561c
This commit is contained in:
		
							
								
								
									
										17
									
								
								modules/ulimit/manifests/conf.pp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								modules/ulimit/manifests/conf.pp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,17 @@
 | 
				
			|||||||
 | 
					define ulimit::conf (
 | 
				
			||||||
 | 
					  $limit_domain,
 | 
				
			||||||
 | 
					  $limit_item,
 | 
				
			||||||
 | 
					  $limit_value,
 | 
				
			||||||
 | 
					  $limit_type = 'soft',
 | 
				
			||||||
 | 
					) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  file { "/etc/security/limits.d/99-${limit_domain}-${limit_type}-${limit_item}.conf":
 | 
				
			||||||
 | 
					    ensure  => present,
 | 
				
			||||||
 | 
					    content => template('ulimit/limits.erb'),
 | 
				
			||||||
 | 
					    replace => true,
 | 
				
			||||||
 | 
					    owner   => 'root',
 | 
				
			||||||
 | 
					    mode    => 0644,
 | 
				
			||||||
 | 
					    require => File['/etc/security/limits.d']
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										13
									
								
								modules/ulimit/manifests/init.pp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								modules/ulimit/manifests/init.pp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
				
			|||||||
 | 
					class ulimit {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  package { ['libpam-modules', 'libpam-modules-bin']:
 | 
				
			||||||
 | 
					    ensure => present
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  file { '/etc/security/limits.d':
 | 
				
			||||||
 | 
					    ensure => directory,
 | 
				
			||||||
 | 
					    owner  => 'root',
 | 
				
			||||||
 | 
					    mode   => 0755
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										2
									
								
								modules/ulimit/templates/limits.erb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								modules/ulimit/templates/limits.erb
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,2 @@
 | 
				
			|||||||
 | 
					# This file is managed by puppet. Manual changes will be ignored.
 | 
				
			||||||
 | 
					<%= limit_domain %> <%= limit_type %> <%= limit_item %> <%= limit_value %>
 | 
				
			||||||
		Reference in New Issue
	
	Block a user