nutballs

using

PHP

  on a LAMP box. The box will have

apache

  and DNS, though I have no idea what DNS to use (BIND?).

Can someone give me a pointer/example/link to show me how to create a website and associated DNS entries via

PHP

 ? I can't seem to figure out the correct thing to search for in the big G.

vsloathe

Sorry, I don't have any examples.

I can offer some simple perspective though: Everything in *nix is a file, so theoretically all you need to do is give

PHP

  write perms on the file associated with your DNS bindings, and have it write out whatever you need. Word of caution of course, back up your DNS entries before screwing with it, as you could royally mess up the syntax/format of the files and have to start all over. Don't know, I've never done it, but it seems straightforward enough. Best of luck to you.

jammaster82

WARNING:  I SERIOUSLY DONT KNOW WHAT IM TALKING ABOUT
AT ALL JUST CUTTING MY TEETH SO GRAIN OF SALT HERE...

i find my dns name when i do an 'ifconfig -all'  from the command line.

mine is hr.cox

.net

 

Does this excerpt from

http://www.

ubuntu

 geek.com/

ubuntu

 -710-gutsy-gibbon-lamp-server-setup.html

help?


Configuring Static ip address in

Ubuntu

  server

Ubuntu

  installer has configured our system to get its

net

 work settings via DHCP, Now we will change that to a static IP address for this you need to edit Edit /etc

/net

 work/interfaces and enter your ip address details (in this example setup I will use the IP address 172.19.0.10):

sudo vi /etc

/net

 work/interfaces

and enter the following save the file and exit

# The primary

net

 work interface

auto eth0
iface eth0

inet

  static
address 172.19.0.10
>net mask 255.255.255.0
>net work 172.19.0.0
broadcast 172.19.0.255
gateway 172.19.0.1



You need to setup manually DNS servers in resolv.conf file when you are not using DHCP.

sudo vi /etc/resolv.conf

You need to add look something like this

search domain.com

nameserver xxx.xxx.xxx.xxx

nutballs

yea, i figured all of it is files and I just need to edit it. I found the files, i understand the syntax, sort of, now I gotta figure out how to do it... lol

@jam, the ips of the

mac

 hine are what your talking about which is no problem. This is assigning IPs to websites, which is via the DNS server. thanks though.

perkiset

Hey Nuts -

I got tagged by a nasty DDOS against DNS on my boxes years ago (yes, they were spammy) ... named is reasonably easy and the new stuff is supposed to be more robust, but since I got hit I outsource DNS services to my ISP.

Here is an example of a config file for named, just in case you want to see another: (this is ancient and no longer in production...) you are correct that it is all file based, but you will need to execute a kill -HUP (hangup) to tell the daemon to reset... this will (OR REALLY SHOULD BE) only doable by root or a process running as root, so you'll want to be careful how you implement that using

PHP

 , because one way or another, that script is going to have access to things that you'll never want anyone else to see.


$TTL    86400

@      IN      SOA    ns1.me3inc.com. ed.me3inc.com. (
                        2003110500      ; serial
                        10800  ; refresh
                        3600    ; retry
                        86400  ; expire
                        86400 ) ; minimum

                        IN NS          ns1.me3inc.com.
                        IN MX          5 mail.me3inc.com.
ns1                    IN A    216.19.200.xxx
ns2                    IN A    216.19.200.xxx
mail                    IN A    216.19.223.xxx
smtp                    IN A    216.19.200.xxx
rfservices              IN A    216.19.200.xxx
render_rfservices      IN A    192.168.1.116
pureservices            IN A    192.168.1.116
www                    IN A    216.19.200.114
render_centcom          IN A    192.168.1.116
render_pra              IN A    192.168.1.116
render_osprac          IN A    192.168.1.116
render_ospracsite      IN A    192.168.1.116
render_laci            IN A    192.168.1.115
stage_laci              IN A    192.168.1.116
render_affiliates      IN A    192.168.1.116
render_liberty          IN A    192.168.1.116
skis_gms                IN A    216.240.134.xxx
skis_tracking          IN A    216.240.134.xxx
[/pre]


nutballs

cool that looks like what I am after. the DNS service is called "named"?

under windows I just had an

asp

  page that would be called when a new site was created, and that would run a vbscript file. That file would do the restart. Im sure I can do something similar in

linux

 . like a

perl

  file that is not webaccessible, being run by a web page. otherwise, i might just not care anyway, and just let the

php

  do it directly, and have security on the page that does it. automation is key Applause if i lose a box, meh... lol

perkiset

yes - it's short for name daemon. (named). It is almost always distributed with any *nix. It may not be running by default though.

thedarkness

service named reload

these days Perk, at least under RHish OSs.

Zone files are likely to be stored in;

/var/named/chroot/var/named/ as named usually runs in a chroot jail (it has a history of buffer overflow problems) my zone files differ slightly from perk's so the old timer's file may be a little out of date ?  Applause

Under

apache

  you would be looking for the <VirtualHost> section of /etc/httpd/conf/httpd.conf or sometimes a vhosts.conf file in /etc/httpd/conf.d and

apache

  can be asked to reload it's config using the "service" syntax above.

Sing out if you need a hand on this nuts as I have a friend who has a script that does this that I patched for him some time ago, he owes me some favours so I can prolly get a copy.

Cheers,
td

[edit] You also need to look at (and edit) /etc/named.conf [/edit]

nutballs

cool td, thanks for the directions. I still have a few days before I take a stab at this. but when i do Im sure I will have some questions.

perkiset

quote author=thedarkness link=topic=808.msg5568#msg5568 date=1204705996

service named reload

these days Perk, at least under RHish OSs.

Zone files are likely to be stored in;

/var/named/chroot/var/named/ as named usually runs in a chroot jail (it has a history of buffer overflow problems) my zone files differ slightly from perk's so the old timer's file may be a little out of date ?   Applause

Applause Applause Applause Applause Applause
Fish you, punk
Applause Applause Applause Applause Applause

thedarkness

Of course I meant no offence by that remark old fella  Applause

Cheers,
td

perkiset

Course not.

Applause







I assume...  Applause
Applause

arms

i was playing with this a little while, never really followed through but i got a bit familiar with tinydns (which i think is a part of the djbdns package).
after realizing bind's config was conceived by a drunken evil sadist, i tried out tinydns.
it's config is much better suited for adding records automatically.
found these howtos collecting dust in my bookmarks:

http://forums.thepl

anet

 .com/index.

php

 ?showtopic=80021
http://gentoo-wiki.com/HOWTO_Setup_a_DNS_Server_with_DJBDNS
https://store.dwalliance.com/news/view_article.html?article_id=7576a92a47743b7cf5956bd2e4e45539

nutballs

cool i will check out those as well thanks arms

thedarkness

Ahh, D. J. Bernstein. A screaming genius no doubt and the reputation of being a hard ass. I have used qmail for years, keep thinking about changing but can't find a good enough reason. His stuff is 'A' class

My 2c,
td


Perkiset's Place Home   Politics @ Perkiset's