How can I connect to my GitLab omnibus LDAP server to running in a container? - gitlab

I have been trying to work on this for weeks.
root#git:/# gitLab-rake gitlab:ldap:check
Checking LDAP ...
LDAP: ... Server: ldapmain
Deprecation warning: Net::LDAP::ConnectionRefused will be deprecated. Use Errno::ECONNREFUSED instead.
Deprecation warning: Net::LDAP::ConnectionRefused will be deprecated. Use Errno::ECONNREFUSED instead.
Could not connect to the LDAP server: Connection refused - connect(2) for 172.17.0.2:389
Checking LDAP ... Finished
These are the /etc/gitlab/gitlab.rb files:
gitlab_rails['ldap_enabled'] = true
# gitlab_rails['prevent_ldap_sign_in'] = false
###! **remember to close this block with 'EOS' below**
gitlab_rails['ldap_servers'] = YAML.load <<-'EOS'
main: # 'main' is the GitLab 'provider ID' of this LDAP server
label: 'GitLab LDAP'
host: 'git.example.com'
port: 389
uid: 'sAMAccountName'
bind_dn: 'cn=admin,dc=example,dc=com'
password: 'example'
encryption: 'plain' # "start_tls" or "simple_tls" or "plain"
verify_certificates: false
active_directory: true
allow_username_or_email_login: true
lowercase_usernames: false
block_auto_created_users: false
base: 'OU=users,dc=example,dc=com'
user_filter: ''
# ## EE only
group_base: 'cn=my_group,ou=groups,dc=example,dc=com'
admin_group: 'my_admin_group'
EOS
Is there any work around this error? Thanks in advance

Related

NodeJS Artillery with self signed client certificates

I installed the latest versions of nodejs and Artilliery. I want to do load tests using Artillery in this yml:
config:
target: "https://my.ip.address:443"
phases:
- duration: 60
arrivalCount: 100
tls:
rejectUnauthorized: false
client:
key: "./key.pem"
cert: "./certificate.pem"
ca: "./ca.cert"
passphrase: "mypass"
onError:
- log: "Error: invalid tls configuration"
extendedMetrics: true
https:
extendedMetrics: true
logging:
level: "debug"
scenarios:
- flow:
- log: "Current environment is set to: {{ $environment }}"
- get:
url: "/myapp/"
#sslAuth: false
capture:
json: "$.data"
as: "data"
failOnError: true
log: "Error: capturing ${json.error}"
check:
- json: "$.status"
as: "status"
comparison: "eq"
value: 200
not: true
capture:
json: "$.error"
as: "error"
log: "Error: check ${error}"
plugins:
http-ssl-auth: {}
I run Artillery with:
artillery -e production config_tests.yml
I checked the certificates, they are working when used in other applications. They are generated with Openssl
But, all the virtual users fail with error: errors.EPROTO.
Could you please help me find a solution? Thanks in advance!

Installing TMUX in Microsoft Windows Server 2016 Standard Edition and issues with MSYS2

I have a Microsoft Windows Server 2016 Standard Edition VM in which I need to schedule a job which should run every 3 or 5 minutes. This job actually will check for the files in Windows server location Source: ex: D:\Feeds and move the files to Linux Server Destination: /data/feeds/
I have installed the Git bash and scheduled a bash script to run as loop which does the job, but it's getting failed in between with the below error
0 [main] sh 54094 dofork: child -1 - CreateProcessW failed for 'C:\Program Files\Git\usr\bin\sh.exe', errno 13
feed.sh: fork: Permission denied
feed.sh: line 6: /usr/bin/ls: Permission denied
I have to again the start the feed.sh script to move the files from Source (Windows server) to Destination (Linux SFTP server).
In order to fix this, I tried installing TMUX to schedule the script in tmux, for which I tried installing MSYS2 packages, I have installed the same but still vi, sftp commands are not working. I have tried updating the packages but getting the below timeout error.
# pacman -S git
resolving dependencies...
looking for conflicting packages...
Packages (31) expat-2.2.9-1 heimdal-7.7.0-1 openssh-8.3p1-1 perl-Authen-SASL-2.16-2 perl-Convert-BinHex-1.125-1 perl-Encode-Locale-1.05-1 perl-Error-0.17029-1
perl-File-Listing-6.04-2 perl-HTML-Parser-3.72-4 perl-HTML-Tagset-3.20-2 perl-HTTP-Cookies-6.08-1 perl-HTTP-Daemon-6.10-1 perl-HTTP-Date-6.05-1
perl-HTTP-Message-6.25-1 perl-HTTP-Negotiate-6.01-2 perl-IO-Socket-SSL-2.068-1 perl-IO-Stringy-2.113-1 perl-LWP-MediaTypes-6.04-1 perl-MIME-tools-5.509-1
perl-MailTools-2.21-1 perl-Net-HTTP-6.19-1 perl-Net-SMTP-SSL-1.04-1 perl-Net-SSLeay-1.88-1 perl-TermReadKey-2.38-1 perl-TimeDate-2.33-1 perl-Try-Tiny-0.30-1
perl-URI-1.76-1 perl-WWW-RobotRules-6.02-2 perl-libwww-6.46-1 vim-8.2.0869-1 git-2.27.0-1
Total Download Size: 16.68 MiB
Total Installed Size: 94.47 MiB
:: Proceed with installation? [Y/n] y
:: Retrieving packages...
error: failed retrieving file 'expat-2.2.9-1-x86_64.pkg.tar.xz' from repo.msys2.org : Connection timed out after 10016 milliseconds
error: failed retrieving file 'expat-2.2.9-1-x86_64.pkg.tar.xz' from sourceforge.net : Connection timed out after 10002 milliseconds
Debug output:
# pacman -Syuv --debug
debug: pacman v5.2.1 - libalpm v12.0.1
debug: config: attempting to read file /etc/pacman.conf
debug: config: new section 'options'
debug: config: HoldPkg: pacman
debug: config: arch: x86_64
debug: config: SigLevel: Required
debug: config: SigLevel: DatabaseOptional
debug: config: LocalFileSigLevel: Optional
debug: config: new section 'mingw32'
debug: config file /etc/pacman.conf, line 72: including /etc/pacman.d/mirrorlist.mingw32
debug: config: new section 'mingw64'
debug: config file /etc/pacman.conf, line 75: including /etc/pacman.d/mirrorlist.mingw64
debug: config: new section 'msys'
debug: config file /etc/pacman.conf, line 78: including /etc/pacman.d/mirrorlist.msys
debug: config: finished parsing /etc/pacman.conf
debug: setup_libalpm called
debug: option 'logfile' = /var/log/pacman.log
debug: option 'gpgdir' = /etc/pacman.d/gnupg/
debug: option 'hookdir' = /etc/pacman.d/hooks/
debug: option 'cachedir' = /var/cache/pacman/pkg/
debug: registering sync database 'mingw32'
debug: database path for tree mingw32 set to /var/lib/pacman/sync/mingw32.db
debug: GPGME version: 1.13.1-unknown
debug: GPGME engine info: file=/usr/bin/gpg, home=/etc/pacman.d/gnupg/
debug: checking signature for /var/lib/pacman/sync/mingw32.db
debug: 1 signatures returned
debug: fingerprint: AD351C50AE085775EB59333B5F92EFC1A47D45A1
debug: summary: valid
debug: summary: green
debug: status: Success
debug: timestamp: 1593429151
debug: exp_timestamp: 0
debug: validity: full; reason: Success
debug: key: AD351C50AE085775EB59333B5F92EFC1A47D45A1, Alexey Pavlov (Alexpux) <alexpux#gmail.com>, owner_trust unknown, disabled 0
debug: signature is valid
debug: signature is fully trusted
debug: setting usage of 15 for mingw32 repository
debug: adding new server URL to database 'mingw32': http://repo.msys2.org/mingw/i686
debug: adding new server URL to database 'mingw32': https://sourceforge.net/projects/msys2/files/REPOS/MINGW/i686
debug: registering sync database 'mingw64'
debug: database path for tree mingw64 set to /var/lib/pacman/sync/mingw64.db
debug: checking signature for /var/lib/pacman/sync/mingw64.db
debug: 1 signatures returned
debug: fingerprint: AD351C50AE085775EB59333B5F92EFC1A47D45A1
debug: summary: valid
debug: summary: green
debug: status: Success
debug: timestamp: 1593425462
debug: exp_timestamp: 0
debug: validity: full; reason: Success
debug: key: AD351C50AE085775EB59333B5F92EFC1A47D45A1, Alexey Pavlov (Alexpux) <alexpux#gmail.com>, owner_trust unknown, disabled 0
debug: signature is valid
debug: signature is fully trusted
debug: setting usage of 15 for mingw64 repository
debug: adding new server URL to database 'mingw64': http://repo.msys2.org/mingw/x86_64
debug: adding new server URL to database 'mingw64': https://sourceforge.net/projects/msys2/files/REPOS/MINGW/x86_64
Root : /
Conf File : /etc/pacman.conf
DB Path : /var/lib/pacman/
Cache Dirs: /var/cache/pacman/pkg/
Hook Dirs : /usr/share/libalpm/hooks/ /etc/pacman.d/hooks/
Lock File : /var/lib/pacman/db.lck
Log File : /var/log/pacman.log
GPG Dir : /etc/pacman.d/gnupg/
Targets : None
:: Synchronizing package databases...
debug: url: http://repo.msys2.org/mingw/i686/mingw32.db
debug: maxsize: 26214400
debug: using time condition: 1593429151
debug: opened tempfile for download: /var/lib/pacman/sync/mingw32.db.part (wb)
debug: curl returned error 28 from transfer
error: failed retrieving file 'mingw32.db' from repo.msys2.org : Connection timed out after 10018 milliseconds
debug: url: https://sourceforge.net/projects/msys2/files/REPOS/MINGW/i686/mingw32.db
debug: maxsize: 26214400
debug: using time condition: 1593429151
debug: opened tempfile for download: /var/lib/pacman/sync/mingw32.db.part (wb)
debug: curl returned error 28 from transfer
error: failed retrieving file 'mingw32.db' from sourceforge.net : Connection timed out after 10000 milliseconds
Is there any other way to schedule the bash script in powershell?

