Sponsored Content
Top Forums Shell Programming and Scripting Shell/Perl Script to edit dhcpd.conf Post 302096900 by sahilb on Monday 20th of November 2006 10:01:09 AM
Old 11-20-2006
Shell/Perl Script to edit dhcpd.conf

Hi,
I need to get a script together to edit the dhcp service configuration file dhcpd.conf.

Mac addresses are defined in classes ex.
class "HOST1" { match if substring (hardware, 1,18)=00:11:11:FF:FF:FF;}
class "HOST2" ...
class "HOST3" ...
...

followed by allow or deny statements:
deny members of "HOST1";
allow members of "HOST2";
...
...

The script should search for the MAC address entered by the user and if found should deny that class by changing allow to deny in the statement for that class and/or deleting the class.
If not found it should create a class with the given MAC address and add a deny statement for that class in the above given format.

I would appreciate any ideas or help...

Thanks

SB
 

10 More Discussions You Might Find Interesting

1. Linux

dhcpd.conf

I have intall a REdhat 9.0 as a server and Ive configure to act as a DHCP however Im having technical problems b/c the file /etc/dhcpd.conf does not exists. I went to the text edit and I created : subnet 192.192.168.100.0 netmask 255.255.255.0 { range 192.168.100.10 192.168.100.150;... (1 Reply)
Discussion started by: keliy1
1 Replies

2. UNIX for Dummies Questions & Answers

Cannot edit inetd.conf???

I'm trying to edit the inetd.conf but for some reason when I vi into it, it says "Read Only" even though I am root and the perms are 777?!? (2 Replies)
Discussion started by: shorty
2 Replies

3. Linux

dhcpd.conf - static route

Hi, I've setup DHCP Server on RH linux AS3 and everything works fine except static routes. They are not getting effected on client systems. My dhcpd.conf: +++++++++++ ddns-update-style interim; ddns-updates off; option domain-name-servers 192.168.116.122; option domain-name... (3 Replies)
Discussion started by: prvnrk
3 Replies

4. Shell Programming and Scripting

help on a perl script to edit file

Hi, sample file looks like this.. <hp> <name> <detail>adsg</detail> ... ... </name><ft>4264</ft> </hp> I need to edit the last but one line using perl script. I want the format to be .. <hp> <name> <detail>adsg</detail> ... ... </name> (9 Replies)
Discussion started by: meghana
9 Replies

5. Shell Programming and Scripting

shell script to edit a file

i have a file called number which contains data as 1 2 3 4 5 6 7 8 9 0 9 8 7 6 5 4 3 2 1 0 0 1 2 3 4 needed a shell script to print the output as 1 7 7 1 4 and (2 Replies)
Discussion started by: jacky29
2 Replies

6. UNIX for Dummies Questions & Answers

edit /etc/syslog.conf (Solaris 10)

Hi, Im editing the file /etc/syslog.conf for Solaris 10 server in production. I need to add "auth and authpriv.": someone set the same? Have been successful? I would appreciate any suggestions. Greetings. The unmodified arhive is: (0 Replies)
Discussion started by: musul
0 Replies

7. Shell Programming and Scripting

Help with Perl to change dhcpd.conf file

Hi all, I am too new for this stuff and i am lost in perl tutorials. I need help to change dhcp entries in .conf file with a perl script. The file entries are like below : host bertha-clp-0 { hardware ethernet AA:0A:A0:00:6c:40; fixed-address 10.10.10.72; option... (6 Replies)
Discussion started by: ekckabatop
6 Replies

8. Shell Programming and Scripting

Shell Script to check dhcp conf file

Hi, I have to prepare a script to check the dhcp conf file. The script has to check for a specific parameter called circuit ID. If the Circuit ID is unique it should show the output that it is unique and if it is duplicate it should show that the Circuit ID is duplicate. I have prepared the... (4 Replies)
Discussion started by: Crazy_Nix
4 Replies

9. Shell Programming and Scripting

Listing IPs from the dhcpd.conf

Hy everybody, Within a dhcpd.conf file, we got some fixed IP adresses from 192.168.0.1 - 192.168.0.254. Sample: #ddns-update-style interim; ddns-update-style none; ignore client-updates; deny client-updates; authoritative; #### By red for PXE Booting allow booting; allow bootp; ###... (17 Replies)
Discussion started by: hermouche
17 Replies

10. UNIX for Beginners Questions & Answers

Changes in dhcpd.conf do not make a difference in DHCP service behaviour

Hi Experts, Our DHCP server currently answers the DHCP Discover requests from ServerX. In our dhcpd.conf file there are parameters defined for ServerX. Now we introduced some additional Servers into the network and want them to get service from the same DHCP server. Similar configuration... (13 Replies)
Discussion started by: ekorgur
13 Replies
LOGIN_OK(3)						   BSD Library Functions Manual 					       LOGIN_OK(3)

NAME
auth_ttyok, auth_hostok, auth_timeok -- functions for checking login class based login restrictions LIBRARY
System Utilities Library (libutil, -lutil) SYNOPSIS
#include <sys/types.h> #include <time.h> #include <login_cap.h> int auth_ttyok(login_cap_t *lc, const char *tty); int auth_hostok(login_cap_t *lc, const char *host, char const *ip); int auth_timeok(login_cap_t *lc, time_t t); DESCRIPTION
This set of functions checks to see if login is allowed based on login class capability entries in the login database, login.conf(5). The auth_ttyok() function checks to see if the named tty is available to users of a specific class, and is either in the ttys.allow access list, and not in the ttys.deny access list. An empty ttys.allow list (or if no such capability exists for the given login class) logins via any tty device are allowed unless the ttys.deny list exists and is non-empty, and the device or its tty group (see ttys(5)) is not in the list. Access to ttys may be allowed or restricted specifically by tty device name, a device name which includes a wildcard (e.g. ttyD* or cuaD*), or may name a ttygroup, when group=<name> tags have been assigned in /etc/ttys. Matching of ttys and ttygroups is case sensitive. Passing a NULL or empty string as the tty parameter causes the function to return a non-zero value. The auth_hostok() function checks for any host restrictions for remote logins. The function checks on both a host name and IP address (given in its text form, typically n.n.n.n) against the host.allow and host.deny login class capabilities. As with ttys and their groups, wildcards and character classes may be used in the host allow and deny capability records. The fnmatch(3) function is used for matching, and the matching on hostnames is case insensitive. Note that this function expects that the hostname is fully expanded (i.e., the local domain name added if necessary) and the IP address is in its canonical form. No hostname or address lookups are attempted. It is possible to call this function with either the hostname or the IP address missing (i.e. NULL) and matching will be performed only on the basis of the parameter given. Passing NULL or empty strings in both parameters will result in a non-zero return value. The auth_timeok() function checks to see that a given time value is within the times.allow login class capability and not within the times.deny access lists. An empty or non-existent times.allow list allows access at any time, except if a given time is falls within a period in the times.deny list. The format of time period records contained in both times.allow and times.deny capability fields is explained in detail in the login_times(3) manual page. RETURN VALUES
A non-zero return value from any of these functions indicates that login access is granted. A zero return value means either that the item being tested is not in the allow access list, or is within the deny access list. SEE ALSO
getcap(3), login_cap(3), login_class(3), login_times(3), login.conf(5), termcap(5) BSD
January 2, 1997 BSD
All times are GMT -4. The time now is 12:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy