i installed FreeRADIUS , Mysql inside docker Container - docker

I installed FreeRADIUS , Mysql inside docker Container
I exposed ports 1812 , 1813 , 3306 outside .
I imported Database to mysql .
I inserted this rows to databases
INSERT INTO nas VALUES (NULL , '0.0.0.0/0', 'myNAS', 'other', NULL , 'mysecret', NULL , NULL , 'RADIUS Client');
INSERT INTO radcheck (username, attribute, op, value) VALUES ('thisuser', 'User-Password', ':=', 'thispassword');
INSERT INTO radusergroup (username, groupname, priority) VALUES ('thisuser', 'thisgroup', '1');
INSERT INTO radgroupreply (groupname, attribute, op, value) VALUES ('thisgroup', 'Service-Type', ':=', 'Framed-User'), ('thisgroup', 'Framed-Protocol', ':=', 'PPP'), ('thisgroup', 'Framed-Compression', ':=', 'Van-Jacobsen-TCP-IP');
and i stopped freeradius ==> service freeradius stop
and iam using debug mode ==> freeradius -X
And when using this Command in another terminal for the same container ==> radtest thisuser thispassword 127.0.0.1 0 mysecret
Output: Server Accepted the request
But When the previous Command in another machine
Server does not see the request and output in the other machine is " No response "
Notes in the IN etc IN freeradius IN radiusd.conf file :
listen {
type = auth
ipaddr = *
port = 0 }
listen {
ipaddr = *
port = 0
type = acct }
How can i fix it ?

Adding the rows to the sql database is insufficient. You need to configure your sql instance in mods-available/sql to match your local database, uncomment read_clients in mods-available/sql, and list the sql module in the instantiate section in radiusd.conf to ensure it's loaded if it's not referenced elsewhere in one of the virtual servers.
After making these changes, restart the server. The SQL module should then read the clients list in on startup. Check the debug output freeradius -X to ensure the SQL module can connect to your database, and read the NAS entries in successfully.
The reason why your local connections work is because there's a client entry included for localhost in the clients.conf file that ships with the server.

I fixed this Issue by expose Ports in UDP Protocol -p 1813:1813/udp -p 1812:1812/udp

Related

spring data elastic search Not a valid protocol version: This is not an HTTP port

I have the following elastic-search container configuration in my test case
#Container
public static GenericContainer container = new GenericContainer<>("elasticsearch:7.7.0")
.withExposedPorts(9200,9300).withEnv("discovery.type","single-node")
.withNetwork(Network.newNetwork())
.withNetworkAliases("someNetwork");
In a #BeforeAll annotated method I elasticsearch url property like this
System.setProperty("spring.data.elasticsearch.cluster-nodes", container.getContainerIpAddress() + ":" + container.getMappedPort(9300));
From power shell when I check the running containers (during the test case debug pause), I find something like this under ports column : 0.0.0.0:32844->9200/tcp, 0.0.0.0:32843->9300/tcp
When I print container.getContainerIpAddress() + ":" + container.getMappedPort(9300), I get the same port mapped to 9300 in the container ports column, in this case localhost:32843, for sure the port is random and get changed in every new run.
when the code `conf = repo.save(conf); run, I get the following exception:
Caused by: org.apache.http.ProtocolException: Not a valid protocol version: This is not an HTTP port
at org.apache.http.impl.nio.codecs.AbstractMessageParser.parse(AbstractMessageParser.java:209)
at org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput(DefaultNHttpClientConnection.java:245)
at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:81)
at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:39)
at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:114)
at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:162)
at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:337)
at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:315)
at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:276)
at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104)
at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:591)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: org.apache.http.ParseException: Not a valid protocol version: This is not an HTTP port
at org.apache.http.message.BasicLineParser.parseProtocolVersion(BasicLineParser.java:148)
at org.apache.http.message.BasicLineParser.parseStatusLine(BasicLineParser.java:366)
at org.apache.http.impl.nio.codecs.DefaultHttpResponseParser.createMessage(DefaultHttpResponseParser.java:112)
at org.apache.http.impl.nio.codecs.DefaultHttpResponseParser.createMessage(DefaultHttpResponseParser.java:50)
at org.apache.http.impl.nio.codecs.AbstractMessageParser.parseHeadLine(AbstractMessageParser.java:156)
at org.apache.http.impl.nio.codecs.AbstractMessageParser.parse(AbstractMessageParser.java:207)
... 11 more
`
You are using a REST client to access Elasticsearch on port 9300. This is the port for the TransportClient. Wit a REST client you need to target port 9200.

Erlang :ssh authentication error. How to connect to ssh using identity file

I'm getting an authentication error when trying to connect ssh host.
The goal is to connect to the host using local forwarding. The command below is an example using drop bear ssh client to connect to host with local forwarding.
dbclient -N -i /opt/private-key-rsa.dropbear -L 2002:1.2.3.4:2006 -p 2002 -l
test_user 11.22.33.44
I have this code so far which returns empty connection
ip = "11.22.33.44"
user = "test_user"
port = 2002
ssh_config = [
user_interaction: false,
silently_accept_hosts: true,
user: String.to_charlist(user),
user_dir: String.to_charlist("/opt/")
]
# returns aunthentication error
{:ok, conn} = :ssh.connect(String.to_charlist(ip), port, ssh_config)
This is the error Im seeing
Server: 'SSH-2.0-OpenSSH_5.2'
Disconnects with code = 14 [RFC4253 11.1]: Unable to connect using the available authentication methods
State = {userauth,client}
Module = ssh_connection_handler, Line = 893.
Details:
User auth failed for: "test_user"
I'm a newbie to elixir and have been reading this erlang ssh document for 2 days. I did not find any examples in the documentation which makes it difficult to understand.
You are using non-default key name, private-key-rsa.dropbear. Erlang by default looks for this set of names:
From ssh module docs:
Optional: one or more User's private key(s) in case of publickey authorization. The default files are
id_dsa and id_dsa.pub
id_rsa and id_rsa.pub
id_ecdsa and id_ecdsa.pub`
To verify this is a reason, try renaming private-key-rsa.dropbear to id_rsa. If this works, the next step would be to add a key_cb callback to the ssh_config which should return the correct key file name.
One example implementation of a similar feature is labzero/ssh_client_key_api.
The solution was to convert dropbear key to ssh key. I have used this link as reference.
Here is the command to convert dropbear key to ssh key
/usr/lib/dropbear/dropbearconvert dropbear openssh /opt/private-key-rsa.dropbear /opt/id_rsa

Informix HDR implementation on Windows 2012 R2 server

We are implementing HDR (High Availability Data Replication) on Windows 2012 R2 Server.
Steps done:
1) Two new Windows 2012 R2 Servers.
IDS 12.10FC8 installed and created the instance manually using Server Instance
Manager.
Server A details:
DBSERVERNAME: hdr_primary
Host Name: winhdr
IP Address: 199.166.155.195
Port Number: 50005
Server B details:
DBSERVERNAME: hdr_secondary
Host Name: winhdr2
IP Address: 199.166.155.196
Port Number: 50005
2) We have only one instance with one database in Server A (Primary).
No database in Server B (Secondary).
3) We have made changes required for HDR in ONCONFIG, Sqlhosts file on both server.
ONCONFIG parameters Server A:
DBSERVERNAME hdr_primary
ROOTPATH C:\IFMXDATA\hdr_primary\rootdbs_dat.000
ROOTSIZE 204800
DRAUTO 0
DRINTERVAL 0
HDR_TXN_SCOPE FULL_SYNC
DRTIMEOUT 30
ONCONFIG parameters Server B:
DBSERVERNAME hdr_primary
ROOTPATH C:\IFMXDATA\hdr_primary\rootdbs_dat.000
ROOTSIZE 204800
DRAUTO 0
DRINTERVAL 0
HDR_TXN_SCOPE FULL_SYNC
DRTIMEOUT 30
SQL hosts at both servers: placed in %INFORMIXDIR%\etc
hdr_secondary onsoctcp winhdr2 hdrsecport
hdr_primary onsoctcp winhdr hdrpriport
host file at both servers: placed in C:\Windows\System32\drivers\etc
199.166.155.195 winhdr
199.166.155.196 winhdr2
winhdr 199.166.155.195
winhdr2 199.166.155.196
host.equvi file # both servers: placed in C:\Windows\System32\drivers\etc
winhdr informix
winhdr2 informix
services file # both servers: placed in C:\Windows\System32\drivers\etc
hdrpriport 50005/tcp #hdr_primary
hdrsecport 50005/tcp #hdr_secondary
4) After all configuration setting has done we have take ontape backup at
Server A.
Server A status: On-Line
ontape -s -L 0
5) Moved the L0 backup to server B and restored with ontape. Cold restore.
ontape -p
Server B status: Fast Recovery
6) On Server A we had run the below command:
onmode -d primary hdr_secondary
Server A status: On-Line(Prim)
7) On Server B we had run the below command:
onmode -d secondary hdr_primary**
Server B status: Fast Recovery(sec).
Till here we have done.
From here we are facing an issue.
The output at server B of onstat -g dri:
Data Replication at 0000000080CEC030:
Type---------------State-------- Paired server -----------Last DR CKPT (id/pg)
Supports Proxy Writes
HDR Secondary off hdr_primary -1 / -1 N
DRINTERVAL 0
DRTIMEOUT 30
DRAUTO 0
DRLOSTFOUND C:\PROGRA~1\IBMINF~1\etc\dr.lostfound
DRIDXAUTO 1
ENCRYPT_HDR 0
Backlog 0
Nothing Sent
Nothing Received
No Pings
Last log page applied(log id,page): 0,0
Issue: Primary and Secondary are not Paired.
Error in Online log is:
Server A
DR: Trying to connect to secondary server = hdr_secondary
DR: Cannot connect to secondary server
DR: Turned off on primary server
Server B
DR: Trying to connect to primary server = hdr_primary
DR: Cannot connect to primary server
DR: Turned off on secondary server
A good practice to test communication between the two servers, is opening dbaccess -> connect -> and choose the remote server alias.
If you cannot connect through dbaccess, you have a network/communication issue that must be investigated. Open a PMR with IBM support.
Make sure your UPDATABLE_SECONDARY onconfig is set to 0, if you don't have licensed your secondary instance as a read/write, just in case.

Can't connect java client to Marklogic database

I've just installed a MarkLogic nosql database out of the box on a windows machine.
I wrote a simple javaclient to put data in to the database but I get this error:
org.apache.http.conn.HttpHostConnectException: Connection to http://my.caci.local:8003 refused
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:158)
The Marklogic database is started. This is the code :
DatabaseClient client = DatabaseClientFactory.newClient("localhost", 8003, "admin", "admin", Authentication.DIGEST);
XMLDocumentManager docMgr = client.newXMLDocumentManager(); BinaryDocumentManager binMgr = client.newBinaryDocumentManager();
DOMHandle handle = new DOMHandle(); for (int i = 0; i < AANT_PERSONEN; i++) {
Document document = createDocument(i);
String docId = "/zaak/" + 20;
handle.set(document);
docMgr.write(docId, handle); }
....
The Marklogic console reports the following ports to be active on my.caci.local:
Default :: Admin : 8001 [HTTP]
Default :: App-Services : 8000 [HTTP]
Default :: HealthCheck : 7997 [HTTP]
Default :: Manage : 8002 [HTTP]
I'm new to marklogic and this is my question:
- what port should I use to connect to from my java client?
In agreement with MystyxMac, I notice the console does not report a REST server on 8003.
Here's the documentation for setting up a REST server:
http://docs.marklogic.com/guide/rest-dev/intro#id_97899
You should also add users for the rest-reader, rest-writer, and rest-admin roles.
Hoping that helps,
Erik Hennum
For testing purposes you can simply switch the port you are using to 8000.
From the documentation:
When you install MarkLogic Server, a pre-configured REST API instance
is available on port 8000. This instance uses the Documents database
as the content database and the Modules database as the modules
database.
The instance on port 8000 is convenient for getting started, but you
will usually create a dedicated instance for production purposes.
http://docs.marklogic.com/guide/rest-dev/service#id_15309

Lua programming ,error in establishing Database connection

After writing the code to connect to database,lua returns an error as
Error in establishing connection to MySQL ,Can't connect to /var/lib/mysql/mysql.sock
I'm unable to locate the /var/lib/mysql/mysql.sock file (which I haven't created )
My Sock is /tmp/mysql.sock
Below is my code to connect to MySQL database.
mysql = require "luasql.mysql"
local env = mysql.mysql()
local conn = env:connect('test','root','')
print(env,conn)
status,errorString = conn:execute([[CREATE TABLE sample2 (id INTEGER, name TEXT);]])
print(status,errorString )
as seen there: Luasql error: "LuaSQL: error connecting to database", the problem is because luasql defaults to using a default socket path when connecting to localhost without a port. so just set the mysql host and port in env:connect or specify the socket path.
EDIT:
I believe your code should be:
env:connect('test','root','','localhost',3306) -- for tcp
-- or
env:connect('test','root','',':/tmp/mysql.sock') -- for socket

Resources