Can anyone tell me why this works.
# OPENDKIM TRUSTED HOSTS
# To use this file, uncomment the #ExternalIgnoreList and/or the InternalHosts
# option in /etc/opendkim.conf then restart OpenDKIM. Additional hosts
# may be added on separate lines (IP addresses, hostnames, or CIDR ranges).
# The localhost IP (127.0.0.1) should always be the first entry in this file.
127.0.0.1
137.99.0.0/16
::1
#host.example.com
#192.168.1.0/24
Even though documentation says "hostnames" are allowed this fails to have Postfix sign the email.
# OPENDKIM TRUSTED HOSTS
# To use this file, uncomment the #ExternalIgnoreList and/or the #InternalHosts
# option in /etc/opendkim.conf then restart OpenDKIM. Additional hosts
# may be added on separate lines (IP addresses, hostnames, or CIDR ranges).
# The localhost IP (127.0.0.1) should always be the first entry in this file.
127.0.0.1
#137.99.0.0/16
::1
appmail.uconn.edu
#host.example.com
#192.168.1.0/24
I send emails from T-bird with an IMAP account and FROM= alf02013#appmail.uconn.edu
thank you.
-Angelo
Make sure your file that looks like this:
127.0.0.1
hostname1.example1.com
example1.com
hostname1.example2.com
example2.com
The TrustedHosts file tells OpenDKIM who to let use your keys. Because it's referenced by the ExternalIgnoreList directive in your conf file, OpenDKIM will ignore this list of hosts when verifying incoming mail and because it's also referenced by the InternalHosts directive, this same list of hosts will be considered "internal," and OpenDKIM will sign their outgoing mail.
IMPORTANT: Make sure you list the IP address for localhost (127.0.0.1) in the TrustedHosts file or OpenDKIM won't sign mail sent from this server. If you have multiple servers on the same network that relay mail through this server and you want to sign their mail as well, they must be listed in the TrustedHosts file. Put each entry on its own line. An entry can be a hostname, domain name (e.g. "example.com"), IP address, an IPv6 address (including an IPv4 mapped address), or a CIDR-style IP specification (e.g. "192.168.1.0/24?).
Related
While trying to edit a host file on a ubuntu server, the docs recommend updating the system's host file saying
The hosts file creates static associations between IP addresses and
hostnames or domains which the system prioritizes before DNS for name
resolution. Open this file in a text editor and add a line for your
Linode’s public IP address. You can associate this address with your
Linode’s Fully Qualified Domain Name (FQDN) if you have one, and with
the local hostname you set in the steps above. In the example below,
203.0.113.10 is the public IP address, example-hostname is the local hostname, and example-hostname.example.com is the FQDN.
After opening a SSH connection and running
nano /etc/apache2/apache2.conf
The host file can now be edited. After scrolling to the bottom of the page to add the new lines I looked back at the example in the documentation:
127.0.0.1 localhost.localdomain localhost
203.0.113.10 example-hostname.example.com example-hostname
Is this the correct format?
127.0.0.1 localhost.localdomain localhost
104.123.155.24 newhostuser.104.123.155.24 newhostuser
You can add HostName entry in /etc/hosts file. If you want to run Apache on IP address then you can edit Listen entry in apache2.conf file.
Inside the box, I have two virtual hosts:
<VirtualHost *:80>
HostName my.site1
...
</Virtualhost *:80>
<VirtualHost *:80>
HostName my.site2
...
</VirtualHost>
How can I connect to the vhosts inside the guest from the host? In my (host) /etc/hosts I have:
127.0.0.1 my.site1
127.0.0.1 my.site2
Because of the Vagrant's port mapping, the guest is accessible only as my.site1:port, e.g., my.site:3000. With that, the Apache inside the guest takes me just to the root (the Apache's welcome site). It is the same for both vhosts: my.site1:3000 and my.site2:3000.
apachectl -S logs:
VirtualHost configuration:
*:80 is a NameVirtualHost
default server stretch.localdomain (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost stretch.localdomain (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost my.site1 (/etc/apache2/sites-enabled/001-site1.conf:1)
port 80 namevhost my.site2 (/etc/apache2/sites-enabled/002-site2.conf:1)
Is that because of improper configuration of vhosts or am I missing some point in the name/port or host/guest configuration?
Am I right it should work this way?
my.site1:3000 -> contents of my.site1
my.site2:3000 -> contents of my.site2
Okay, so the problem here is the networking. I was able to reproduce this problem. First of all, please disable the port forwarding in Vagrant. Just comment config.vm.network "forwarded_port", guest: 80, host: 8070 and do a vagrant reload .To get this working, you need to check your host's IP address and then go to your Vagrant file and edit config.vm.network "private_network", ip: "X.X.X.X" so that the ip address here is actually on the same network as your host. What I did is just incremented the last octet by 1. e.g. My local IP address is 192.168.23.45 so I assigned 192.168.23.46 to the Vagrant guest.
Once this is done, perhaps, you can save yourself all the trouble by just using this shell script to create Virtual hosts for yourself. I have pasted the output below which you can go through to see that I have setup my two virtual hosts with mysite1 and mysite2 names.
Then just put the host file entries on your host like below:
192.168.23.46 mysite1
192.168.23.46 mysite2
And accessing the website using http://mysite1 and http://mysite2. You might want to change the content of the index.php placed by script under the respective document roots so that you can be sure that the requests are being handled by correct virtual hosts since this scripts just deals with the default index.php of apache which will be found under both your document roots.
The other option is to make the Vagrant box available on public network and then
access it using the public IP and for that, you will have to enable config.vm.network "public_network" in your Vagrant file and the rest of the process of creating the Virtual host is the same (Using this script).
[root#localhost vagrant]# bash test.sh
Enter the server name your want (without www) : mysite1
Enter a CNAME (e.g. :www or dev for dev.website.com) : mysite1
Enter the path of directory you wanna use (e.g. : /var/www/, dont forget the /): /var/www/mysite1/
Enter the user you wanna use (e.g. : apache) : apache
Enter the listened IP for the server (e.g. : *): *
Web directory created with success !
/etc/httpd/conf.d/mysite1.conf
Virtual host created !
Would you like me to create ssl virtual host [y/n]?
n
Testing configuration
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
Syntax OK
Would you like me to restart the server [y/n]?
y
Redirecting to /bin/systemctl restart httpd.service
======================================
All works done! You should be able to see your website at http://mysite1
Share the love! <3
======================================
Wanna contribute to improve this script? Found a bug? https://gist.github.com/mattmezza/2e326ba2f1352a4b42b8
[root#localhost vagrant]# bash test.sh
Enter the server name your want (without www) : mysite2
Enter a CNAME (e.g. :www or dev for dev.website.com) : mysite2
Enter the path of directory you wanna use (e.g. : /var/www/, dont forget the /): /var/www/mysite2/
Enter the user you wanna use (e.g. : apache) : apache
Enter the listened IP for the server (e.g. : *): *
Web directory created with success !
/etc/httpd/conf.d/mysite2.conf
Virtual host created !
Would you like me to create ssl virtual host [y/n]?
n
Testing configuration
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
Syntax OK
Would you like me to restart the server [y/n]?
y
Redirecting to /bin/systemctl restart httpd.service
======================================
All works done! You should be able to see your website at http://mysite2
Share the love! <3
======================================
Wanna contribute to improve this script? Found a bug? https://gist.github.com/mattmezza/2e326ba2f1352a4b42b8
Please let me know in case you need more clarification.
My web server is resolved from other users outside my internal network. The issue is that it redirects me to the router page on my PC. Anyway to fix this, I have to use a proxy to see my own web server, and it can be dangerous to my privacy and code.
Is there a fix for this?
There is not a fix because that is done for security by your router and since the request is coming back to your router from your ip it will think you are trying to go to your router page so to be able to see the site just follow the following steps:
Go to "C:\Windows\System32\Drivers\Etc" and MOVE the "HOSTS" file to your desktop.
Open it up and follow the steps below but in this example STACKOVERFLOW.COM will be the URL and the local server ip is 192.168.1.255:
# Copyright (c) 1993-1999 Microsoft Corp.
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
192.168.1.255 stackoverflow.com
192.168.1.255 siteb.com
192.168.1.255 sitec.net
Copy all the code above the UNDERSCORE but DONT COPY THE UNDERSCORE.Paste it into your hosts file and change it aroud to suite your needs. Change the ip to your servers local ip and your url to the url u use to connect to the site with. Just make sure you SAVE THE FILE AND MOVE IT BACK TO YOUR ETC FOLDER!
I want to redirect request on my local webserver much like "http://localhost/" redirects to my ServerRoot. I have seen it done with "http://www/" and also with "http://helpdesk/" How would I go about adding my own?
Are you saying you want to redirect something like http://custom to your web server? If so you can do this by creating an entry in your hosts file, or configuring your local DNS server to return local addresses for those hostnames.
Add the following to your hosts file (On *nix /etc/hosts and C:\Windows\System32\drivers\etc\hosts on Windows)
127.0.0.1 custom www.custom
Then you can optionally configure a virtual host on your Apache server to handle requests for those hosts. If you don't create a virtual host, it will just serve up the same content as localhost. You can also have your local webserver host the site and add that entry to your local PC's hosts file and be able to browse it from that hostname as well.
If that isn't what you wanted, can you please clarify your question.
I've got an issue when accessing a web site, I can access it by using the NetBIOS name, but when accessing with the FQDN i get an error.
Any ideas on how to troubleshoot this?
(There is no DNS configured yet, we have modified the Hosts file to enter the related names and IP.)
First, check the obvious: are there any typos in the file?
Next, test out the name resolution. Something simple like pinging the web server by it's FQDN will do. See if the right IP is mentioned.
If you get "unknown host", your client's hosts file does not have an entry for the FQDN you entered (check for typos in the host name), or, for some reason, your computer isn't reading your hosts file.
If you get the wrong IP address, then you have the wrong IP in your hosts file (check for typos in the IP address), your computer's DNS cache is polluted (try: ipconfig /flushdns on a Windows machine), or something else is overriding the lookup (duplicate entries in the hosts file?).
Next up, try communicating with your web server. Using Telnet, speak HTTP to it, and see how it responds:
telnet 192.168.0.1 80
Substitute your web server's IP address instead of 192.168.0.1. Provide the following lines:
GET / HTTP/1.1
Host: fqdn.mywebserver.com
Try the server's IP, server's netbios name, and finally the server's FQDN in place of fqdn.mywebserver.com. Be sure to press return twice after entering the host header.
If the response is different between the netbios name and the FQDN, then it's a web server configuration issue; you need to adjust you virtual host settings (in Apache, the ServerAlias directive should be used to add additonal names. In IIS its in Web Site (tab) -> Advanced (button)).
After that... I'm really out of ideas.
Just to make sure, you have something like this
192.168.100.5 othermachine othermachine.mydomain.local
with both the netbios and the FQDN in it and not just the IP and netbios name?
Assuming, as dragonmantank mentioned above, that the FQDN is in your hosts file, I'd look at whether the web server software itself is configured to accept requests with the FQDN in the Host field.