Re: [CentOS] HERE document in docker script file

2019-04-30 Thread H
On 04/30/2019 02:54 AM, Gianluca Cecchi wrote:
> On Tue, Apr 30, 2019 at 4:44 AM H  wrote:
>
>> I am trying to use a HERE document in a docker script file to generate a
>> text file but must be doing something wrong since I get a warning message
>> that I did not expect:
>>
>> EOF: line 6: warning: here-document at line 0 delimited by end-of-file
>> (wanted `EOF')
>>
>> This is the sample script I am testing in my docker file:
>>
>> RUN bash -c "$(/bin/echo -e "cat << 'EOF' | tee -a /test.txt \
>> \n \
>> \n  someting here \
>> \n  something else here \
>> \n")" \
>> EOF
>>
>> Can anyone see what is wrong in the above statement?
>>
>> Thanks.
>>
>>
>>
> The second EOF should be before  the part ")" \ and not after, because it
> has to represent the closure of the first one above
>
> So it should be something like this (I have put /tmp/test.txt as I tested
> as non root user that cannot write into /)
>
> bash -c "$(/bin/echo -e "cat < \n \
> \n something here \
> \n
> EOF
> ")"
>
> I also removed the single apex from the first 'EOF'.
>
> I get:
>
> [g.cecchi@ope46 ~]$ ll /tmp/test.txt
> ls: cannot access '/tmp/test.txt': No such file or directory
>
> [g.cecchi@ope46 ~]$ bash -c "$(/bin/echo -e "cat < /tmp/test.txt \
>> \n \
>> \n something here \
>> \n
>> EOF
>> ")"
> 
>  something here
> 
>
> [g.cecchi@ope46 ~]$ cat /tmp/test.txt
> 
>  something here
> 
> [g.cecchi@ope46 ~]$
>
>
> HIH,
> Gianluca
> ___
> CentOS mailing list
> CentOS@centos.org
> https://lists.centos.org/mailman/listinfo/centos

Thank you but in the docker script (running under Centos 7), I get error 
messages unless I add \ as below. However, the below script still results in an 
error message:

RUN bash -c "$(/bin/echo -e "cat < \
\n something here \
\n \
EOF \
")"

bash: line 13: warning: here-document at line 0 delimited by end-of-file 
(wanted `EOF')

It looks like I need to make some additional changes when it is used in a 
docker script?

___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] faI2ban detecting and banning but nothing happens

2019-04-30 Thread Gary Stainburn
On Monday 29 April 2019 17:21:54 Gordon Messmer wrote:
> On 4/29/19 1:44 AM, Gary Stainburn wrote:
> > and the lines are still appearing.  Here is my jail.local. (I did also try 
> > directly editing jail.conf to update the port commands).
> >
> >
> > [exim]
> > port= 0:65535
> 
> 
> If that's all that's in jail.local, then the jail shouldn't be enabled.  
> They're off by default.  I'd suggest that you remove fail2ban 
> completely.  Remove the packages, and then delete /etc/fail2ban, and 
> start again.
> 
> When you're done, look at the output of "iptables -n -L INPUT_direct":
> 
> # iptables -n -L INPUT_direct
> Chain INPUT_direct (1 references)
> target prot opt source   destination
> REJECT tcp  --  0.0.0.0/0    0.0.0.0/0 match-set 
> fail2ban-sshd src reject-with icmp-port-unreachable
> 

My jail.conf contains the following.  What I included above was jail.local

[dovecot]

port= pop3,pop3s,imap,imaps,submission,sieve,25,1025,465,587
logpath = %(dovecot_log)s
backend = %(dovecot_backend)s

[exim]

port   = pop3,pop3s,imap,imaps,submission,sieve,25,1025,465,587
logpath = %(exim_main_log)s


I was also coming to the conclusion that it was time to start again. I'll let 
you know how I get on

Gary
___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] HERE document in docker script file

2019-04-30 Thread Pete Biggs


> > EOF: line 6: warning: here-document at line 0 delimited by end-of-file
> > (wanted `EOF')
> > 
> > This is the sample script I am testing in my docker file:
> > 
> > RUN bash -c "$(/bin/echo -e "cat << 'EOF' | tee -a /test.txt \
> > \n \
> > \n  someting here \
> > \n  something else here \
> > \n")" \
> > EOF
> > 
> > Can anyone see what is wrong in the above statement?
> > 
> > Thanks.
> > 
> > 
> > 
> The second EOF should be before  the part ")" \ and not after, because it
> has to represent the closure of the first one above
> 
> So it should be something like this (I have put /tmp/test.txt as I tested
> as non root user that cannot write into /)
> 
> bash -c "$(/bin/echo -e "cat < \n \
> \n something here \
> \n
> EOF
> ")"

It is also necessary to have the closing here document delimiter on a
line on its own, as you have done, but the OP hadn't. In all these
things it's often useful to remove the escaped new lines. The OPs
original command would been something like:

bash -c "$(/bin/echo -e "cat << 'EOF' | tee -a /test.txt \n \n  someting 
here \n  something else here \n")" EOF

It's obvious from this that the "EOF" isn't on a line on its own and is
in the wrong place compared to the parenthesis.

P.


___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos