mirror of
https://github.com/altlinux/gpupdate.git
synced 2025-08-25 09:49:53 +03:00
gpupdate-setup: add support domain_controller local policy profile
This commit is contained in:
10
dist/gpupdate-setup
vendored
10
dist/gpupdate-setup
vendored
@ -25,6 +25,9 @@ import subprocess
|
|||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
from gpoa.util.samba import smbopts
|
||||||
|
|
||||||
|
|
||||||
def command(args):
|
def command(args):
|
||||||
try:
|
try:
|
||||||
subprocess.check_call(args.split())
|
subprocess.check_call(args.split())
|
||||||
@ -44,6 +47,13 @@ def from_command(args):
|
|||||||
|
|
||||||
def get_default_policy_name():
|
def get_default_policy_name():
|
||||||
localpolicy = 'workstation'
|
localpolicy = 'workstation'
|
||||||
|
dcpolicy = 'ad-domain-controller'
|
||||||
|
|
||||||
|
try:
|
||||||
|
if smbopt.get_server_role() == 'active directory domain controller':
|
||||||
|
return dcpolicy
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
release = '/etc/altlinux-release'
|
release = '/etc/altlinux-release'
|
||||||
|
38
gpoa/util/samba.py
Normal file
38
gpoa/util/samba.py
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#
|
||||||
|
# GPOA - GPO Applier for Linux
|
||||||
|
#
|
||||||
|
# Copyright (C) 2019-2020 BaseALT Ltd.
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program 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 General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
import optparse
|
||||||
|
from samba import getopt as options
|
||||||
|
|
||||||
|
|
||||||
|
class smbopts:
|
||||||
|
|
||||||
|
def __init__(self, prog=None):
|
||||||
|
self.parser = optparse.OptionParser(prog)
|
||||||
|
self.sambaopts = options.SambaOptions(self.parser)
|
||||||
|
self.lp = self.sambaopts.get_loadparm()
|
||||||
|
|
||||||
|
def get_cache_dir(self):
|
||||||
|
return self._get_prop('cache directory')
|
||||||
|
|
||||||
|
def get_server_role(self):
|
||||||
|
return self._get_prop('server role')
|
||||||
|
|
||||||
|
def _get_prop(self, property_name):
|
||||||
|
return self.lp.get(property_name)
|
@ -21,7 +21,6 @@ import logging
|
|||||||
import os
|
import os
|
||||||
import pwd
|
import pwd
|
||||||
|
|
||||||
import optparse
|
|
||||||
from samba import getopt as options
|
from samba import getopt as options
|
||||||
|
|
||||||
from samba.gpclass import get_dc_hostname, check_refresh_gpo_list
|
from samba.gpclass import get_dc_hostname, check_refresh_gpo_list
|
||||||
@ -33,15 +32,14 @@ from storage import cache_factory
|
|||||||
from .xdg import get_user_dir
|
from .xdg import get_user_dir
|
||||||
from .util import get_homedir
|
from .util import get_homedir
|
||||||
from .logging import slogm
|
from .logging import slogm
|
||||||
|
from .samba import smbopts
|
||||||
|
|
||||||
|
|
||||||
class smbcreds:
|
class smbcreds (smbopts):
|
||||||
|
|
||||||
def __init__(self, dc_fqdn=None):
|
def __init__(self, dc_fqdn=None):
|
||||||
self.parser = optparse.OptionParser('GPO Applier')
|
smbopts.__init__(self, 'GPO Applier')
|
||||||
self.sambaopts = options.SambaOptions(self.parser)
|
|
||||||
self.credopts = options.CredentialsOptions(self.parser)
|
self.credopts = options.CredentialsOptions(self.parser)
|
||||||
self.lp = self.sambaopts.get_loadparm()
|
|
||||||
self.creds = self.credopts.get_credentials(self.lp, fallback_machine=True)
|
self.creds = self.credopts.get_credentials(self.lp, fallback_machine=True)
|
||||||
self.selected_dc = self.set_dc(dc_fqdn)
|
self.selected_dc = self.set_dc(dc_fqdn)
|
||||||
|
|
||||||
@ -87,9 +85,6 @@ class smbcreds:
|
|||||||
|
|
||||||
return dns_domainname
|
return dns_domainname
|
||||||
|
|
||||||
def get_cache_dir(self):
|
|
||||||
return self._get_prop('cache directory')
|
|
||||||
|
|
||||||
def get_gpos(self, username):
|
def get_gpos(self, username):
|
||||||
'''
|
'''
|
||||||
Get GPO list for the specified username for the specified DC
|
Get GPO list for the specified username for the specified DC
|
||||||
@ -125,9 +120,6 @@ class smbcreds:
|
|||||||
username, self.selected_dc)))
|
username, self.selected_dc)))
|
||||||
return gpos
|
return gpos
|
||||||
|
|
||||||
def _get_prop(self, property_name):
|
|
||||||
return self.lp.get(property_name)
|
|
||||||
|
|
||||||
|
|
||||||
def wbinfo_getsid(domain, user):
|
def wbinfo_getsid(domain, user):
|
||||||
'''
|
'''
|
||||||
|
Reference in New Issue
Block a user