Use of % in SMTP Password for discourse-setup

I used a % as a special character in my SMTP password. This caused a control character to be created in the app.yml file that caused the following errors

(): control characters are not allowed at line 1 column 1 -e LANG=en_US.UTF-8 
YAML syntax error. Please check your containers/*.yml config files. 

I tried rerunning discourse-setup and it kept failing.

Eventually the data field in the app.yml file looked like this:

DISCOURSE_SMTP_PASSWORD: "74 DISCOURSE_SMTP_PASSWORD: "74% DISCOURSE_SMTP_PASSWORD: 74%DISCOURSE_SMTP_PASSWORD: 7e[3~e[3~e[3~e[3~e[3~74%DISCOURSE_SMTP_PASSWORD: pa$$word......"

To resolve I had to manually edit the app.yml file to remove all the bad data and had to remove the % sign from my password. The setup than ran smoothly and allowed the setup of a new discourse install.

4 Likes

Sigh. I thought that I’d fixed it such that special characters didn’t break the smtp password.

Are you saying that even if you edited the file by hand it worked or that you had to create a new password without a percent sign?

3 Likes

I just entered an smtp password with a % and ./discourse-setup properly created:

   DISCOURSE_SMTP_PASSWORD: "hitsd$%password"

It looks like ./launcher is doing fine as well.

Were there other characters in the password? If you’ve changed it, can you send me the exact password so that I can see what’s up?

Thanks.

3 Likes

I use a password generator for all server related components. It uses a wide variety of special characters. Below is the password I used to setup the service that caused the problems. I have changed the actual password being used.

$YkFrf='De\x"*|VWj;3&%!

Use of " in passwords that are stored in config files is usually a bad idea. The password is wrapped in quotes within your app.yml.

4 Likes

Thanks, Stephen. I didn’t notice the quotes on first glance.

Yeah, if you really want to use " or ' in a password, you’ll have to escape it. If you replace the quotes with something else does it work? Or, you might be able to escape them with a \, but I’m not really sure. You’ll probably need to escape them and edit app.yml by hand.

3 Likes

I have the same issue except that my password does not have any special characters. I just accidentally included some-don’t ask!

My app.yml file looks like this…

Error I am getting:

(<unknown>): control characters are not allowed at line 1 column 1 -e LANG=en_US.UTF-8
YAML syntax error. Please check your containers/*.yml config files.

Any ideas?

Try

sudo apt install yamllint
yamllint -d "{extends: relaxed, rules: {line-length: {max: 9999999}}}" containers/app.yml

and share the output here

2 Likes

Here ya go :slight_smile:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following package was automatically installed and is no longer required:
  grub-pc-bin
Use 'sudo apt autoremove' to remove it.
The following additional packages will be installed:
  python3-pathspec
The following NEW packages will be installed:
  python3-pathspec yamllint
0 upgraded, 2 newly installed, 0 to remove and 21 not upgraded.
Need to get 51.8 kB of archives.
After this operation, 255 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirrors.digitalocean.com/ubuntu bionic/universe amd64 python3-pathspec all 0.5.5-1 [22.1 kB]
Get:2 http://mirrors.digitalocean.com/ubuntu bionic/universe amd64 yamllint all 1.10.0-1 [29.6 kB]
Fetched 51.8 kB in 0s (584 kB/s)
Selecting previously unselected package python3-pathspec.
(Reading database ... 60350 files and directories currently installed.)
Preparing to unpack .../python3-pathspec_0.5.5-1_all.deb ...
Unpacking python3-pathspec (0.5.5-1) ..........................................................] 
Selecting previously unselected package yamllint...............................................] 
Preparing to unpack .../yamllint_1.10.0-1_all.deb ...
Unpacking yamllint (1.10.0-1) ...#############.................................................] 
Setting up python3-pathspec (0.5.5-1) ...###################...................................] 
Setting up yamllint (1.10.0-1) ...########################################.....................] 
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...###################################.......]

¿Did you run the yamllint part?

3 Likes

Did you edit the file by hand or did you use discourse-setup?

I’m sorry @schleifer I’m not sure what you mean? :thinking:

@pfaffman I used the discourse-setup.

Ok, it is sorted now. Started afresh this morning and entered everything REALLY carefully. Process running and expected now. Must have entered something really minute.

Thanks for your responses.

3 Likes