1 | # Refresher on FRED |
---|
2 | |
---|
3 | Remember the prerequisites for creating objects in the Fred DB |
---|
4 | (from https://fred.nic.cz/page/2906/installation-ubuntu/ and |
---|
5 | https://fred.nic.cz/page/699/fred-client-how-to/ |
---|
6 | |
---|
7 | 1. Make sure you have an existing contact, or create one |
---|
8 | 2. Make sure you have an NS-set, or create one, and associate it to |
---|
9 | the contact |
---|
10 | 3. Once the above are fulfilled, you can create a domain, referencing |
---|
11 | the contact and NS-set |
---|
12 | |
---|
13 | From the Ubuntu installation above, you remember running this command |
---|
14 | near the end: |
---|
15 | |
---|
16 | `genzone_client` |
---|
17 | |
---|
18 | ... if you remember, this automatically generated (created and wrote |
---|
19 | the contents) all the zones to disk. |
---|
20 | |
---|
21 | Let's create a place where we can export our zones: |
---|
22 | |
---|
23 | ~~~ |
---|
24 | cd |
---|
25 | mkdir zones |
---|
26 | cd zones |
---|
27 | pwd |
---|
28 | ~~~ |
---|
29 | |
---|
30 | The 4 commands above make sure you that: |
---|
31 | |
---|
32 | - you are in your home directory (`cd`) |
---|
33 | - a directory "zones" exist (`mkdir zones`) |
---|
34 | - you change the current working directory to "zones" (`cd zones`) |
---|
35 | - you verify that you are indeed placed inside this directory (`pwd`) |
---|
36 | |
---|
37 | Once you've done this, let's run the `genzone_client`: |
---|
38 | |
---|
39 | ~~~ |
---|
40 | genzone_client |
---|
41 | ~~~ |
---|
42 | |
---|
43 | Then |
---|
44 | |
---|
45 | ~~~ |
---|
46 | ls -l |
---|
47 | ~~~ |
---|
48 | |
---|
49 | ... you should see at list one file, for the zone of the domain |
---|
50 | for the TLD that was created when you installed FRED. |
---|
51 | |
---|
52 | For example, you may see: |
---|
53 | |
---|
54 | ~~~ |
---|
55 | -rw-rw-r-- 1 sysadm sysadm 719 Jun 1 07:19 db.dk |
---|
56 | ~~~ |
---|
57 | |
---|
58 | # Automate zone generation |
---|
59 | |
---|
60 | Now, we would like to have the above "zone generation" take place |
---|
61 | automatically, so we don't need to remember to do it manually every |
---|
62 | time we make changes in the zone. |
---|
63 | |
---|
64 | To do this, we're going to use `cron`. cron is an automated scheduling |
---|
65 | utility that will run jobs when you tell it to. |
---|
66 | |
---|
67 | Cron takes a very simple format, called a `crontab`, in this form: |
---|
68 | |
---|
69 | ~~~ |
---|
70 | Minute Hour Day-of-Month Month Day-of-Week Command [params] |
---|
71 | ~~~ |
---|
72 | |
---|
73 | For example, if we wanted to say "hello" at 5 minute past the hour |
---|
74 | on every hour, Monday to Friday, we would write: |
---|
75 | |
---|
76 | ~~~ |
---|
77 | 5 * * * * 1-5 echo "hello" |
---|
78 | ~~~ |
---|
79 | |
---|
80 | This reads as: |
---|
81 | |
---|
82 | At 5 minute past the hour, every hour, every day, every month, Mon-Fri, say |
---|
83 | hello. |
---|
84 | |
---|
85 | Let's create a `crontab` for the `genzone_client`, that will automate zone |
---|
86 | generation! |
---|
87 | |
---|
88 | To do this, run the `crontab -e` command: |
---|
89 | |
---|
90 | ~~~ |
---|
91 | crontab -e |
---|
92 | ~~~ |
---|
93 | |
---|
94 | You will probably be asked which editor you want to use the first time: |
---|
95 | |
---|
96 | ~~~ |
---|
97 | no crontab for sysadm - using an empty one |
---|
98 | |
---|
99 | Select an editor. To change later, run 'select-editor'. |
---|
100 | 1. /usr/bin/vim.basic |
---|
101 | 2. /usr/bin/vim.tiny |
---|
102 | |
---|
103 | Choose 1-2 []: |
---|
104 | ~~~ |
---|
105 | |
---|
106 | Pick 1 or 2 -- and you will be brought into a `vi` editor, with some |
---|
107 | text. Go to the bottom, and add the following line: |
---|
108 | |
---|
109 | ~~~ |
---|
110 | */5 * * * * cd /home/sysadm/zones && genzone_client |
---|
111 | ~~~ |
---|
112 | |
---|
113 | (Copy-pasting the above line is probably the easiest!) |
---|
114 | |
---|
115 | The above reads as: |
---|
116 | |
---|
117 | Every 5 minutes of every hour, every day, every month, all weekdays, run |
---|
118 | the commands "`cd /home/sysadm/zones && genzone_client`" |
---|
119 | |
---|
120 | Once you've added the line, save the file and exit. You should see: |
---|
121 | |
---|
122 | ~~~ |
---|
123 | crontab: installing new crontab |
---|
124 | ~~~ |
---|
125 | |
---|
126 | Now instead of waiting 5 minutes, let's start configure BIND! |
---|
127 | |
---|
128 | <!-- Markdeep: --><style class="fallback">body{visibility:hidden;white-space:pre;font-family:monospace}</style><script src="markdeep.min.js"></script><script src="https://casual-effects.com/markdeep/latest/markdeep.min.js"></script><script>window.alreadyProcessedMarkdeep||(document.body.style.visibility="visible")</script> |
---|