diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 00e15ec7..4f5506bc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,9 +4,10 @@ Mail-in-a-Box is an open source project. Your contributions and pull requests ar ## Development -To start developing Mail-in-a-Box, [clone the repository](https://github.com/mail-in-a-box/mailinabox) and familiarize yourself with the code. +To start developing Mail-in-a-Box, [clone the repository](https://github.com/mail-in-a-box/mailinabox) and familiarize yourself with the code. Then enter into the directory you cloned mailinabox into. $ git clone https://github.com/mail-in-a-box/mailinabox + $ cd mailinabox ### Vagrant and VirtualBox @@ -16,7 +17,9 @@ With Vagrant set up, the following should boot up Mail-in-a-Box inside a virtual $ vagrant up --provision -_If you're seeing an error message about your *IP address being listed in the Spamhaus Block List*, simply uncomment the `export SKIP_NETWORK_CHECKS=1` line in `Vagrantfile`. It's normal, you're probably using a dynamic IP address assigned by your Internet provider–they're almost all listed._ +For possible errors encountered, please follow WhatIDidSoFar file. + + ### Modifying your `hosts` file diff --git a/Vagrantfile b/Vagrantfile index 467fb95e..0e6f0b89 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -19,7 +19,7 @@ Vagrant.configure("2") do |config| export PUBLIC_IP=auto export PUBLIC_IPV6=auto export PRIMARY_HOSTNAME=auto - #export SKIP_NETWORK_CHECKS=1 + export SKIP_NETWORK_CHECKS=1 # Start the setup script. cd /vagrant diff --git a/WhatIDidSoFar.md b/WhatIDidSoFar.md new file mode 100644 index 00000000..3c5a4f1c --- /dev/null +++ b/WhatIDidSoFar.md @@ -0,0 +1,69 @@ +Vagrant commands that you'd need most: +1. _To view the list of vagrant boxes, use `vagrant box list`_ +2. _To initialize a vagrant VM, use `vagrant init boxname`_ +3. _To start a vagrant VM, use `vagrant up`_ +4. _To shut down the vagrant VM, use `vagrant halt ubuntu/bionic64`_ +5. _To remove a vagrant box, use `vagrant box remove `_ + + +UserName and Password + +1. _Generally vagrant created VM's username is `vagrant`, password is `vagrant`_ +2. _hostname/ IP address will be available in +`config.vm.network "private_network", ip: `. _ + + +Errors encountered while setting up MIAB +1. _If you're seeing an error message about your *IP address being listed in the Spamhaus Block List*, +simply uncomment the `export SKIP_NETWORK_CHECKS=1` line in `Vagrantfile`. +It's normal, you're probably using a dynamic IP address assigned by your Internet provider–they're almost all listed._ +2. _If you're seeing an error message such as this `Bash script and /bin/bash^M: bad interpreter: No such file or directory`, + then most likely you're on windows host and your vm is ubuntu. + Then you've to change the format of all .py and .sh files in all the mailinabox directories to Unix (LF)._ +3. _If you're encountering migration error, please add this line *return* in line 216 at setup/migrate.py. +Then after the up --provision command is successful, you gotta uncomment this or remove this line. (Not sure yet)_ +4. _If your vagrant up command is stuck at upgrading to nextcloud, it is because the nextcloud server is either down +or very slow. Check the /tmp folder whether the nextcloud.zip is being downloaded. +If not, download it yourself and paste it in the /tmp folder._ +5. _As your vagrant VM is CLI, to see the contents of 192.168.50.4, do the following._ + + +To make sure that you can view the curl contents in your host machine's browser by executing commands from guest VM CLI, these +are the steps that you gotta follow: +1. _Copy the private key that vagrant generated for you and paste it in .ssh directory (for windows: by default this is the path `C:\\Users\HP\.ssh folder`) with a name_ +2. _Now if you try to login using the following SSH command, + `ssh -i username@hostname or username@ipaddress` +3. _You should be logged in to the vagrant VM_ +4. _CD into the directory /etc/ssh_ +5. _Edit the sshd_config file with sudo permission and uncomment these 3 lines:_ + + `X11Forwarding yes` + + `X11DisplayOffset 10` + + `X11UseLocalhost yes` +6. _Now restart the sshd service by the following command:_ + `sudo systemctl restart sshd` +7. _logout from your account_ +8. _If you're in ubuntu host, then do the following:_ + `ssh -X -i username@hostname or username@ipaddress` + _you should be logged into the host as username. type `echo $DISPLAY` and see whether `localhost=10.0.0` comes up or not. + If it does, then X11Forwarding is enabled. Now type firefox in your terminal + and you should see the output in firefox browser in your ubuntu host machine +9. _If you're in windows host, install XMing and Putty_ + + a) _Open Puttygen app and from conversions -> import key, load the key you saved in line 6_ + + b) _Save the key by pressing save private key button in the same folder_ + + c) _In Putty, go to Connections->SSH->Auth and load the private key by clicking load key button_ + + d) _go to Connections->SSH->X11 and tick on X11forwarding_ + + e) _Now, write the IP address/ hostname in sessions, save it with a session name and click on open._ + + f) _Type vagrant as username and you should be logged in with X11 forwarding option enabled_ + + g) _To check this option, type $ echo $DISPLAY and see whether localhost=10.0.0 comes up or not. If it does, then you're good to go._ + + h) _Now type firefox in your putty terminal and you should see the output in firefox browser in your windows host machine_ diff --git a/management/auth.py b/management/auth.py index 55f59664..df976f24 100644 --- a/management/auth.py +++ b/management/auth.py @@ -5,7 +5,7 @@ from flask import make_response import utils from mailconfig import get_mail_password, get_mail_user_privileges -DEFAULT_KEY_PATH = '/var/lib/mailinabox/api.key' +DEFAULT_KEY_PATH = '/var/lib/mailinabox/api.key' DEFAULT_AUTH_REALM = 'Mail-in-a-Box Management Server' class KeyAuthService: @@ -82,7 +82,7 @@ class KeyAuthService: def get_user_credentials(self, email, pw, env): # Validate a user's credentials. On success returns a list of # privileges (e.g. [] or ['admin']). On failure raises a ValueError - # with a login error message. + # with a login error message. # Sanity check. if email == "" or pw == "": diff --git a/management/daemon.py b/management/daemon.py index b7bf2a66..956f6cf5 100755 --- a/management/daemon.py +++ b/management/daemon.py @@ -334,7 +334,7 @@ def ssl_get_status(): # What domains can we provision certificates for? What unexpected problems do we have? provision, cant_provision = get_certificates_to_provision(env, show_valid_certs=False) - + # What's the current status of TLS certificates on all of the domain? domains_status = get_web_domains_info(env) domains_status = [ diff --git a/management/ssl_certificates.py b/management/ssl_certificates.py index 1b1e9f83..cb4ee3d5 100755 --- a/management/ssl_certificates.py +++ b/management/ssl_certificates.py @@ -216,12 +216,12 @@ def get_certificates_to_provision(env, limit_domains=None, show_valid_certs=True response = query_dns(domain, rtype) if response != normalize_ip(value): bad_dns.append("%s (%s)" % (response, rtype)) - + if bad_dns: domains_cant_provision[domain] = "The domain name does not resolve to this machine: " \ + (", ".join(bad_dns)) \ + "." - + else: # DNS is all good. diff --git a/setup/migrate.py b/setup/migrate.py index b10f085f..7bcd7a75 100755 --- a/setup/migrate.py +++ b/setup/migrate.py @@ -202,7 +202,7 @@ def run_migrations(): migration_id = None if os.path.exists(migration_id_file): with open(migration_id_file) as f: - migration_id = f.read().strip(); + migration_id = f.read().strip() if migration_id is None: # Load the legacy location of the migration ID. We'll drop support @@ -213,7 +213,7 @@ def run_migrations(): print() print("%s file doesn't exists. Skipping migration..." % (migration_id_file,)) return - + return ourver = int(migration_id) while True: diff --git a/setup/nextcloud.sh b/setup/nextcloud.sh index 90485c8b..8d06f93a 100755 --- a/setup/nextcloud.sh +++ b/setup/nextcloud.sh @@ -26,7 +26,7 @@ InstallNextcloud() { echo # Download and verify - wget_verify https://download.nextcloud.com/server/releases/nextcloud-$version.zip $hash /tmp/nextcloud.zip + wget_verify http://download.nextcloud.com/server/releases/nextcloud-$version.zip $hash /tmp/nextcloud.zip # Remove the current owncloud/Nextcloud rm -rf /usr/local/lib/owncloud diff --git a/setup/start.sh b/setup/start.sh index cedc426d..c079fce2 100755 --- a/setup/start.sh +++ b/setup/start.sh @@ -174,3 +174,4 @@ else echo Then you can confirm the security exception and continue. echo fi +