David Howells | 0b77f5b | 2008-04-29 01:01:32 -0700 | [diff] [blame] | 1 | /* Key management controls |
| 2 | * |
| 3 | * Copyright (C) 2008 Red Hat, Inc. All Rights Reserved. |
| 4 | * Written by David Howells (dhowells@redhat.com) |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public Licence |
| 8 | * as published by the Free Software Foundation; either version |
| 9 | * 2 of the Licence, or (at your option) any later version. |
| 10 | */ |
| 11 | |
| 12 | #include <linux/key.h> |
| 13 | #include <linux/sysctl.h> |
| 14 | #include "internal.h" |
| 15 | |
David Howells | 5d13544 | 2009-09-02 09:14:00 +0100 | [diff] [blame] | 16 | static const int zero, one = 1, max = INT_MAX; |
| 17 | |
Joe Perches | fab71a9 | 2014-04-13 18:55:51 -0700 | [diff] [blame] | 18 | struct ctl_table key_sysctls[] = { |
David Howells | 0b77f5b | 2008-04-29 01:01:32 -0700 | [diff] [blame] | 19 | { |
David Howells | 0b77f5b | 2008-04-29 01:01:32 -0700 | [diff] [blame] | 20 | .procname = "maxkeys", |
| 21 | .data = &key_quota_maxkeys, |
| 22 | .maxlen = sizeof(unsigned), |
| 23 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 24 | .proc_handler = proc_dointvec_minmax, |
David Howells | 5d13544 | 2009-09-02 09:14:00 +0100 | [diff] [blame] | 25 | .extra1 = (void *) &one, |
| 26 | .extra2 = (void *) &max, |
David Howells | 0b77f5b | 2008-04-29 01:01:32 -0700 | [diff] [blame] | 27 | }, |
| 28 | { |
David Howells | 0b77f5b | 2008-04-29 01:01:32 -0700 | [diff] [blame] | 29 | .procname = "maxbytes", |
| 30 | .data = &key_quota_maxbytes, |
| 31 | .maxlen = sizeof(unsigned), |
| 32 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 33 | .proc_handler = proc_dointvec_minmax, |
David Howells | 5d13544 | 2009-09-02 09:14:00 +0100 | [diff] [blame] | 34 | .extra1 = (void *) &one, |
| 35 | .extra2 = (void *) &max, |
David Howells | 0b77f5b | 2008-04-29 01:01:32 -0700 | [diff] [blame] | 36 | }, |
| 37 | { |
David Howells | 0b77f5b | 2008-04-29 01:01:32 -0700 | [diff] [blame] | 38 | .procname = "root_maxkeys", |
| 39 | .data = &key_quota_root_maxkeys, |
| 40 | .maxlen = sizeof(unsigned), |
| 41 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 42 | .proc_handler = proc_dointvec_minmax, |
David Howells | 5d13544 | 2009-09-02 09:14:00 +0100 | [diff] [blame] | 43 | .extra1 = (void *) &one, |
| 44 | .extra2 = (void *) &max, |
David Howells | 0b77f5b | 2008-04-29 01:01:32 -0700 | [diff] [blame] | 45 | }, |
| 46 | { |
David Howells | 0b77f5b | 2008-04-29 01:01:32 -0700 | [diff] [blame] | 47 | .procname = "root_maxbytes", |
| 48 | .data = &key_quota_root_maxbytes, |
| 49 | .maxlen = sizeof(unsigned), |
| 50 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 51 | .proc_handler = proc_dointvec_minmax, |
David Howells | 5d13544 | 2009-09-02 09:14:00 +0100 | [diff] [blame] | 52 | .extra1 = (void *) &one, |
| 53 | .extra2 = (void *) &max, |
| 54 | }, |
| 55 | { |
David Howells | 5d13544 | 2009-09-02 09:14:00 +0100 | [diff] [blame] | 56 | .procname = "gc_delay", |
| 57 | .data = &key_gc_delay, |
| 58 | .maxlen = sizeof(unsigned), |
| 59 | .mode = 0644, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 60 | .proc_handler = proc_dointvec_minmax, |
David Howells | 5d13544 | 2009-09-02 09:14:00 +0100 | [diff] [blame] | 61 | .extra1 = (void *) &zero, |
| 62 | .extra2 = (void *) &max, |
David Howells | 0b77f5b | 2008-04-29 01:01:32 -0700 | [diff] [blame] | 63 | }, |
David Howells | f36f8c7 | 2013-09-24 10:35:19 +0100 | [diff] [blame] | 64 | #ifdef CONFIG_PERSISTENT_KEYRINGS |
| 65 | { |
| 66 | .procname = "persistent_keyring_expiry", |
| 67 | .data = &persistent_keyring_expiry, |
| 68 | .maxlen = sizeof(unsigned), |
| 69 | .mode = 0644, |
| 70 | .proc_handler = proc_dointvec_minmax, |
| 71 | .extra1 = (void *) &zero, |
| 72 | .extra2 = (void *) &max, |
| 73 | }, |
| 74 | #endif |
Eric W. Biederman | 5cdb355 | 2009-04-03 05:08:03 -0700 | [diff] [blame] | 75 | { } |
David Howells | 0b77f5b | 2008-04-29 01:01:32 -0700 | [diff] [blame] | 76 | }; |