Configuring express gateway to work with redis

I'm setting up an instance of the express gateway for routing requests to microservices. It works as expected, but I get the following errors when I try to include redis in my system config
0|apigateway-service | 2020-01-09T18:50:10.118Z [EG:policy] error: Failed to initialize custom express-session store, please ensure you have connect-redis npm package installed
0|apigateway-service | 2020-01-09T18:50:10.118Z [EG:gateway] error: Could not hot-reload gateway.config.yml. Configuration is invalid. Error: A client must be directly provided to the RedisStore
0|apigateway-service | 2020-01-09T18:50:10.118Z [EG:gateway] warn: body-parser policy hasn't provided a schema. Validation for this policy will be skipped.
0|apigateway-service | 2020-01-09T18:50:10.118Z [EG:policy] error: Failed to initialize custom express-session store, please ensure you have connect-redis npm package installed
I have installed the necessary packages
npm install redis connect-redis express-session
and have updated the system.config.yml file like so,
# Core
db:
redis:
host: ${REDIS_HOST}
port: ${REDIS_PORT}
db: ${REDIS_DB}
namespace: EG
plugins:
# express-gateway-plugin-example:
# param1: 'param from system.config'
health-check:
package: './health-check/manifest.js'
body-parser:
package: './body-parser/manifest.js'
crypto:
cipherKey: sensitiveKey
algorithm: aes256
saltRounds: 10
# OAuth2 Settings
session:
storeProvider: connect-redis
storeOptions:
host: ${REDIS_HOST}
port: ${REDIS_PORT}
db: ${REDIS_DB}
secret: keyboard cat # replace with secure key that will be used to sign session cookie
resave: false
saveUninitialized: false
accessTokens:
timeToExpiry: 7200000
refreshTokens:
timeToExpiry: 7200000
authorizationCodes:
timeToExpiry: 300000
My gateway.config.yml file looks like this
http:
port: 8080
admin:
port: 9876
apiEndpoints:
accounts:
paths: '/accounts*'
billing:
paths: '/billing*'
serviceEndpoints:
accounts:
url: ${ACCOUNTS_URL}
billing:
url: ${BILLING_URL}
policies:
- body-parser
- basic-auth
- cors
- expression
- key-auth
- log
- oauth2
- proxy
- rate-limit
pipelines:
accounts:
apiEndpoints:
- accounts
policies:
# Uncomment `key-auth:` when instructed to in the Getting Started guide.
# - key-auth:
- body-parser:
- log: # policy name
- action: # array of condition/actions objects
message: ${req.method} ${req.originalUrl} ${JSON.stringify(req.body)} # parameter for log action
- proxy:
- action:
serviceEndpoint: accounts
changeOrigin: true
prependPath: true
ignorePath: false
stripPath: true
billing:
apiEndpoints:
- billing
policies:
# Uncomment `key-auth:` when instructed to in the Getting Started guide.
# - key-auth:
- body-parser:
- log: # policy name
- action: # array of condition/actions objects
message: ${req.method} ${req.originalUrl} ${JSON.stringify(req.body)} # parameter for log action
- proxy:
- action:
serviceEndpoint: billing
changeOrigin: true
prependPath: true
ignorePath: false
stripPath: true
package.json
{
"name": "max-apigateway-service",
"description": "Express Gateway Instance Bootstraped from Command Line",
"repository": {},
"license": "UNLICENSED",
"version": "1.0.0",
"main": "server.js",
"dependencies": {
"connect-redis": "^4.0.3",
"express-gateway": "^1.16.9",
"express-gateway-plugin-example": "^1.0.1",
"express-session": "^1.17.0",
"redis": "^2.8.0"
}
}
Am I missing anything?
In my case, I used AWS Elasticache for Redis. I tried to run it but I had "A client must be directly provided to the RedisStore" error. I found my problem from the security group setting. EC2(server) should have a proper security group for the port of Elasticache. And Elasticache should have the same security group.
Step1. Create new security group. Set the inbound rule
Step2. Add the security group to the EC2 server.
Step3. Add the security group to the Elasticache.

How to configure vagrant to work with node.js

I have problem with running node.js with vagrant.
I have following structure of project:
- public
- hello.js
- vagrant
- puphpet
- Vagrantfile
Here's my puphpet config:
---
vagrantfile-local:
vm:
box: puphpet/debian75-x64
box_url: E:\vagrant boxes\debian-7.5-x86_64-v1.2-virtualbox.box
hostname: ''
memory: '1024'
cpus: '1'
chosen_provider: virtualbox
network:
private_network: 192.168.56.102
forwarded_port:
BD200PpFPN2U:
host: '3000'
guest: '3000'
post_up_message: ''
provider:
virtualbox:
modifyvm:
natdnshostresolver1: on
vmware:
numvcpus: 1
parallels:
cpus: 1
provision:
puppet:
manifests_path: puphpet/puppet
manifest_file: site.pp
module_path: puphpet/puppet/modules
options:
- '--verbose'
- '--hiera_config /vagrant/puphpet/puppet/hiera.yaml'
- '--parser future'
synced_folder:
uREBTumUq032:
owner: www-data
group: www-data
source: ../
target: /var/www
sync_type: default
rsync:
args:
- '--verbose'
- '--archive'
- '-z'
exclude:
- .vagrant/
auto: 'false'
usable_port_range:
start: 10200
stop: 10500
ssh:
host: null
port: null
private_key_path: null
username: vagrant
guest_port: null
keep_alive: true
forward_agent: false
forward_x11: false
shell: 'bash -l'
vagrant:
host: detect
server:
install: '1'
packages: { }
firewall:
install: '1'
rules: null
apache:
install: '1'
settings:
user: www-data
group: www-data
default_vhost: true
manage_user: false
manage_group: false
sendfile: 0
modules:
- rewrite
vhosts:
XWIOX0y1wPTF:
servername: nodeapp.com
docroot: /var/www/public
port: '80'
setenv:
- 'APP_ENV dev'
override:
- All
options:
- Indexes
- FollowSymLinks
- MultiViews
engine: php
custom_fragment: ''
ssl_cert: ''
ssl_key: ''
ssl_chain: ''
ssl_certs_dir: ''
mod_pagespeed: 0
Here is hello.js file
var http = require('http');
var server = http.createServer(function (request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.end("Hello World!");
});
server.listen(3000);
I log to SSH then I go to var/www/public there is file hello.js. I run
node hello.js
I dont get any error/message.
Then I go to 192.168.56.102:3000 and after while I get:
The connection has timed out
Address 192.168.56.102 returns 404 status code, so apache is working.
I tried change host and guest in config.yaml to port 8080 but it didnt work.
Did I do something wrong?
Try removing the forwarded port to 3000 and adding that into the firewall section.

