christian baltini
2024-Jun-28 20:07 UTC
[Samba] Looking for Python docs/examples to modify DNS via keytab
Hello all, I am looking to rewrite the shell script here (https://wiki.samba.org/index.php/Configure_DHCP_to_update_DNS_records) in Python. Is anyone aware of any resources (docs, existing code, etc.) that may be useful in doing so? I?m not finding any introductory docs or simple code examples that show things like instantiating a DNS server connection with a keytab. Thanks, CB
David Mulder
2024-Jun-29 08:11 UTC
[Samba] Looking for Python docs/examples to modify DNS via keytab
On 6/28/24 10:07 PM, christian baltini via samba wrote:> Hello all, > > I am looking to rewrite the shell script here (https://wiki.samba.org/index.php/Configure_DHCP_to_update_DNS_records) in Python. > > Is anyone aware of any resources (docs, existing code, etc.) that may be useful in doing so? I?m not finding any introductory docs or simple code examples that show things like instantiating a DNS server connection with a keytab.It's a bit awkward, but you can import and call the samba-tool commands directly within Python (samba-tool of course is written in Python). See an example of this hack here: https://github.com/yast/yast2-dns-manager/blob/master/src/modules/SambaToolDnsAPI.py This example uses username/password for auth, but the CredentialsOptions parser can be instructed to use the keytab, IIUC: https://gitlab.com/samba-team/samba/-/blob/master/python/samba/getopt.py?ref_type=heads#L384 If you don't like this hacky approach, you could re-implement something using the same calls made by samba-tool: https://gitlab.com/samba-team/samba/-/blob/master/python/samba/netcmd/dns.py?ref_type=heads This is probably a more appropriate approach, but a bit more work. -- David Mulder Labs Software Engineer, Samba SUSE 1221 S Valley Grove Way, Suite 500 Pleasant Grove, UT 84062 (P)+1 385.208.2989 dmulder at suse.com http://www.suse.com
Rowland Penny
2024-Jun-29 08:29 UTC
[Samba] Looking for Python docs/examples to modify DNS via keytab
On Fri, 28 Jun 2024 13:07:06 -0700 christian baltini via samba <samba at lists.samba.org> wrote:> Hello all, > > I am looking to rewrite the shell script here > (https://wiki.samba.org/index.php/Configure_DHCP_to_update_DNS_records) > in Python.Basically most of that script is written to check if a kerberos ticket exists and is current and then the ticket is used with samba-tool to carry out deletions/additions, so it might be worth while examining the relevant samba-tool code. Your main problem is going to be is that the isc-dhcp-server (that triggers the bash script) is now EOL, what were you thinking of replacing it with ? Rowland
Possibly Parallel Threads
- Looking for Python docs/examples to modify DNS via keytab
- Looking for Python docs/examples to modify DNS via keytab
- Looking for Python docs/examples to modify DNS via keytab
- Looking for Python docs/examples to modify DNS via keytab
- Looking for Python docs/examples to modify DNS via keytab