CouchDB change bind_address without using Fauxton - couchdb

I would like to update the bind address of my CouchDB v3.1.0 instance (note: installed on Windows 10).
I would like to do so without using the Web UI (Fauxton).
Here is what I am doing:
Opening C:\CouchDB\etc\local.ini in a text editor
Within the [chhtpd] section, I am setting bind_address = 0.0.0.0
Based on this answer
[chttpd]
;port = 5984
bind_address = 0.0.0.0
; Options for the MochiWeb HTTP server.
;server_options = [{backlog, 128}, {acceptor_pool_size, 16}]
; For more socket options, consult Erlang's module 'inet' man page.
;socket_options = [{sndbuf, 262144}, {nodelay, true}]
Saving the changes
Restarting the Apache CouchDB service via services.msc
Per this answer
I find the change of bind_address hasn't taken effect
It seems the [chttpd] section of C:\CouchDB\etc\local.d\10-admins.ini is overriding my value.
[chttpd]
bind_address = 127.0.0.1
port = 5984
What am I doing wrong? Do I need to change the bind_address in the 10-admins.ini file?

You should be able to change bind_address without using the Web UI (Fauxton).
Get node membership information to see the name of the node.
curl -X GET "http://localhost:5984/_membership" --user <username>
Change the bind_address in the chttpd/bind_address configuration using following cURL request:
curl -X PUT -H 'Content-Type: application/json' http://localhost:5984/_node/<name#host>/_config/chttpd/bind_address -d '"0.0.0.0"' --user <username>

You are correct, you need to change the bind address in etc\local.d\10-admins.ini file.
According to the CouchDB documentation, files etc/local.d/*.ini take precedence:
By default, CouchDB reads configuration files from the following
locations, in the following order:
etc/default.ini
etc/default.d/*.ini
etc/local.ini
etc/local.d/*.ini
All paths are specified relative to the CouchDB installation
directory: /opt/couchdb recommended on UNIX-like systems, C:\CouchDB
recommended on Windows systems, and a combination of two directories
on macOS: Applications/Apache
CouchDB.app/Contents/Resources/couchdbx-core/etc for the default.ini
and default.d directories, and /Users/youruser/Library/Application
Support/CouchDB2/etc/couchdb for the local.ini and local.d
directories.
Settings in successive documents override the settings in earlier
entries. For example, setting the chttpd/bind_address parameter in
local.ini would override any setting in default.ini.

Related

Apache Directory Studio does not show Root DSE entries

we have a problem with Apache Directory Studio (Version: 2.0.0.v20200411-M15 and previous).
When we connect to an OpenLDAP instance we can't see the naming contexts of the Root DSE.
We have the OpenLDAP configured as multi-master and the strange thing is that in one node we can see it and not in the other.
Root DSE with missing entry screenshot
Root DSE showing the entry screenshot
When we try to get the info via ldapsearch, we can see the correct naming context for both nodes:
ldapsearch -H ldap://localhost:16389 -x -D "cn=adminLDAPI,ou=system,dc=XXXXXXX,dc=com" -W -s base -a always "(objectClass=*)" "namingcontexts"
ldapsearch finds namingcontexts screenshot
If we try to fetch the Base DNs with the connection options, it is not fetched on the "wrong" node.
No base DN returned screenshot
And neither entering manually works.
I've checked cn=config and cn=database but is all the same.
Any ideas?
Thanks in advance

Setup Apache CouchDB screen re-appears on container restart

I have CouchDB v2.3 running using the official Docker image. I've configured the database as a Single Node using Fauxton.
The /data directory is mount to a local directory. When I'm restarting the container, the databases are still there. So the volume binding works as expected.
Now, everytime I'm restarting the container and I navigate to the 'Setup' tab, it looks like CouchDB did not remember I've configured it as a Single Node.
I keep seeing the following screen after restarting the image
Once I've configured it again, I see the following screen
Until I reboot the container. Then I have to the first screen again.
What is going on here?
I was using the wrong CouchDB configuration file path to apply my own configuration.
Non-working example (Dockerfile)
FROM couchdb:2.3
COPY local.ini /opt/couchdb/etc/local.d/docker.ini
Working example (Dockerfile)
FROM couchdb:2.3.0
COPY local.ini /opt/couchdb/etc/local.ini
local.ini
To make sure the cluster should not be re-configured when the Docker container is being re-started, I've also put the configuration inside the local.ini file.
; CouchDB Configuration Settings
; Custom settings should be made in this file. They will override settings
; in default.ini, but unlike changes made to default.ini, this file won't be
; overwritten on server upgrade.
[chttpd]
port = 5984
bind_address = 0.0.0.0
; To create an admin account uncomment the '[admins]' section below and add a
; line in the format 'username = password'. When you next start CouchDB, it
; will change the password to a hash (so that your passwords don't linger
; around in plain-text files). You can add more admin accounts with more
; 'username = password' lines. Don't forget to restart CouchDB after
; changing this.
[admins]
admin = ******
[cluster]
n = 1
I'm not yet sure why my initial configuration copied to /opt/couchdb/etc/local.d/docker.ini wasn't working before.

Connecting to Sybase using sqsh

I am new to sybase. I am trying to connect to the database using sqsh.
sqsh -Ddatabasename -Hservername -Uusername
or
sqsh -D databasename -H servername -U username
I get the following error. server name not found in configuration file. unknown host machine name.
I am trying to connect using the command line. Wouldn't that bypass a config file.
I'm on Linux and I use sqsh like this:
sqsh -I /etc/freetds/freetds.conf -Smyserver -Uknb -Pverysecret -Dmydb
-D argument is optional
and in the /etc/freetds/freetds.conf
there is an entry
[myserver]
host = 123.456.78.90
port = 1433
tds version = 7.2
client charset = UTF-8
This used to work for many years. Right now I have some connectivity problems (segfaults), but this can be due to library configuration issues on my PC.
Don’t use the hostname. Use -S for the servername , which must be defined in the interfaces file (or sql.ini file). You can leave the database name out.

Docker tomcat 7 - welcome page access forbidden

I've tried almost everything.
When I go to a docker container by ssh and curl localhost:8080 there, I get normal welcome page, but If I do curl host_machine_hostname:8082 from my hostmachine by ssh or from everything else using hostname of my hostmachine, I get error, access forbidden.
I have read alot of suggestions but nothing helped.
Connector settings without address does not help, Valve rules with allow=".*" does not help, Host address=host_machine_hostname" does not help.
UPD
I'm sorry. I realized about the root of the problem. I'm using a custom fork of the tomcat and there were specific options for ROOT and other preinstalled packages to block everything while the 127.0.0.1 and the localhost are allowed. So I've got this thing working by removing package-specific context.xml files.
This is because the context.xml in webapps/{package}/META-INF/ was modified to block everytyhing, and if to Read TFM, package's context.xml has more power above the global context.xml file, that's why I couldn't change anything by modifying the global context.xml.
I realized about the root of the problem. I'm using a custom fork of the tomcat and there were specific options for ROOT and other preinstalled packages to block everything while the 127.0.0.1 and the localhost are allowed. So I've got this thing working by removing package-specific context.xml files.
This is because the context.xml in webapps/{package}/META-INF/ was modified to block everytyhing, and if to Read TFM, package's context.xml has more power above the global context.xml file, that's why I couldn't change anything by modifying the global context.xml.

Setting up a local.host alias for localhost on windows

I'm trying to setup everyauth for my node app. Although I've reached a step that I have no idea how to accomplish.
It's asking to setup local.host as an alias for localhost, but it references some linux folders, I'm using windows.
Here's the exact instructions I'm stumped on.
Important - Some OAuth Providers do not allow callbacks to localhost, so you will need to create a localhost alias called local.host. Make sure you set up your /etc/hosts so that 127.0.0.1 is also associated with 'local.host'. So inside your /etc/hosts file, one of the lines will look like: '127.0.0.1 localhost local.host'
(source here)
How do you accomplish this on windows?
This can be done by editing you hosts file. Open notepad++ (or notepad) as admin. Then hit open, and select C:\Windows\System32\drivers\etc\hosts. You will see:
# Copyright (c) 1993-2006 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# ...
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
127.0.0.1 localhost
::1 localhost
And add this line at the end:
127.0.0.1 local.host
Save and you're done
Regarding the answer (Add the entry to your HOSTS file)
This does not work entirely on Windows 10, Windows Server 2019. You CAN PING the new alias (ping local.host), but it you try to use it in windows explorer (\local.host), you get a login prompt that will always fail. Check the EVENT viewer and you will see:
Audit Failure ... A privileged service was called. . . .
C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy\SearchUI.exe
Service Request Information: Privileges: SeTcbPrivilege
I've found no way around this.
So the answer is technically correct, but may not work in all cases.

Resources