htaccess not recognized in vagrant VM / PuPHPet

I'm in the process of setting up my first puphpet / vagrant box and all is well except that I can't get my site's .htaccess to be recognized. I installed CentOS with apache2 and MySQL and I'm running a rewrite to remove .php extensions:
# Redirect to remove .php
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
However I keep getting page not found errors when I browse to, for example, site.com/login but I hit the page at site.com/login.php. I read a few threads here about changing /etc/httpd/conf/httpd.conf and /etc/httpd/conf.d/10-default_vhost_80.conf to AllowOverride All, which I did, but had no luck after restarting httpd. Here's my config.yaml:
vagrantfile-local:
vm:
box: puphpet/centos65-x64
box_url: puphpet/centos65-x64
hostname: null
memory: '1024'
cpus: '1'
chosen_provider: vmware_fusion
network:
private_network: 192.168.10.200
forwarded_port: { }
provider:
virtualbox:
modifyvm:
natdnshostresolver1: on
setextradata:
VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root: 1
vmware:
numvcpus: 1
parallels:
cpus: 1
provision:
puppet:
manifests_path: puphpet/puppet
manifest_file: site.pp
module_path: puphpet/puppet/modules
options:
- '--verbose'
- '--hiera_config /vagrant/puphpet/puppet/hiera.yaml'
- '--parser future'
synced_folder:
ljjVKPIgQuXE:
source: '/Users/Sean/Documents/Websites/RE Lynx'
target: /var/www/relynx
sync_type: default
rsync:
auto: 'false'
usable_port_range:
start: 10200
stop: 10500
post_up_message: ''
ssh:
host: null
port: null
private_key_path: null
username: vagrant
guest_port: null
keep_alive: true
forward_agent: false
forward_x11: false
shell: 'bash -l'
vagrant:
host: detect
server:
install: '1'
packages: { }
firewall:
install: '1'
rules: null
apache:
install: '1'
settings:
user: www-data
group: www-data
default_vhost: true
manage_user: false
manage_group: false
sendfile: 0
modules:
- rewrite
vhosts:
asawJQkN36Oa:
servername: relynx.dev
serveraliases:
- www.relynx.dev
docroot: /var/www/relynx
port: '80'
setenv:
- 'APP_ENV dev'
override:
- All
options:
- Indexes
- FollowSymLinks
- MultiViews
engine: php
custom_fragment: ''
ssl_cert: ''
ssl_key: ''
ssl_chain: ''
ssl_certs_dir: ''
mod_pagespeed: 0
nginx:
install: '0'
settings:
default_vhost: 1
proxy_buffer_size: 128k
proxy_buffers: '4 256k'
vhosts:
AYbF7pKHAyh0:
server_name: awesome.dev
server_aliases:
- www.awesome.dev
www_root: /var/www/awesome
listen_port: '80'
location: \.php$
index_files:
- index.html
- index.htm
- index.php
envvars:
- 'APP_ENV dev'
engine: php
ssl_cert: ''
ssl_key: ''
php:
install: '1'
version: '55'
composer: '1'
composer_home: ''
modules:
php:
- cli
- intl
- mcrypt
pear: { }
pecl:
- pecl_http
ini:
display_errors: On
error_reporting: '-1'
session.save_path: /var/lib/php/session
timezone: America/Chicago
mod_php: 0
hhvm:
install: '0'
nightly: 0
composer: '1'
composer_home: ''
settings:
host: 127.0.0.1
port: '9000'
ini:
display_errors: On
error_reporting: '-1'
timezone: null
xdebug:
install: '0'
settings:
xdebug.default_enable: '1'
xdebug.remote_autostart: '0'
xdebug.remote_connect_back: '1'
xdebug.remote_enable: '1'
xdebug.remote_handler: dbgp
xdebug.remote_port: '9000'
xhprof:
install: '0'
drush:
install: '0'
version: 6.3.0
ruby:
install: '1'
versions:
IpeE5TzgGzXe:
version: ''
nodejs:
install: '0'
npm_packages: { }
mysql:
install: '1'
root_password: 'something'
adminer: '1'
databases:
RuNUheO1cH27:
grant:
- ALL
name: rladmin_rladmin
host: localhost
user: rladmin_rladmin
password: 'somethingelse'
sql_file: /var/www/relynx/sql/rladmin_rladmin.sql
8UkJkd4eF2TR:
grant:
- ALL
name: rladmin_rlhpsi
host: localhost
user: rladmin_rlhpsi
password: 'somethingelseentirely'
sql_file: /var/www/relynx/sql/rladmin_rlhpsi.sql
postgresql:
install: '0'
settings:
root_password: '123'
user_group: postgres
encoding: UTF8
version: '9.3'
databases: { }
adminer: 0
mariadb:
install: '0'
root_password: '123'
adminer: 0
databases: { }
version: '10.0'
sqlite:
install: '0'
adminer: 0
databases: { }
mongodb:
install: '0'
settings:
auth: 1
port: '27017'
databases: { }
redis:
install: '0'
settings:
conf_port: '6379'
mailcatcher:
install: '0'
settings:
smtp_ip: 0.0.0.0
smtp_port: 1025
http_ip: 0.0.0.0
http_port: '1080'
mailcatcher_path: /usr/local/rvm/wrappers/default
beanstalkd:
install: '0'
settings:
listenaddress: 0.0.0.0
listenport: '13000'
maxjobsize: '65535'
maxconnections: '1024'
binlogdir: /var/lib/beanstalkd/binlog
binlogfsync: null
binlogsize: '10485760'
beanstalk_console: 0
binlogdir: /var/lib/beanstalkd/binlog
rabbitmq:
install: '0'
settings:
port: '5672'
elastic_search:
install: '0'
settings:
java_install: true
autoupgrade: true
As an aside, I also tried this with Ubuntu 14 and got the same problem -- though at least in Ubuntu I could see that the vhost had AllowOveride All set, which I couldn't find in CentOS. However, it appears to do no good either as my site's .htaccess file is not recognized in Ubuntu either.
I had a similar issue today. From my debugging, I found that there is an issue with RewriteRules containing .php extension. I got it working by switching to mod_php as it appears to be an issue with the implementation of PHP-FPM.
For more information on what I found and to see if you are having the same issue, please check out this issue: https://github.com/puphpet/puphpet/issues/1051
Note that switching to mod_php is a temporary solution until a better solution can be found.

Resources