security_manager.h 5.6 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
/*
 * security_manager.h: Internal security manager API
 *
 * Copyright (C) 2010-2011 Red Hat, Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
 *
 * Author: Daniel P. Berrange <berrange@redhat.com>
 */

#ifndef VIR_SECURITY_MANAGER_H__
# define VIR_SECURITY_MANAGER_H__

# define virSecurityReportError(code, ...)                          \
27
    virReportErrorHelper(VIR_FROM_SECURITY, code, __FILE__,         \
28 29 30 31 32 33 34
                         __FUNCTION__, __LINE__, __VA_ARGS__)


typedef struct _virSecurityManager virSecurityManager;
typedef virSecurityManager *virSecurityManagerPtr;

virSecurityManagerPtr virSecurityManagerNew(const char *name,
35
                                            const char *virtDriver,
36 37 38
                                            bool allowDiskFormatProbing,
                                            bool defaultConfined,
                                            bool requireConfined);
39 40 41 42

virSecurityManagerPtr virSecurityManagerNewStack(virSecurityManagerPtr primary,
                                                 virSecurityManagerPtr secondary);

43 44
virSecurityManagerPtr virSecurityManagerNewDAC(const char *virtDriver,
                                               uid_t user,
45 46
                                               gid_t group,
                                               bool allowDiskFormatProbing,
47 48
                                               bool defaultConfined,
                                               bool requireConfined,
49 50 51 52 53 54
                                               bool dynamicOwnership);

void *virSecurityManagerGetPrivateData(virSecurityManagerPtr mgr);

void virSecurityManagerFree(virSecurityManagerPtr mgr);

55
const char *virSecurityManagerGetDriver(virSecurityManagerPtr mgr);
56 57 58
const char *virSecurityManagerGetDOI(virSecurityManagerPtr mgr);
const char *virSecurityManagerGetModel(virSecurityManagerPtr mgr);
bool virSecurityManagerGetAllowDiskFormatProbing(virSecurityManagerPtr mgr);
59 60
bool virSecurityManagerGetDefaultConfined(virSecurityManagerPtr mgr);
bool virSecurityManagerGetRequireConfined(virSecurityManagerPtr mgr);
61 62

int virSecurityManagerRestoreImageLabel(virSecurityManagerPtr mgr,
63
                                        virDomainDefPtr def,
64
                                        virDomainDiskDefPtr disk);
65
int virSecurityManagerSetDaemonSocketLabel(virSecurityManagerPtr mgr,
66
                                           virDomainDefPtr vm);
67
int virSecurityManagerSetSocketLabel(virSecurityManagerPtr mgr,
68
                                     virDomainDefPtr def);
69
int virSecurityManagerClearSocketLabel(virSecurityManagerPtr mgr,
70
                                       virDomainDefPtr def);
71
int virSecurityManagerSetImageLabel(virSecurityManagerPtr mgr,
72
                                    virDomainDefPtr def,
73 74
                                    virDomainDiskDefPtr disk);
int virSecurityManagerRestoreHostdevLabel(virSecurityManagerPtr mgr,
75
                                          virDomainDefPtr def,
76 77
                                          virDomainHostdevDefPtr dev);
int virSecurityManagerSetHostdevLabel(virSecurityManagerPtr mgr,
78
                                      virDomainDefPtr def,
79 80
                                      virDomainHostdevDefPtr dev);
int virSecurityManagerSetSavedStateLabel(virSecurityManagerPtr mgr,
81
                                         virDomainDefPtr def,
82 83
                                         const char *savefile);
int virSecurityManagerRestoreSavedStateLabel(virSecurityManagerPtr mgr,
84
                                             virDomainDefPtr def,
85 86
                                             const char *savefile);
int virSecurityManagerGenLabel(virSecurityManagerPtr mgr,
87
                               virDomainDefPtr sec);
88
int virSecurityManagerReserveLabel(virSecurityManagerPtr mgr,
89 90
                                   virDomainDefPtr sec,
                                   pid_t pid);
91
int virSecurityManagerReleaseLabel(virSecurityManagerPtr mgr,
92
                                   virDomainDefPtr sec);
93
int virSecurityManagerSetAllLabel(virSecurityManagerPtr mgr,
94
                                  virDomainDefPtr sec,
95 96
                                  const char *stdin_path);
int virSecurityManagerRestoreAllLabel(virSecurityManagerPtr mgr,
97
                                      virDomainDefPtr def,
98 99
                                      int migrated);
int virSecurityManagerGetProcessLabel(virSecurityManagerPtr mgr,
100 101
                                      virDomainDefPtr def,
                                      pid_t pid,
102 103
                                      virSecurityLabelPtr sec);
int virSecurityManagerSetProcessLabel(virSecurityManagerPtr mgr,
104
                                      virDomainDefPtr def);
105 106
int virSecurityManagerVerify(virSecurityManagerPtr mgr,
                             virDomainDefPtr def);
107
int virSecurityManagerSetImageFDLabel(virSecurityManagerPtr mgr,
108
                                      virDomainDefPtr def,
109
                                      int fd);
110 111

#endif /* VIR_SECURITY_MANAGER_H__ */