Dobby 3.0
Dobby “Docker based Thingy” is a tool for managing and running OCI containers using crun
Loading...
Searching...
No Matches
DobbyFileAccessFixer.h
1/*
2* If not stated otherwise in this file or this component's LICENSE file the
3* following copyright and licenses apply:
4*
5* Copyright 2016 Sky UK
6*
7* Licensed under the Apache License, Version 2.0 (the "License");
8* you may not use this file except in compliance with the License.
9* You may obtain a copy of the License at
10*
11* http://www.apache.org/licenses/LICENSE-2.0
12*
13* Unless required by applicable law or agreed to in writing, software
14* distributed under the License is distributed on an "AS IS" BASIS,
15* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16* See the License for the specific language governing permissions and
17* limitations under the License.
18*/
19/*
20 * File: DobbyFileAccessFixer.h
21 *
22 */
23#ifndef DOBBYFILEACCESSFIXER_H
24#define DOBBYFILEACCESSFIXER_H
25
26#include <ftw.h>
27#include <sys/stat.h>
28#include <sys/types.h>
29
30
31// -----------------------------------------------------------------------------
49{
50public:
53
54public:
55 bool fixIt() const;
56
57private:
58 bool fixDobbyInitPerms() const;
59 bool fixOptRuntimePerms() const;
60 bool fixGfxDriverPerms() const;
61 bool fixCoreDumpFilter() const;
62
63private:
64 static void chmodFile(const char* filePath, mode_t oldPerms, mode_t newPerms);
65 static int fixRuntimePerms(const char* filePath, const struct stat* statBuf,
66 int typeFlag, struct FTW* ftwbuf);
67
68};
69
70
71#endif // !defined(DOBBYFILEACCESSFIXER_H)
Utility object to fix the various incorrectly 'hardened' file permissions.
Definition DobbyFileAccessFixer.h:49
bool fixDobbyInitPerms() const
Fixes the access perms on /opt/libexec/DobbyInit.
Definition DobbyFileAccessFixer.cpp:83
bool fixGfxDriverPerms() const
Fixes the perms on the opengl dev nodes.
Definition DobbyFileAccessFixer.cpp:222
bool fixCoreDumpFilter() const
Fixes the core pattern filter.
Definition DobbyFileAccessFixer.cpp:320
static int fixRuntimePerms(const char *filePath, const struct stat *statBuf, int typeFlag, struct FTW *ftwbuf)
Callback from the nftw() function for the directory walk.
Definition DobbyFileAccessFixer.cpp:120
bool fixOptRuntimePerms() const
Fixes the access perms on everything in /opt/runtimes.
Definition DobbyFileAccessFixer.cpp:193